Spire.Doc 11.8.2 已发布。本次更新公开了 ShapeObject 对象下的 AllowOverlap 和 BehindText 属性。详情请阅读以下内容。
新功能:
在我司全体员工的不懈努力下,Spire.Presentation for Python 已于2023年8月上线。目前 Python 产品已开放下载,欢迎大家试用。更多的 Python 产品也即将推出,敬请期待。
Spire.Presentation for Python 是一款专业的 Python PPT 开发组件,可以在各种 Python 平台上使用。该组件提供了一个 PowerPoint 对象模型,能够帮助开发人员在 Python 平台上快速创建、编辑、转换和保存 PowerPoint 演示文稿等。
获取 Spire.Presentation for Python 请点击:https://www.e-iceblue.cn/Downloads/Spire-Presentation-Python.html
Spire.Office 8.8.0 已发布。在该版本中,Spire.PDF 支持 PDF 文档文本比较功能以及在将 PDF 转换为 Word 时保留相同的字体名字;Spire.Presentation 新增了用于重置文档转换默认字体列表的方法;Spire.XLS 支持设置 DIN A0 的纸张大小以及灰度打印。此外,许多已知问题也在该版本中成功修复。详情请阅读以下内容。
该版本涵盖了最新版的 Spire.Doc,Spire.PDF,Spire.XLS,Spire.Email,Spire.DocViewer, Spire.PDFViewer,Spire.Presentation,Spire.Spreadsheet, Spire.OfficeViewer, Spire.DocViewer, Spire.Barcode, Spire.DataExport。
版本信息如下:
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
新功能:
PdfDocument doc = new PdfDocument();
//Add a new page
PdfPageBase page = doc.Pages.Add();
PdfGrid grid = new PdfGrid();
grid.Columns.Add(1);
PdfGridRow headerRow1 = grid.Headers.Add(1)[0];
//HEADER WITHOUT UNCICODE SUPPORT BUT VALID WORD FONT
headerRow1.Style.Font = new PdfTrueTypeFont(new Font("Arial", 11f, FontStyle.Regular), true);
headerRow1.Cells[0].Value = "Spire.PDF for .NET";
headerRow1.Cells[0].StringFormat = new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);
grid.Draw(page, new PointF(0, 10));
//Save the document to stream
MemoryStream stream = new MemoryStream();
doc.SaveToStream(stream, FileFormat.PDF);
stream.Position = 0L;
PdfToWordConverter converter = new PdfToWordConverter(stream);
converter.SaveToDocx(@"out.docx");PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"in.pdf");
PdfSecurityPolicy securityPolicy = new PdfPasswordSecurityPolicy(userPassword, ownerPassword);
securityPolicy.EncryptMetadata = false;
securityPolicy.EncryptionAlgorithm = PdfEncryptionAlgorithm.AES_128;
securityPolicy.DocumentPrivilege = PdfDocumentPrivilege.AllowAll;
securityPolicy.DocumentPrivilege.AllowPrint = false;
doc.Encrypt(securityPolicy);
doc.SaveToFile(@"out.pdf");PdfDocument pdf1 = new PdfDocument(inputFile_1);
PdfDocument pdf2 = new PdfDocument(inputFile_2);
PdfComparer compare = new PdfComparer(pdf1, pdf2);
compare.Options.SetPageRanges(0, pdf1.Pages.Count - 1, 0, pdf2.Pages.Count - 1);
compare.Compare(outputFile);问题修复:
新功能:
presentation.setDefaultFontName("华文行楷");presentation.resetDefaultFontName();问题修复:
新功能:
sheet.PageSetup.PaperSize = PaperSizeType.PaperA0;workbook.ConverterSetting.GrayLevelForPrint = true;问题修复:
问题修复:
Spire.XLS for .NET 13.8.0已发布。本次更新新增支持设置DIN A0 的纸张大小以及支持了灰度打印。同时,该版本也优化了转换XLSX到HTML文档耗时长且内存占用高的性能。此外,同时,该版本还增强了 Excel 到 PDF 和图片的转换。许多已知问题也在该版本中被成功修复,如:修复了替换字体失败的问题。详情请阅读以下内容。
新功能:
sheet.PageSetup.PaperSize = PaperSizeType.PaperA0;workbook.ConverterSetting.GrayLevelForPrint = true;问题修复:
Spire.Doc 11.7.25 已发布。本次更新增强了 Word 到 PDF 以及 HTML 到 Word 的转换。此外,许多已知问题也在该版本中成功被修复,如更新目录页码不生效的问题。详情请阅读以下内容。
问题修复:
PowerPoint 演示文稿的背景可以设定演示文稿的基调和情绪,同时极大地提高幻灯片的美观度和感染力。PowerPoint 幻灯片有五种类型的背景可用,包括纯色背景、渐变背景、图片背景、纹理背景和图案背景。这些背景分别适用于不同的使用场景。例如,专业的商业演示文稿可能会受益于简洁明了的纯色背景,而创意演示文稿则可能会使用具有启发性和趣味性的图片背景来吸引观众的注意力。本文将展示如何使用 Spire.Presentation for Java 通过 Java 程序来设置 PowerPoint 演示文稿的背景。
首先,您需要在 Java 程序中添加 Spire.Presentation.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.presentation</artifactId>
<version>10.11.4</version>
</dependency>
</dependencies>
在自定义幻灯片背景之前,需要使用 SlideBackground.setType(BackgroundType.CUSTOM) 方法来允许自定义背景。然后,使用 SlideBackground.getFill().setFillType(FillFormatType.SOLID) 方法将背景类型设置为纯色背景,并使用 FileFormat.getSolidColor().setColor() 方法设置背景颜色。
详细操作步骤如下:
import com.spire.presentation.FileFormat;
import com.spire.presentation.ISlide;
import com.spire.presentation.Presentation;
import com.spire.presentation.SlideBackground;
import com.spire.presentation.drawing.BackgroundType;
import com.spire.presentation.drawing.FillFormat;
import com.spire.presentation.drawing.FillFormatType;
import java.awt.*;
public class SolidColor {
public static void main(String[] args) throws Exception {
//创建一个Presentation类的对象
Presentation ppt = new Presentation();
//载入PowerPoint演示文稿
ppt.loadFromFile("示例.pptx");
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//获取幻灯片背景
SlideBackground background = slide.getSlideBackground();
//将背景类型设置为自定义
background.setType(BackgroundType.CUSTOM);
//将背景填充类型设置为纯色
background.getFill().setFillType(FillFormatType.SOLID);
//设置背景颜色
FillFormat fillFormat = background.getFill();
fillFormat.getSolidColor().setColor(new Color(199, 213, 237));
//保存演示文稿
ppt.saveToFile("纯色背景.pptx", FileFormat.AUTO);
}
}
渐变背景可以通过将背景类型设置为渐变背景,然后设置渐变类型、停止点、颜色和角度来完成设置。具体步骤如下:
import com.spire.presentation.FileFormat;
import com.spire.presentation.ISlide;
import com.spire.presentation.Presentation;
import com.spire.presentation.SlideBackground;
import com.spire.presentation.drawing.*;
import java.awt.*;
public class Gradient {
public static void main(String[] args) throws Exception {
//创建一个Presentation类的对象
Presentation ppt = new Presentation();
//载入PowerPoint演示文稿
ppt.loadFromFile("C:/Users/Sirion/Desktop/示例.pptx");
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//获取幻灯片背景
SlideBackground background = slide.getSlideBackground();
//将背景类型设置为自定义
background.setType(BackgroundType.CUSTOM);
//将背景填充类型设置为渐变
background.getFill().setFillType(FillFormatType.GRADIENT);
//将渐变类型设置为线性渐变
GradientFillFormat gradient = background.getFill().getGradient();
gradient.setGradientShape(GradientShapeType.LINEAR);
//添加渐变停止点并设置颜色
gradient.getGradientStops().append(0f, new Color(230, 255, 255));
gradient.getGradientStops().append(0.5f, new Color(255, 255, 255));
gradient.getGradientStops().append(1f, new Color(199, 213, 237));
//设置渐变角度
gradient.getLinearGradientFill().setAngle(90);
//保存演示文稿
ppt.saveToFile("渐变背景.pptx", FileFormat.AUTO);
}
}
在给幻灯片设置图片背景时,需要将背景类型设置为图片,然后将图片填充类型设置为拉伸填充,最后再设置背景图片。具体步骤如下:
import com.spire.presentation.FileFormat;
import com.spire.presentation.ISlide;
import com.spire.presentation.Presentation;
import com.spire.presentation.SlideBackground;
import com.spire.presentation.drawing.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.io.File;
public class Picture {
public static void main(String[] args) throws Exception {
//创建一个Presentation类的对象
Presentation ppt = new Presentation();
//载入PowerPoint演示文稿
ppt.loadFromFile("示例.pptx");
//载入图片
IImageData image = ppt.getImages().append(ImageIO.read(new File("背景.jpg")));
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//获取幻灯片背景
SlideBackground background = slide.getSlideBackground();
//将背景类型设置为自定义
background.setType(BackgroundType.CUSTOM);
//将背景填充类型设置为图片
background.getFill().setFillType(FillFormatType.PICTURE);
//将图片填充方式设置为拉伸填充
PictureFillFormat pictureFillFormat = background.getFill().getPictureFill();
pictureFillFormat.setFillType(PictureFillType.STRETCH);
//设置图片背景透明度
pictureFillFormat.getPicture().setTransparency(50);
//设置背景图片
pictureFillFormat.getPicture().setEmbedImage(image);
//保存演示文稿
ppt.saveToFile("图片背景.pptx", FileFormat.AUTO);
}
}
设置纹理背景与设置图片背景的操作步骤类似。不同之处在于,图片填充类型需要更改为平铺填充,并可以对纹理对齐方式进行设置。具体步骤如下:
import com.spire.presentation.*;
import com.spire.presentation.drawing.*;
import javax.imageio.ImageIO;
import java.io.File;
public class Texture {
public static void main(String[] args) throws Exception {
//创建一个Presentation类的对象
Presentation ppt = new Presentation();
//载入PowerPoint演示文稿
ppt.loadFromFile("示例.pptx");
//载入纹理图片
IImageData image = ppt.getImages().append(ImageIO.read(new File("纹理.png")));
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//获取幻灯片背景
SlideBackground background = slide.getSlideBackground();
//将背景类型设置为自定义
background.setType(BackgroundType.CUSTOM);
//将背景填充类型设置为图片
background.getFill().setFillType(FillFormatType.PICTURE);
//将图片填充类型设置为平铺
PictureFillFormat pictureFillFormat = background.getFill().getPictureFill();
pictureFillFormat.setFillType(PictureFillType.TILE);
//设置纹理对齐方式
pictureFillFormat.setAlignment(RectangleAlignment.TOP_LEFT);
//设置纹理背景的透明度
pictureFillFormat.getPicture().setTransparency(50);
//设置背景纹理
pictureFillFormat.getPicture().setEmbedImage(image);
//保存演示文稿
ppt.saveToFile("纹理背景.pptx", FileFormat.AUTO);
}
}
在设置图案背景时,需要设置图案类型以及图案的前景颜色和背景颜色。详细操作步骤如下:
import com.spire.presentation.*;
import com.spire.presentation.drawing.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.io.File;
public class Pattern {
public static void main(String[] args) throws Exception {
//创建一个Presentation类的对象
Presentation ppt = new Presentation();
//载入PowerPoint演示文稿
ppt.loadFromFile("示例.pptx");
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//获取幻灯片背景
SlideBackground background = slide.getSlideBackground();
//将背景类型设置为自定义
background.setType(BackgroundType.CUSTOM);
//将背景填充类型设置为图案
background.getFill().setFillType(FillFormatType.PATTERN);
//设置图案类型
PatternFillFormat patternFillFormat = background.getFill().getPattern();
patternFillFormat.setPatternType(PatternFillType.DOTTED_GRID);
//设置图案的前景颜色
patternFillFormat.getForegroundColor().setColor(new Color(230, 255, 255));
//设置图案的背景颜色
patternFillFormat.getBackgroundColor().setColor(new Color(199, 213, 237));
//保存演示文稿
ppt.saveToFile("图案背景.pptx", FileFormat.AUTO);
}
}
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。
Spire.PDF 9.7.17已发布。该版本新增支持PDF文档文本比较功能。此外,该版本还修复了一系列已知问题,例如将PDF转换为OFD时消耗资源多的问题。详情请阅读以下内容。
新功能:
PdfDocument pdf1 = new PdfDocument(inputFile_1);
PdfDocument pdf2 = new PdfDocument(inputFile_2);
PdfComparer compare = new PdfComparer(pdf1, pdf2);
compare.Options.SetPageRanges(0, pdf1.Pages.Count - 1, 0, pdf2.Pages.Count - 1);
compare.Compare(outputFile);问题修复:
Spire.PDF for Java 9.7.8 已发布。本次更新新增了转换PDF到Word的新接口,新增了设置"裁剪框"的接口以及新增了打印文档时设置Margins的接口。还增强了 PDF 文档到Word、PDFA 以及OFD的转换。此外,该版本还修复了一些已知问题,如修复了程序在加载PDF时抛异常:java.lang.NullPointerException的问题。详情请阅读以下内容。
新功能:
PdfToWordConverter converter = new PdfToWordConverter(inputPath);
converter.saveToDocx(OutputPath);
converter.dispose();PdfDocument pdfDocument = new PdfDocument();
pdfDocument.loadFromFile("https://cdn.e-iceblue.cn/input.pdf");
PdfPageBase pdfPageBase = pdfDocument.getPages().get(0);
// setting the "crop box".
pdfPageBase.setCropBox(new Rectangle2D.Float(0,0,400,800));
pdfDocument.saveToFile("output.pdf", FileFormat.PDF);PdfDocument pdf = new PdfDocument();
pdf.loadFromFile(inputFile);
PrintSettings setting = pdf.getPrintSettings();
pdf.getPrintSettings().setPaperMargins(30,30, 30, 30);
setting.setPrinter("Microsoft XPS Document Writer");
pdf.getPrintSettings().printToFile(outputFile);
pdf.print();
pdf.close();问题修复:
Spire.Presentation for Java 8.7.3 已发布。本次更新新增支持选择多页幻灯片合并转换成一个 SVG 文件。该版本还增强了 PPT 到图片的转换功能。此外,一些已知问题也在该版本中被修复,如将图形保存到图片后内容被裁减的问题。详情请阅读以下内容。
新功能:
Presentation ppt = new Presentation();
ppt.loadFromFile("input.pptx");
//saveToOneSVG(int startSlide,int endSlide)
//startSlide:Start slide index endSlide:End slide index
byte[] bytes = ppt.saveToOneSVG(10,13);
FileOutputStream fos = new FileOutputStream(new File("result.svg"));
fos.write(bytes);
fos.flush();
fos.close();问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-JAVA.html
Spire.Cloud 8.7.3 已发布。在本次更新中,该版本支持了打开 WPS(wps, wpt, et, ett, dps, dpt)文档的新功能。此外,本次更新还修复了文档目录更新不正确的问题。详情请阅读以下内容。
新功能:
问题修复: