Spire.Presentation for Java 3.9.6现已发布。该版本支持获取动画的效果,同时也修复了.ppt转pdf时出现的问题。详情如下。
新功能:
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();
}
}
}
}
}
问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-JAVA.html
本文将介绍如何使用Spire.Presentation for .NET删除PowerPoint文档中的指定节或所有节但保留节中的幻灯片。
原PowerPoint文档包含两个节:

//创建Presentation实例
Presentation ppt = new Presentation();
//加载PowerPoint文档
ppt.LoadFromFile("AddSection.pptx");
//删除第二个节
ppt.SectionList.RemoveAt(1);
//删除所有节
//ppt.SectionList.RemoveAll();
//保存结果文档
ppt.SaveToFile("RemoveSection.pptx", FileFormat.Pptx2013);
'创建Presentation实例
Dim ppt As Presentation = New Presentation
'加载PowerPoint文档
ppt.LoadFromFile("AddSection.pptx")
'删除第二个节
ppt.SectionList.RemoveAt(1)
'删除所有节
'ppt.SectionList.RemoveAll()
'保存结果文档
ppt.SaveToFile("RemoveSection.pptx", FileFormat.Pptx2013)
删除第二个节后的效果:

超链接是 Excel 文档中的一个非常有用的功能,可快速访问其他相关资源,如网站、电子邮件地址或同一工作簿中的特定单元格。但是,有时您可能出于各种原因想要修改或删除现有的超链接,例如更新断开的链接、更正拼写错误或删除过时的信息。在本文中,我们将演示如何使用 Spire.XLS for Java 在 Java 中修改或删除 Excel 中的超链接。
首先,您需要在 Java 程序中添加 Spire.XLS for Java 文件作为依赖项。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>
如果超链接的功能因损坏或拼写错误而出现问题,您可能需要对其进行修改。以下步骤演示了如何修改 Excel 文件中的现有超链接:
import com.spire.xls.*;
import com.spire.xls.collections.HyperLinksCollection;
public class ModifyHyperlink {
public static void main(String[] args) {
//创建工作簿并加载Excel文件
Workbook workbook = new Workbook();
workbook.loadFromFile("示例文档.xlsx");
//获取特定工作表
Worksheet sheet = workbook.getWorksheets().get(0);
//获取工作表中所有超链接的集合
HyperLinksCollection links = sheet.getHyperLinks();
//更改TextToDisplay和Address属性的值
links.get(0).setTextToDisplay("印度尼西亚");
links.get(0).setAddress("https://www.indonesia.travel/sg/zh-cn/home");
//保存文档
workbook.saveToFile("修改超链接.xlsx", ExcelVersion.Version2013);
workbook.dispose();
}
}
Spire.XLS for Java 还提供了 Worksheet.getHyperLinks().removeAt() 方法来删除超链接。以下是从 Excel 中删除超链接的具体步骤。
import com.spire.xls.*;
import com.spire.xls.collections.HyperLinksCollection;
public class RemoveHyperlink {
public static void main(String[] args) {
//创建工作簿并加载Excel文件
Workbook workbook = new Workbook();
workbook.loadFromFile("示例文档.xlsx");
//获取特定工作表
Worksheet sheet = workbook.getWorksheets().get(0);
//获取工作表中所有超链接的集合
HyperLinksCollection links = sheet.getHyperLinks();
//删除第一个超链接并保留链接文本
sheet.getHyperLinks().removeAt(0);
//删除单元格中的所有内容
//sheet.getCellRange("A3").clearAll();
//保存文档
String output = "移除超链接.xlsx";
workbook.saveToFile(output, ExcelVersion.Version2013);
workbook.dispose();
}
}
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。
本文介绍如何使用Spire.Doc for Java 提供的PrinterJob类打印Word文档。通过该类,可以设置打印纸张大小,打印份数,是否弹出打印对话框等,且使用该方法打印出来的文档清晰度更高。
import com.spire.doc.*;
import java.awt.print.*;
public class WordPrint {
public static void main(String[] args) throws Exception {
//加载文档
Document doc = new Document();
doc.loadFromFile("Sample.docx");
PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
PageFormat loPageFormat = loPrinterJob.defaultPage();
//设置打印纸张大小
Paper loPaper = loPageFormat.getPaper();
loPaper.setSize(600, 500);
loPageFormat.setPaper(loPaper);
//删除默认页边距
loPaper.setImageableArea(0, 0, loPageFormat.getWidth(), loPageFormat.getHeight());
//设置打印份数
loPrinterJob.setCopies(1);
loPrinterJob.setPrintable(doc, loPageFormat);
//设置打印对话框
if (loPrinterJob.printDialog()) {
//执行打印
try {
loPrinterJob.print();
} catch (PrinterException e)
{
e.printStackTrace();
}
}
}
} Spire.Barcode for Java 3.9.3现已发布。该版本支持设置条码顶部文本的排列方式,同时也支持在条形码底部添加自定义文本。除此之外,一些在扫描条形码和QR码时出现的问题也得以成功解决。详情请查阅以下内容。
新功能:
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设置Word文档中的行间距。
//创建文档
Document doc = new Document();
//添加节
Section s = doc.AddSection();
//添加段落
Paragraph para = s.AddParagraph();
para.AppendText("Spire.Doc for .NET是一款专门对Word文档进行操作的.NET类库。" +
"这款控件的主要功能在于帮助开发人员轻松快捷高效地创建、编辑、转换和打印Microsoft" +
"Word文档。作为一款独立的Word .NET控件,Spire.Doc for .NET的运行系统(服务" +
"器端或客户端)均无需安装 Microsoft Word,但是它却可以将 Microsoft Word 文档的操" +
"作功能集成到任何开发人员的 .NET 应用程序中。");
//设置段落中行距
para.Format.LineSpacing = 30f;
//创建段落样式
ParagraphStyle style = new ParagraphStyle(doc);
style.Name = "paraStyle";
style.CharacterFormat.FontName = "宋体";
style.CharacterFormat.FontSize = 13;
doc.Styles.Add(style);
//应用段落样式
para.ApplyStyle("paraStyle");
//保存文档
doc.SaveToFile("SetLineSpacing.docx", FileFormat.Docx2013);
'创建文档
Document doc = New Document()
'添加节
Dim s As Section = doc.AddSection()
'添加段落
Dim para As Paragraph = s.AddParagraph()
para.AppendText("Spire.Doc for .NET是一款专门对Word文档进行操作的.NET类库。" +
"这款控件的主要功能在于帮助开发人员轻松快捷高效地创建、编辑、转换和打印Microsoft" +
"Word文档。作为一款独立的Word .NET控件,Spire.Doc for .NET的运行系统(服务" +
"器端或客户端)均无需安装 Microsoft Word,但是它却可以将 Microsoft Word 文档的操" +
"作功能集成到任何开发人员的 .NET 应用程序中。")
'设置段落中行距
para.Format.LineSpacing = 30f
'创建段落样式
Dim style As ParagraphStyle = New ParagraphStyle(doc)
style.Name = "paraStyle"
style.CharacterFormat.FontName = "宋体"
style.CharacterFormat.FontSize = 13
doc.Styles.Add(style)
'应用段落样式
para.ApplyStyle("paraStyle")
'保存文档
doc.SaveToFile("SetLineSpacing.docx", FileFormat.Docx2013)

Spire.Office 5.9.2 已正式发布。该版本新增了一些功能,例如:Spire.Presentation支持添加幻灯片到节以及删除节中的幻灯片,Spire.Presentation支持获取节的索引并删除节,Spire.XLS支持隐藏XLSX文档的视图功能。此外,本次更新也修复了PPT/Word/Excel转PDF出现的问题。更多新功能及问题修复详情如下。
该版本涵盖了最新版的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
问题修复:
新功能:
Section sect01 = ppt.SectionList.Insert(0, "section1");
Section sect02 = ppt.SectionList.Append("section2");
ISlide slide01 = ppt.Slides.Append();
ISlide slide02 = ppt.Slides.Append();
Section section01 = ppt.SectionList.Add("section1", slide01);
Section section02 = ppt.SectionList.Insert(1, "section2");
Section section03 = ppt.SectionList.Append("section3");
//添加幻灯片
ISlide slide03 = ppt.SectionList.InsertSlide(section02, 0, slide01);
ISlide slide04 = section02.Insert(1, slide02);
section02.AddRange(new ISlide[] { slide03, slide04 });
//移动幻灯片
ppt.SectionList.MoveSlide(section03, 0, slide03);
section03.Move(1, slide04);
//删除幻灯片
ppt.SectionList.RemoveSlide(section03, 0);
section01.RemoveAt(0);
section02.RemoveRange(0, 3);
section03.Remove(slide04);
int index1 = ppt.SectionList.IndexOf(section01);
int index2 = section02.Index;
ppt.SectionList.RemoveAt(1);
ppt.SectionList.RemoveAll();
问题修复:
新功能:
workbook.IsHideWindow = true;
优化:
问题修复:
问题修复:
Spire.Doc 8.9.6于今日发布。该版本主要修复了一些在Word转PDF/图片,添加水印及加载Word文档时出现的问题。详情参见下文。
问题修复:
本文将介绍如何使用Spire.Presentation for Java删除PPT文档中的文本框。
原PPT文档如下:

import com.spire.presentation.*;
public class removeTextBox {
public static void main(String[] args) throws Exception {
//加载PPT文档
Presentation ppt = new Presentation();
ppt.loadFromFile("sample.pptx");
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//遍历幻灯片中的形状并删除其中的文本框
for (int i = slide.getShapes().getCount() - 1; i >= 0; i--) {
IAutoShape shape = (IAutoShape) slide.getShapes().get(i);
if (shape.isTextBox()) {
slide.getShapes().removeAt(i);
}
}
//保存文档
ppt.saveToFile("output/removeTextBox.pptx", FileFormat.PPTX_2013);
}
}
文本框删除效果:

超链接在 Word 文档中通常以蓝色带下划线的字体格式呈现。如果你不喜欢这种默认的超链接样式,可以更改超链接颜色或删除超链接的下划线,在把超链接设置成自己喜欢的样式的同时,保留超链接。本文将介绍如何使用 Spire.Doc for Java 以编程的方式更改超链接颜色或移除超链接下划线。
首先,您需要在 Java 程序中添加 Spire.Doc.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.doc</artifactId>
<version>14.9.5</version>
</dependency>
</dependencies>
详细操作步骤如下:
import com.spire.doc.Document;
import com.spire.doc.FileFormat;
import com.spire.doc.Section;
import com.spire.doc.documents.*;
import com.spire.doc.fields.TextRange;
import java.awt.*;
public class ChangeHyperlink {
public static void main(String[] args) {
//创建 Document 类的对象
Document document = new Document();
//添加一个节
Section section = document.addSection();
//添加一个段落
Paragraph para= section.addParagraph();
para.appendText("普通超链接: ");
//插入一个超链接
TextRange textRange = para.appendHyperlink("www.e-iceblue.com", "E-iceblue", HyperlinkType.Web_Link);
textRange.getCharacterFormat().setFontName("Times New Roman");
textRange.getCharacterFormat().setFontSize(12f);
para.appendBreak(BreakType.Line_Break);
//添加一个段落
para = section.addParagraph();
para.appendText("更改超链接颜色: ");
//插入一个超链接
textRange = para.appendHyperlink("www.e-iceblue.com", "E-iceblue", HyperlinkType.Web_Link);
textRange.getCharacterFormat().setFontName("Times New Roman");
textRange.getCharacterFormat().setFontSize(12f);
//将超链接颜色更改为红色
textRange.getCharacterFormat().setTextColor(Color.RED);
para.appendBreak(BreakType.Line_Break);
//添加一个段落
para = section.addParagraph();
para.appendText("移除超链接下划线: ");
//插入一个超链接
textRange = para.appendHyperlink("www.e-iceblue.com", "E-iceblue", HyperlinkType.Web_Link);
textRange.getCharacterFormat().setFontName("Times New Roman");
textRange.getCharacterFormat().setFontSize(12f);
//移除超链接下划线
textRange.getCharacterFormat().setUnderlineStyle(UnderlineStyle.None);
//保存文档
document.saveToFile("更改超链接样式.docx", FileFormat.Docx_2013);
}
}
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。