Spire.Doc for Java 10.7.4 已发布。此版本新增支持比较Word文件时设置比较级别。该版本还增强了 Word 文档到 PDF 和图片的转换。此外,还修复了一些已知问题,如何两个Word文件合并后内容不正确等问题。详情请阅读以下内容。
新功能:
Document doc1 = new Document();
doc1.loadFromFile("https://cdn.e-iceblue.cn/input1.docx");
Document doc2 = new Document();
doc2.loadFromFile("https://cdn.e-iceblue.cn/input2.docx");
//setting comparison level
CompareOptions options = new CompareOptions();
options.setLevel(ComparisonLevel.Character);
doc1.compare(doc2,"user");
doc1.saveToFile("result.docx", FileFormat.Docx_2013);问题修复:
Spire.Doc 10.7已发布。该版本在使用新引擎转换Word到PDF时,支持保留文本方向。同时该版本也做出了一些调整,例如放弃了public IStyle FindById(int styleId)和public IStyle FindByIstd(int istd)方法,公开了public IStyle FindByIdentifier(int sIdentifier)方法。除此之外,该版本还修复了一系列已知问题,例如在转换Word到PDF时,分页不正确的问题。详情请阅读以下内容。
新功能:
功能调整:
问题修复:
PowerPoint 幻灯片中可插入公式。插入的公式能够有效地为幻灯片内容提供论点的论证、推算的理论支撑。通过使用 Spire.Presentation for Java,可在 Java 后端程序中通过调用 IAutoShape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode() 方法来实现插入公式。本文将对此作详细介绍。
首先,您需要在 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>
下面是在幻灯片中插入公式的主要方法及步骤:
import com.spire.presentation.*;
import com.spire.presentation.drawing.FillFormatType;
import java.awt.geom.Rectangle2D;
public class AddFormula {
public static void main(String[] args) throws Exception{
//定义LaTeX公式代码
String latexCode1 = "x^{2} + \\sqrt{x^{2}+1}=2";
String latexCode2 = "F(x) &= \\int^a_b \frac{1}{3}x^3";
String latexCode3 = "\\alpha + \\beta \\geq \\gamma";
String latexCode4 = "\\overrightarrow{abc}";
String latexCode5 =" H_x=\\frac{1}{3}\\times{ \\left[ \\begin{array}{ccc}1 & 0 & -1\\\\1 & 0 & -1\\\\1 & 0 & -1\\end{array} \\right ]}";
String latexCode6 = "\\log_a{b}";
//创建Presentation类的实例
Presentation ppt = new Presentation();
//获取第一张幻灯片
ISlide slide = ppt.getSlides().get(0);
//添加形状到幻灯片
IAutoShape shape = slide.getShapes().appendShape(ShapeType.TRIANGLE, new Rectangle2D.Double(30, 100, 320, 50));
shape.getTextFrame().getParagraphs().clear();
//使用LaTeX代码添加数学公式到形状
shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexCode1);
//重复以上操作,添加形状,并添加公式到形状
shape = slide.getShapes().appendShape(ShapeType.TRIANGLE, new Rectangle2D.Double(280, 80, 380, 70));
shape.getTextFrame().getParagraphs().clear();
shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexCode2);
shape = slide.getShapes().appendShape(ShapeType.TRIANGLE, new Rectangle2D.Double(60, 190, 240, 40));
shape.getTextFrame().getParagraphs().clear();
shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexCode3);
shape = slide.getShapes().appendShape(ShapeType.TRIANGLE, new Rectangle2D.Double(350, 190, 200, 40));
shape.getTextFrame().getParagraphs().clear();
shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexCode4);
shape = slide.getShapes().appendShape(ShapeType.TRIANGLE, new Rectangle2D.Double(10, 240, 400, 100));
shape.getTextFrame().getParagraphs().clear();
shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexCode5);
shape = slide.getShapes().appendShape(ShapeType.TRIANGLE, new Rectangle2D.Double(350, 280, 200, 40));
shape.getTextFrame().getParagraphs().clear();
shape.getTextFrame().getParagraphs().addParagraphFromLatexMathCode(latexCode6);
//设置形状边框和填充类型
for (int i = 0; i < slide.getShapes().getCount(); i++)
{
slide.getShapes().get(i).getFill().setFillType(FillFormatType.NONE);
slide.getShapes().get(i).getLine().setFillType(FillFormatType.NONE);
}
//保存文档
ppt.saveToFile("MathEquations.pptx", FileFormat.PPTX_2013);
ppt.dispose();
}
}
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。
Spire.Office 7.7.2 已发布。该版本进行了一些功能更新,如:Spire.PDF 支持加载OFD文件流,并且在WPF程序集中添加了接口支持设置打印选项;Spire.Doc 支持用新引擎转换 Word 到 PDF 时,将 Word 的目录转换为 PDF 中对应的书签以及取消文档中的超链接;Spire.XLS 提供接口支持设置是否应用样式到行和列。此外,此版本还修复了许多已知问题。详情请阅读以下内容。
该版本涵盖了最新版的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
新功能:
if (annotation is PdfLineAnnotationWidget)
{
PdfLineAnnotationWidget lineAnn = annotation as PdfLineAnnotationWidget;
//PdfLineAnnotation lineAnn = annotation as PdfLineAnnotation;
lineAnn.Author = "Author_test";
lineAnn.Subject = "Subject_test";
}checkboxField.ForeColor = new PdfRGBColor(Color.Red);PdfStringFormat format = new PdfStringFormat();
PdfTrueTypeFont font = new PdfTrueTypeFont(new System.Drawing.Font("Times New Roman", 10));
PdfPen pen = PdfPens.Black;
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfDocument doc = new PdfDocument("HelloWord.pdf");
PdfLogicalStructure tree = PdfLogicalStructure.CreateLogicalStructure(doc);
PdfStructureElement article = tree.AppendChildElement(PdfStandardStructTypes.Article);
article.Title = "create tagged pdf";
PdfStructureElement paragraph1 = article.AppendChildElement(PdfStandardStructTypes.Paragraph);
paragraph1.Title = "text paragraph1";
int mcid = 0;
paragraph1.BeginMarkedContentSequence(doc.Pages[0].Canvas, "paragraph1", mcid);
doc.Pages[0].Canvas.DrawString("paragraph1: PDF’s logical structure facilities (PDF 1.3) provide a mechanism for " +
"incorporating structural information about a document’s content into a PDF file. Such information might include, " +
"for example, the organization of the document into chapters and sections or the identification of special elements " +
"such as figures, tables, and footnotes. The logical structure facilities are extensible, allowing applications that " +
"produce PDF files to choose what structural information to include and how to represent it, while enabling PDF " +
"consumers to navigate a file without knowing the producer’s structural conventions.",
font, pen, brush, new Rectangle(40, 200, 480, 80), format);
paragraph1.EndMarkedContentSequence(doc.Pages[0].Canvas);
paragraph1.ReferenceContent(doc.Pages[0], mcid);
PdfStructureElement paragraph2 = article.AppendChildElement(PdfStandardStructTypes.Paragraph);
paragraph2.Title = "text paragraph2";
mcid = 1;
paragraph2.BeginMarkedContentSequence(doc.Pages[0].Canvas, "paragraph2", mcid);
doc.Pages[0].Canvas.DrawString("paragraph2: PDF logical structure shares basic features with standard document markup languages" +
" such as HTML, SGML, and XML. A document’s logical structure is expressed as a hierarchy of structure elements, each" +
" represented by a dictionary object. Like their counterparts in other markup languages, PDF structure elements can" +
" have content and attributes. In PDF, rendered document content takes over the role occupied by text in HTML, SGML, and XML.",
font, pen, brush, new Rectangle(40, 280, 480, 60), format);
paragraph2.EndMarkedContentSequence(doc.Pages[0].Canvas);
paragraph2.ReferenceContent(doc.Pages[0], mcid);
doc.SaveToFile("Tagged.pdf");Stream stream = File.OpenRead(inputFile);
OfdConverter converter = new OfdConverter(stream);
MemoryStream ms = new MemoryStream();
converter.ToPdf(ms);PdfDocument.Print(PdfPrintSettings printSettings)问题修复:
新功能:
ToPdfParameterList toPdf = new ToPdfParameterList();
toPdf.CreateWordBookmarks = true;
toPdf.CreateWordBookmarksUsingHeadings = true;
document.setUseNewEngine(true);
document.saveToFile("output.pdf",toPdf);ToPdfParameterList toPdf = new ToPdfParameterList();
toPdf.DisableLink = true;
document.setUseNewEngine(true);
document.saveToFile("output.pdf",toPdf);问题修复:
新功能:
worksheet.ApplyStyle(style, applyRowStyle, applyColumnStyle)问题修复:
问题修复:
问题修复:
问题修复:
Spire.Presentation 7.7.1 已发布。该版本增强了PPT到PDF的转换功能,并修复了加载保存PPTX, 文档打开报内容有错等已知问题。详情请阅读以下内容。
问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html
Spire.PDF for Java 8.7.0 已发布。此版本增强了 PDF 到 Word、 Excel、 HTML 、图片、 GrayPdf 和 PDFA3A 以及 SVG 到 PDF 的转换功能。此外,还修复了一些已知问题,如查找文本时,找到的位置不正确。详情请阅读以下内容。
问题修复:
Spire.PDF 8.7.2已发布。该版本支持加载OFD文件流,并且在WPF程序集中添加了接口支持设置打印选项。同时增强了PDF到图片的转换功能。此外,还修复了转换到PdfX1A2001不符合规范等已知问题。详情请阅读以下内容。
新功能:
Stream stream = File.OpenRead(inputFile);
OfdConverter converter = new OfdConverter(stream);
MemoryStream ms = new MemoryStream();
converter.ToPdf(ms);PdfDocument.Print(PdfPrintSettings printSettings)问题修复:
Spire.Spreadsheet 6.6.1 已发布。本次更新修复了加载Excel文档时出现“NullReferenceException”错误的问题。详情请阅读以下内容。
问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Spreadsheet-NET.html
Spire.PDF for Java 提供了 PdfDocument.split() 方法可将一个 PDF 文档拆分为多个不同的 PDF 文档。本文,将通过 Java 后端程序来介绍如何使用 Spire.PDF for Java 将一个 PDF 页面拆分成多页,拆分页面时包括横向拆分、纵向拆分。下面是详细方法及步骤 。
首先,您需要在 Java 程序中添加 Spire.Pdf.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.pdf</artifactId>
<version>11.11.11</version>
</dependency>
</dependencies>
Spire.PDF for Java 提供了 PdfPageBase.createTemplate().draw() 方法在新的 PDF 页面上绘制源文档页面的内容。将一个页面拆分为多个页面实际上意味着源页面的内容将绘制在多个较小的页面上。以下是将第一页分割成两页的主要代码步骤:
import com.spire.pdf.*;
import com.spire.pdf.graphics.PdfLayoutBreakType;
import com.spire.pdf.graphics.PdfLayoutType;
import com.spire.pdf.graphics.PdfTextLayout;
import java.awt.*;
public class SplitHorizontally {
public static void main(String[] args) {
//加载PDF文档,并获取第一页
PdfDocument pdf = new PdfDocument();
pdf.loadFromFile("https://cdn.e-iceblue.cn/sample.pdf");
PdfPageBase page = pdf.getPages().get(0);
//创建新的PDF文档,移除新文档的页边距
PdfDocument newpdf = new PdfDocument();
newpdf.getPageSettings().getMargins().setAll(0);
//横向拆分:设置新文档页面的宽度为原文档第一页的宽度,页面高度等于原文档第一页高度的二分之一
newpdf.getPageSettings().setWidth((float) page.getSize().getWidth());
newpdf.getPageSettings().setHeight((float) page.getSize().getHeight()/2);
/*//纵向拆分:设置新文档页面的宽度为原文档第一页的二分之一,页面高度为原文档第一页高度
newpdf.getPageSettings().setWidth((float) page.getSize().getWidth()/2);
newpdf.getPageSettings().setHeight((float) page.getSize().getHeight());*/
//添加新页面到新的PDF文档
PdfPageBase newpage = newpdf.getPages().add();
//设置文本布局样式
PdfTextLayout format = new PdfTextLayout();
format.setBreak(PdfLayoutBreakType.Fit_Page);
format.setLayout(PdfLayoutType.Paginate);
//根据原文档第一页创建模板,并将模板画到新文档的新添加页面,页面画满之后自动分页
page.createTemplate().draw(newpage, new Point(0, 0), format);
//保存文档
newpdf.saveToFile("HorizontallySplitPage.pdf");
newpdf.close();
pdf.close();
}
}
如果您希望删除结果文档中的评估消息,或者摆脱功能限制,请该Email地址已收到反垃圾邮件插件保护。要显示它您需要在浏览器中启用JavaScript。获取有效期 30 天的临时许可证。
Spire.Presentation 7.6.1 已发布。该版本修复了获取形状的填充颜色不正确以及插入 HTML 到 PPT 时程序抛出“ArgumentOutOfRangeException”异常的问题。详情请阅读以下内容。
问题修复:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html