Spire.Office 8.7.0 已发布。在本次更新中,Spire.Doc 支持了锁定文本框和图片的纵横比;Spire.XLS 支持了 NETWORKDAYS.INTL 函数;Spire.Presentation 支持了 PPTX 2016 和 PPTX 2019 文件格式;Spire.PDF 支持了创建含结构化表的标签 PDF 文件。此外,本次更新还成功修复了大量已知问题。详情请阅读以下内容。
该版本涵盖了最新版的 Spire.Doc,Spire.PDF,Spire.XLS,Spire.Email,Spire.DocViewer, Spire.PDFViewer,Spire.Presentation,Spire.Spreadsheet, Spire.OfficeViewer, Spire.DocViewer, Spire.Barcode, Spire.DataExport。
版本信息如下:
- Spire.Doc.dll v11.7.0
- Spire.Pdf.dll v9.7.0
- Spire.XLS.dll v13.7.0
- Spire.Presentation.dll v8.7.0
- Spire.Email.dll v6.6.0
- Spire.DocViewer.Forms.dll v8.7.0
- Spire.PdfViewer.Forms.dll v7.11.0
- Spire.PdfViewer.Asp.dll v7.11.0
- Spire.Spreadsheet.dll v7.4.2
- Spire.OfficeViewer.Forms.dll v8.7.0
- Spire.Barcode.dll v7.2.1
- Spire.DataExport.dll v4.9.0
- Spire.DataExport.ResourceMgr.dll v2.1.0
获取Spire.Office 8.7.0请点击:
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
Spire.Doc
新功能:
- 支持首行缩进设置字符个数的功能。
paragraph.ParagraphFormat.FirstLineIndentChars = value;
注意:
value为正数:设置的是首行缩进
value为负数:设置的是悬挂缩进
value为0时,用paragraph.Format.SetFirstLineIndentChars(0);方法设置
- 支持设置文本框的锁定纵横比的功能。
textBox.AspectRatioLocked = true;//添加文本框时默认不锁定纵横比
- 支持设置图片的锁定纵横比的功能。
picture.AspectRatioLocked = true;//添加图片时默认锁定纵横比
- 在OfficeMath中添加了静态方法FromEqField()用于将EQField转换为OfficeMath。
问题修复:
- 修复了设置自动锁定纵横比的图片的宽度时,高不会被相应的调整的问题。
- 修复了转换Word到PDF时程序抛出"未将对象引用设置到对象的实例"异常的问题。
- 修复了转换Word到PDF时程序抛出System.ArgumentOutOfRangeException异常的问题。
- 修复了邮件合并域的值没有更新正确的问题。
- 修复了比较文档时程序抛出"System.NullReferenceException"异常的问题。
- 修复了获取出的段前段后的值不正确的问题。
- 修复了将一个Dotm文档和一个Docx文档比较时程序抛出System.InvalidOperationException异常的问题。
- 修复了获取出的文本域的包含回车符号的值不正确的问题。
- 修复了文档比较时程序抛出 System.ArgumentException 异常的问题。
- 修复了转换 Word 到 HTML 程序抛出 System.ArgumentException 异常的问题。
- 修复了更新邮件合并域失败的问题。
- 修复了替换以数字结尾的文本时 wholeWord 参数设为 true 不生效的问题。
- 修复了转换 Word 到 PDF 部分文字对齐方式不一致的问题。
- 修复了转换 Word 到 PDF 象征符号位置上移的问题。
Spire.XLS
新功能:
- 支持NETWORKDAYS.INTL函数。
问题修复:
- 修复了添加的数值以日期格式呈现出来的问题。
- 修复了将图表转换为图片后内容不正确的问题。
- 修复了分页处单元格的上边框未被打印的问题 。
- 修复了删除形状时程序抛出 ArgumentOutOfRangeException异常的问题。
- 修复了修改透视表的某一行的字体颜色不生效的问题。
- 修复了修改透视表字体不生效的问题。
- 修复了将Excel转换为HTML后虚线丢失的问题。
- 修复了执行CalculateAllValue()方法时程序抛出System.NullReferenceException异常的问题。
- 修复了给合并单元格添加过滤器后过滤器按钮失效的问题。
- 修复了删除行之后剩余行数不正确的问题。
- 修复了使用worksheet.ExportDataTable()方法导出的数据格式不正确的问题。
Spire.Presentation
新功能:
- 支持PPTX 2016和PPTX 2019文件格式。
Spire.Presentation.FileFormat.Pptx2016
Spire.Presentation.FileFormat.Pptx2019
- 支持设置图表的横坐标距轴线的距离。
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.ColumnClustered, new RectangleF(50, 50, 400, 400));
//获取PrimaryCategory轴
IChartAxis chartAxis = chart.PrimaryCategoryAxis;
//设置距轴线的距离
chartAxis.LabelsDistance = 200;
//保存文件
ppt.SaveToFile(outputFile, FileFormat.Pptx2013);
问题修复:
- 修复了拆分PPT文档后, 生成的文档无法打开的问题。
- 修复了加载PPT文件时程序报错空指针的问题。
- 修复了判断条形图是否切换列时程序报错的问题。
Spire.PDF
新功能:
- 添加了放大率对适合高度的支持。
PdfDocument myPdf = new PdfDocument("test.pdf");
PdfPageBase page = myPdf .Pages[0];
PdfDestination dest = new PdfDestination(page, new PointF(-40f, -40f));
dest.Mode = PdfDestinationMode.FitV;
PdfGoToAction gotoaction = new PdfGoToAction(dest);
myPdf.AfterOpenAction = gotoaction;
myPdf.ViewerPreferences.PageMode = PdfPageMode.UseOutlines;
myPdf.SaveToFile("FitBH.pdf");
myPdf.Close();
- 支持创建含结构化表的标签PDF文件。
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins(20));
page.SetTabOrder(TabOrder.Structure);
PdfTaggedContent taggedContent = new PdfTaggedContent(doc);
taggedContent.SetLanguage("en-US");
taggedContent.SetTitle("test");
taggedContent.SetPdfUA1Identification();
PdfTrueTypeFont font = new PdfTrueTypeFont(new System.Drawing.Font("Times New Roman", 14), true);
PdfSolidBrush brush = new PdfSolidBrush(Color.Black);
PdfStructureElement document = taggedContent.StructureTreeRoot.AppendChildElement(PdfStandardStructTypes.Document);
PdfStructureElement heading1 = document.AppendChildElement(PdfStandardStructTypes.HeadingLevel1);
heading1.BeginMarkedContent(page);
string headingText = "What is a Tagged PDF?";
page.Canvas.DrawString(headingText, font, brush, new PointF(0, 0));
heading1.EndMarkedContent(page);
PdfStructureElement paragraph = document.AppendChildElement(PdfStandardStructTypes.Paragraph);
paragraph.BeginMarkedContent(page);
string paragraphText = ""Tagged PDF" doesn’t seem like a life-changing term. But for some, it is. For people who are " +
"blind or have low vision and use assistive technology (such as screen readers and connected Braille displays) to " +
"access information, an untagged PDF means they are missing out on information contained in the document because assistive " +
"technology cannot "read" untagged PDFs. Digital accessibility has opened up so many avenues to information that were once " +
"closed to people with visual disabilities, but PDFs often get left out of the equation.";
RectangleF rect = new RectangleF(0, 30, page.Canvas.ClientSize.Width, page.Canvas.ClientSize.Height);
page.Canvas.DrawString(paragraphText, font, brush, rect);
paragraph.EndMarkedContent(page);
PdfStructureElement figure = document.AppendChildElement(PdfStandardStructTypes.Figure);
figure.BeginMarkedContent(page);
PdfImage image = PdfImage.FromFile(TestUtil.DataPath + "ImgFiles/Bug_3938.png");
page.Canvas.DrawImage(image, new PointF(0, 150));
figure.EndMarkedContent(page);
PdfStructureElement table = document.AppendChildElement(PdfStandardStructTypes.Table);
PdfTable pdfTable = new PdfTable();
pdfTable.Style.DefaultStyle.Font = font;
System.Data.DataTable dataTable = new System.Data.DataTable();
dataTable.Columns.Add("Name");
dataTable.Columns.Add("Age");
dataTable.Columns.Add("Sex");
dataTable.Rows.Add(new string[] { "John", "22", "Male" });
dataTable.Rows.Add(new string[] { "Katty", "25", "Female" });
pdfTable.DataSource = dataTable;
pdfTable.Style.ShowHeader = true;
pdfTable.StructureElement = table;
pdfTable.Draw(page.Canvas, new PointF(0, 280), 300f);
doc.SaveToFile("1.pdf");
doc.Dispose();
问题修复:
- 修复了转换PDF到PDFA3A时程序抛出System.NullReferenceException异常的问题。
- 修复了转换PDF到PDFA1B内容不正确的问题。
- 修复了转换PDF到图片和打印PDF时字体改变的问题。
- 修复了提取页面文本时程序抛出System.NullReferenceException异常的问题。
- 修复了打印PDF时印章旋转变形的问题。
Spire.PDFViewer
问题修复:
- 修复了滚动页面时,文档内容无法流畅加载的问题。
- 修复了文档内容显示不完整的问题。