Spire.Doc 8.10.0已发布。该版本增强了Word转换到PDF的功能,并且修复了一些在合并和保存文档后出现的问题。请阅读以下详细内容。
问题修复:
本文将介绍如何使用Spire.Presentation for .NET给PPT文档中的SmartArt图形的节点添加超链接。
using Spire.Presentation;
using Spire.Presentation.Diagrams;
namespace SmartArt
{
class Program
{
static void Main(string[] args)
{
//创建Presentation实例
Presentation ppt = new Presentation();
//加载PPT文档
ppt.LoadFromFile("SmartArt.pptx");
//获取第一张幻灯片
ISlide slide = ppt.Slides[0];
//获取SmartArt图形
ISmartArt smartArt = slide.Shapes[0] as ISmartArt;
//添加指向网页的超链接到SmartArt图形的第一个节点
smartArt.Nodes[0].Click = new ClickHyperlink("https://www.e-iceblue.com");
//添加指向文档中指定幻灯片的超链接到SmartArt图形的第二个节点
smartArt.Nodes[1].Click = new ClickHyperlink(ppt.Slides[1]);
//保存结果文档
ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013);
}
}
}
Imports Spire.Presentation
Imports Spire.Presentation.Diagrams
Namespace SmartArt
Class Program
Private Shared Sub Main(ByVal args As String())
Dim ppt As Presentation = New Presentation()
ppt.LoadFromFile("SmartArt.pptx")
Dim slide As ISlide = ppt.Slides(0)
Dim smartArt As ISmartArt = TryCast(slide.Shapes(0), ISmartArt)
smartArt.Nodes(0).Click = New ClickHyperlink("https://www.e-iceblue.com")
smartArt.Nodes(1).Click = New ClickHyperlink(ppt.Slides(1))
ppt.SaveToFile("Result.pptx", FileFormat.Pptx2013)
End Sub
End Class
End Namespace
效果图:

Spire.XLS for Java 支持将 Excel 文档转为多种文件格式,如 PDF、HTML、XPS、SVG 以及图片等;其中,转为图片时,支持 BMP/PNG/GIF/JPG/JPEG 等格式,并且支持设置图片分辨率。下面,将通过 Java 程序代码介绍如何来实现转为图片并设置分辨率。
首先,您需要在 Java 程序中添加 Spire.Xls.jar 文件作为依赖项。JAR 文件可以从此链接下载。 如果您使用 Maven,则可以将以下代码添加到项目的 pom.xml 文件中,从而轻松地在应用程序中导入JAR文件。
<repositories>
<repository>
<id>com.e-iceblue</id>
<name>e-iceblue</name>
<url>https://repo.e-iceblue.cn/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>e-iceblue</groupId>
<artifactId>spire.xls</artifactId>
<version>16.9.2</version>
</dependency>
</dependencies>
转换时,可通过以下步骤完成:
import com.spire.xls.*;
public class SetDPI {
public static void main(String[] args) {
//加载Excel文档
Workbook wb = new Workbook();
wb.loadFromFile("test.xlsx");
//设置水平分辨率及垂直分辨率
wb.getConverterSetting().setXDpi(300);
wb.getConverterSetting().setYDpi(300);
//遍历工作表
for (int i = 0; i < wb.getWorksheets().getCount(); i++)
{
//获取工作表
Worksheet sheet = wb.getWorksheets().get(i);
//将工作表转换为图片
sheet.saveToImage("image-" + i + ".png");
}
}
}
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请 该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。 获取有效期 30 天的临时许可证。
Spire.PDF 6.10.0已发布。该版本增强了PDF转化到图片的功能,并修复了在打印,合并以及加载PDF文件时出现的问题。详细请阅读以下。
问题修复:
尊敬的新老客户:
2020年国庆将至,成都冰蓝科技有限公司全体职工在此向您致以最诚挚的祝福与问候!为落实节日期间的合作事宜,我司就国庆放假做如下通知:
因放假给您造成的不便之处,敬请谅解。
恭祝:节日快乐,万事如意!
邮件联系方式:
Spire.Office 5.9.6已正式发布。该版本新增了一些功能,例如:Spire.Presentaion支持对组合图形取消组合和GroupShapes方法返回GroupShape对象,并新增了GetPlaceholderShapes方法来通过占位符获取幻灯片母版版式中的形状的功能;Spire.XLS支持设置透视表域的重复项目标签选项;Spire.Barcode支持设置条码顶部文本的排列方式以及在条形码底部添加自定义文本。此外,本次更新也修复了一些在转换、操作PowerPoint、Excel和PDF文档以及扫描barcode时出现的问题。更多新功能及问题修复详情如下。
该版本涵盖了最新版的Spire.Doc、Spire.PDF、Spire.XLS、Spire.Presentation、Spire.DataExport、Spire.Barcode、Spire.DocViewer、Spire.PDFViewer、Spire.OfficeViewer、Spire.Email。
版本信息如下::
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
新功能:
GroupShape groupShape = presentation.Slides[0].Shapes[0] as GroupShape;
presentation.Slides[0].Ungroup(groupShape);
Placeholder placeholder = presentation.Slides[1].Shapes[0].Placeholder;
IShape[] shapes = presentation.Slides[1].GetPlaceholderShapes(placeholder);
for (int i = 0; i < shapes.Length; i++)
{
if (shapes[i] is IAutoShape)
{
IAutoShape autoShape = shapes[i] as IAutoShape;
if (autoShape.TextFrame != null)
{
Console.WriteLine(autoShape.TextFrame.Text);
}
}
}
ArrayList groupShapeList = new ArrayList();
groupShapeList.Add(shape1);
groupShapeList.Add(shape2);
groupShapeList.Add(shape3);
GroupShape groupshape = ppt.Slides[0].GroupShapes(groupShapeList);
问题修复:
新功能:
pt.PivotFields["OnHand"].RepeatItemLabels = true;
问题修复:
问题修复:
新功能:
int width = 399;
int height = 159;
BarcodeSettings bs = new BarcodeSettings();
bs.Type = BarCodeType.UPCA;
bs.Unit = GraphicsUnit.Pixel;
bs.WideNarrowRatio = 0.5f;
bs.TextFont = new Font("Arial", 20, FontStyle.Regular);
string data = "602318275035";
bs.Data2D = data;
bs.Data = data;
bs.ShowTextOnBottom = true;
bs.TopText = data;
bs.ShowTopText = true;
bs.TextAlignment = StringAlignment.Center;
bs.TopTextAligment = StringAlignment.Center;
bs.TopTextFont = new Font("Arial", 20, FontStyle.Regular);
bs.AutoResize = false;
bs.X = 3.0f;
bs.BarHeight = height * 0.6f;
bs.ImageWidth = width;
bs.ImageHeight = height;
BarCodeGenerator generator = new BarCodeGenerator(bs);
Image barImage = generator.GenerateImage();
barImage.Save(outputFile_img, ImageFormat.Png);
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.Type=BarCodeType.EAN13;
barsetting.BackColor = Color.WhiteSmoke;
String data = "6901234567892";
barsetting.Data=data;
barsetting.Data2D=data;barsetting.TopText="EAN13";
barsetting.TopTextFont=new Font("Arial", 20, FontStyle.Regular);
barsetting.TopTextColor=Color.Red;
barsetting.ShowTopText=true;
barsetting.ShowTextOnBottom=true;
barsetting.TopTextAligment=StringAlignment.Center;
barsetting.BottomText="EAN";
barsetting.BottomTextFont=new Font("fangsong", 25, FontStyle.Bold);
barsetting.BottomTextColor=Color.Black;
barsetting.ShowBottomText=true;
barsetting.BottomTextAligment=StringAlignment.Far;
BarCodeGenerator generator = new BarCodeGenerator(barsetting);
Image barcode = generator.GenerateImage();
barcode.Save(outputFile_img);
问题修复:
Spire.Barcode 4.9.2现已发布。该版本支持设置条码顶部文本的排列方式,同时也支持在条形码底部添加自定义文本。除此之外,一些在扫描条形码和QR码时出现的问题也得以成功解决。详情请查阅以下内容。
新功能:
int width = 399;
int height = 159;
BarcodeSettings bs = new BarcodeSettings();
bs.Type = BarCodeType.UPCA;
bs.Unit = GraphicsUnit.Pixel;
bs.WideNarrowRatio = 0.5f;
bs.TextFont = new Font("Arial", 20, FontStyle.Regular);
string data = "602318275035";
bs.Data2D = data;
bs.Data = data;
bs.ShowTextOnBottom = true;
bs.TopText = data;
bs.ShowTopText = true;
bs.TextAlignment = StringAlignment.Center;
bs.TopTextAligment = StringAlignment.Center;
bs.TopTextFont = new Font("Arial", 20, FontStyle.Regular);
bs.AutoResize = false;
bs.X = 3.0f;
bs.BarHeight = height * 0.6f;
bs.ImageWidth = width;
bs.ImageHeight = height;
BarCodeGenerator generator = new BarCodeGenerator(bs);
Image barImage = generator.GenerateImage();
barImage.Save(outputFile_img, ImageFormat.Png);
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.Type=BarCodeType.EAN13;
barsetting.BackColor = Color.WhiteSmoke;
String data = "6901234567892";
barsetting.Data=data;
barsetting.Data2D=data;barsetting.TopText="EAN13";
barsetting.TopTextFont=new Font("Arial", 20, FontStyle.Regular);
barsetting.TopTextColor=Color.Red;
barsetting.ShowTopText=true;
barsetting.ShowTextOnBottom=true;
barsetting.TopTextAligment=StringAlignment.Center;
barsetting.BottomText="EAN";
barsetting.BottomTextFont=new Font("fangsong", 25, FontStyle.Bold);
barsetting.BottomTextColor=Color.Black;
barsetting.ShowBottomText=true;
barsetting.BottomTextAligment=StringAlignment.Far;
BarCodeGenerator generator = new BarCodeGenerator(barsetting);
Image barcode = generator.GenerateImage();
barcode.Save(outputFile_img);
问题修复:
Spire.Office for Java 3.9.4现已发布。此次更新的版本拥有许多新功能,例如,Spire.Doc for Java支持比较两个Word文档和清除单元格背景;Spire.PDF for Java支持将SVG转换到PDF;Spire.XLS for Java支持将Excel转换到TIFF;Spire.Presentation for Java支持更新PPT文档中的Video视频数据;Spire.Barcode for Java支持设置条码顶部文本的排列方式。与此同时,一些在加载、操作和转换Word、Excel、PDF和Presentation文档及扫描条形码时出现的问题也得以成功解决。
获取Spire.Office for Java 3.9.4,请点击:https://www.e-iceblue.cn/Downloads/Spire-Office-JAVA.html
新功能:
Document doc1 = new Document();
doc1.loadFromFile(inputFile_1);
Document doc2 = new Document();
doc2.loadFromFile(inputFile_2);
doc1.compare(doc2, "E-iceblue");
doc1.saveToFile(outputFile);
tablecell.getCellFormat().clearBackground();
doc.saveToImages(pageIndex, pageCount, ImageType.Bitmap, dpiX, dpiY);
优化:
问题修复:
新功能:
PdfDocument doc = new PdfDocument();
doc.loadFromSvg(inputFile_svg);
doc.saveToFile(outputFile);
PdfDocument doc1 = new PdfDocument();
doc1.loadFromSvg(inputFile_svg);
PdfDocument doc2 = new PdfDocument();
doc2.loadFromFile(inputFile_pdf);
doc2.getPages().get(0).getCanvas().drawTemplate(doc1.getPages().get(0).createTemplate(), new Point2D.Float(10,10), new Dimension(100,100) );
doc2.saveToFile(outputFile, FileFormat.PDF);
doc1.close();
doc2.close();
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(inputFile);
pdf.getConvertOptions().setConvertToWordUsingFlow(true);
pdf.saveToFile(outputFile_doc, FileFormat.DOC);
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(inputFile);
pdf.saveToFile(outputPath, FileFormat.XLSX);
问题修复:
新功能:
workbook.getConverterSetting().setXDpi(300);
workbook.getConverterSetting().setYDpi(300);
Worksheet sheet;
for (int i = 0; i < wb.getWorksheets().size(); i++) {
sheet = wb.getWorksheets().get(i);
sheet.saveToImage(outputFile + i + ".png");
}
问题修复:
新功能:
File file = new File("videoPath");
FileInputStream fileInputStream = new FileInputStream(file);
byte[] data = new byte[(int)file.length()];
fileInputStream.read(data);
VideoCollection videos = presentation.getVideos();
VideoData videoData = videos.append(data);
IVideo iVideo = (IVideo) presentation.getSlides().get(0).getShapes().get(0);
iVideo.setEmbeddedVideoData(videoData);
for (int i = 0; i < presentation.getSlides().getCount(); i++) {
ISlide slide = presentation.getSlides().get(i);
for (int j = 0; j < slide.getShapes().getCount(); j++) {
IShape shape = slide.getShapes().get(j);
if (shape instanceof IAudio) {
String audioPartName = ((IAudio) shape).getData().getPartName();
}
if (shape instanceof IVideo) {
String videoPartName = ((IVideo) shape).getEmbeddedVideoData().getPartName();
}
}
for (int i = 0; i < slide.getTimeline().getMainSequence().getCount(); i++) {
AnimationEffect animationEffect = slide.getTimeline().getMainSequence().get(i);
AnimationAmountType amount = animationEffect.getAmount();
}
Presentation presentation = new Presentation();
presentation.loadFromFile("data/animation.pptx");
for (int c = 0; c < presentation.getSlides().getCount(); c++) {
ISlide slide = presentation.getSlides().get(c);
for (int i = 0; i < slide.getTimeline().getMainSequence().getCount(); i++) {
AnimationEffect animationEffect = slide.getTimeline().getMainSequence().get(i);
//预设类型,比如Entrance,Emphasis,Exit,Path
String presetClassType = animationEffect.getPresetClassType().getName();
//获取动画效果类型
AnimationEffectType animationEffectType= animationEffect.getAnimationEffectType();
//获取目标Shape
Shape shape = animationEffect.getShapeTarget();
//获取动画效果子类型
String subType = animationEffect.getSubtype().getName();
//获取Color
Color color = animationEffect.getColor();
//当动画效果类型为Faded_Zoom时,获取vanishing point(消失点)
if (animationEffectType.equals(AnimationEffectType.FADED_ZOOM)) {
String vanishingPointName = animationEffect.getVanishingPoint().getName();
}
//获取WAVE动画效果
if (animationEffectType.equals(AnimationEffectType.WAVE)) {
TextAnimationCollection textAnimations = slide.getTimeline().getTextAnimations();
if (textAnimations.size() > 0) {
for (int j = 0; j < textAnimations.size(); j++) {
ParagraphBuildType buildType = textAnimations.get(j).getParagraphBuildType();
}
}
}
}
}
优化:
问题修复:
新功能:
int width = 399;
int height = 159;
BarcodeSettings bs = new BarcodeSettings();
bs.setType(BarCodeType.UPCA);
bs.setUnit(GraphicsUnit.Pixel);
bs.setWideNarrowRatio(0.5f);
bs.setTextFont(new Font("Arial", Font.PLAIN,20 ));
String data = "602318275035";
bs.setData(data);
bs.setData2D(data);
bs.setShowTextOnBottom(true);
bs.setTopText(data);
bs.setShowTopText(true);
bs.setTextAlignment(StringAlignment.Center);
bs.setTopTextAligment(StringAlignment.Center);
bs.setTopTextFont(new Font("Arial", Font.PLAIN, 20));
bs.setAutoResize(false);
bs.setX(3.0f);
bs.setBarHeight(height * 0.6f);
bs.setImageHeight(height);
bs.setImageWidth(width);
BarCodeGenerator barCodeGenerator = new BarCodeGenerator(bs);
BufferedImage bufferedImage = barCodeGenerator.generateImage();
ImageIO.write(bufferedImage, "png", new File("result.png"));
barsetting.setBottomText("EAN");
barsetting.setBottomTextFont(new Font("fangsong", Font.BOLD, 25));
barsetting.setBottomTextColor(Color.BLACK);
barsetting.setShowBottomText(true);
barsetting.setBottomTextAlignment(StringAlignment.Center);
问题修复:
Spire.Doc for Java 3.9.4已发布。该版本增强了Word转换到PDF/Image的功能,并且修复了插入目录后进行更新目录域时出现的问题。详情请阅读以下。
问题修复:
Spire.PDF 6.9.16已发布。该版本增强了PDF转化到Word/XPS/HTML/Image的功能,修复了查找文本,提取文本和图片时出现的问题。详情请阅读以下内容。
问题修复: