我们很高兴宣布发布Spire.Office 10.10.0。在此版本中,Spire.Doc支持从Word文件中提取页面到单独文件;Spire.XLS支持读取Office缓存云字体;Spire.Presentation支持设置音频淡入淡出时长;Spire.PDF支持验证时间戳服务URL。同时,本次更新修复了一系列已知问题。更多细节如下。
该版本涵盖了最新版的 Spire.Doc、Spire.PDF、Spire.XLS、Spire.Presentation、Spire.Barcode、Spire.Email、Spire.DocViewer、Spire.PDFViewer、Spire.OfficeViewer 和 Spire.DataExport。
版本信息如下:
- Spire.Doc.dll v13.10.3
- Spire.Pdf.dll v11.10.4
- Spire.XLS.dll v15.10.3
- Spire.Presentation.dll v10.10.7
- Spire.Barcode.dll v7.4.1
- Spire.Email.dll v6.6.3
- Spire.DocViewer.Forms.dll v8.9.4
- Spire.PdfViewer.Asp.dll v8.2.6
- Spire.PdfViewer.Forms.dll v8.2.6
- Spire.Spreadsheet.dll v7.5.2
- Spire.OfficeViewer.Forms.dll v8.8.0
- Spire.DataExport.dll 4.9.0
- Spire.DataExport.ResourceMgr.dll v2.1.0
获取Spire.Office 10.10.0,请点击:
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
Spire.Doc
新功能:
- 新增ExtractPages(int index,int count)方法支持从文档中提取指定范围的页面,注:按最终布局提取页面,内容与导出PDF的页面一致。
Document doc = new Document();
doc.LoadFromFile("sample.docx");
Document extractPage = doc.ExtractPages(0, 1);
extractPage.SaveToFile("result.docx");
问题修复:
- 修复了转换Word到PDF,内容排版不正确的问题。
- 修复了转换Word到PDF,表格样式不正确的问题。
- 修复了转换Word到PDF,字体不正确的问题。
- 修复了加载Markdown流文件,程序抛出“System.NotSupportedException”异常的问题。
- 修复了转换Word到PDF,文本位置偏移的问题。
- 修复了获取页数,程序抛出“System.ArgumentException:“Parent cannot be null.”异常的问题。
- 修复了保存Word文档,表格内的限制编辑区域不正确的问题。
Spire.XLS
新功能:
- 新增默认支持读取 Office 缓存的云字体。
问题修复:
- 修复了将 Excel 转换为 PDF 时生成多余空白页的问题。
- 修复了加载 XLSB 文件时程序抛出 “ArgumentOutOfRangeException” 异常的问题。
- 修复了添加 HTML 字符串时程序抛出 “FormatException” 异常的问题。
- 修复了包含 FILTER 公式的文件在 Microsoft Excel 中打开时报错的问题。
Spire.Presentation
新功能:
- 支持设置音频的淡入或淡出持续时间。
- 支持裁剪音频。
- 支持给表格设置透明度。
// New Append Audio
Presentation pres = new Presentation();
FileStream from_stream = File.OpenRead(inputFile);
RectangleF audioRect = new RectangleF(50, 50, 100, 100);
IAudio audio = pres.Slides[0].Shapes.AppendAudioMedia(from_stream, audioRect);
// Set the duration of the starting fade for 13s
audio.FadeInDuration = 13000f;
// Set the duration of the ending fade for 40s
audio.FadeOutDuration = 10000f;
pres.SaveToFile(outputFile, FileFormat.Pptx2013);
// Retrieve existing documents
FileStream from_stream = File.OpenRead(inputFile);
Presentation presentation = new Presentation();
presentation.LoadFromStream(from_stream, FileFormat.Auto);
foreach (IShape shape in presentation.Slides[0].Shapes)
{
if (shape is IAudio)
{
IAudio audio = shape as IAudio;
// Set the duration of the starting fade for 13s
audio.FadeInDuration = 13000f;
// Set the duration of the ending fade for 20s
audio.FadeOutDuration = 20000f;
}
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
// New Append Audio
Presentation pres = new Presentation();
FileStream from_stream = File.OpenRead(inputFile);
RectangleF audioRect = new RectangleF(50, 50, 100, 100);
IAudio audio = pres.Slides[0].Shapes.AppendAudioMedia(from_stream, audioRect);
// Set the start trimming time 8 seconds
audio.TrimFromStart = 8000f;
// Set the end trimming time 13 seconds
audio.TrimFromEnd = 13000f;
pres.SaveToFile(outputFile, FileFormat.Pptx2013);
// Retrieve existing documents
FileStream from_stream = File.OpenRead(inputFile);
Presentation presentation = new Presentation();
presentation.LoadFromStream(from_stream, FileFormat.Auto);
foreach (IShape shape in presentation.Slides[0].Shapes)
{
if (shape is IAudio)
{
IAudio audio = shape as IAudio;
// Set the start trimming time 8 seconds
audio.TrimFromStart = 8000f;
// Set the end trimming time 13 seconds
audio.TrimFromEnd = 13000f;
}
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
/table.Fill.Transparency = 0.5f; // Value range is 1-0, table default color is black
// Need to set specific table color, set color code as follows:
table[0, 0].FillFormat.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
table[0, 0].FillFormat.SolidColor.Color = Color.Orange;
调整:
- 调整 AddDigitalSignature 方法的使用。
Presentation ppt = new Presentation();
ppt.LoadFromFile("in.pptx");
//Add a digital signature,The parameters: string certificatePath, string certificatePassword, string comments, DateTime signTime
ppt.AddDigitalSignature("test.pfx", "e-iceblue", "111", DateTime.Now);
ppt.SaveToFile("result.pptx", Spire.Presentation.FileFormat.Pptx2016);
ppt.Dispose();
问题修复:
- 修复了 PPT 转 PDF 时,内容不正确的问题。
- 优化了使用模板创建 PPT 的保存时间。
Spire.PDF
新功能:
- 支持验证时间戳服务 URL 地址的有效性。
TSAHttpService timestampService = new TSAHttpService("http://time2.certum.pl");
TSAResponse response = timestampService.Check();
//if it is success to receive tsa token
if (response.Success){
formatter.TimestampService = timestampService; }
问题修复:
- 优化了 PDF 转 Word 的效果。
- 修复了 PDF 转图片后,部分内容丢失的问题。
- 修复了 XPS 转PDF, 内容丢失的问题。
- 修复了高亮垂直文本效果不正确的问题。
- 修复了合并 PDF 文档时,程序抛异常的问题。
- 优化了替换内容字体效果问题。
- 修复了添加时间戳报错的问题。
- 修复了 PDF 转 Tiff,效果不一致的问题。
- 修复了加载 PDF 文档,程序抛“NullReferenceException”的问题。
- 修复了使用 CreateTemplate() 方法对比 PDF 时,程序抛“IndexOutOfRangeException”的问题。
Spire.PDFViewer
新功能:
- 新增“查找上一个”和“查找下一个”功能。同时 pdfDocumentViewer1.SearchText() 方法已弃用,使用 pdfDocumentViewer1.Find() 替代。
private void Form1_Load(object sender, EventArgs e)
{
string pdfDoc = @"test.pdf";
if (File.Exists(pdfDoc))
{
this.pdfDocumentViewer1.LoadFromFile(pdfDoc);
this.pdfDocumentViewer1.Find("FindedText", Color.Empty);
}
}
private void before_Click(object sender, EventArgs e)
{
this.pdfDocumentViewer1.FindPrevious();
}
private void next_Click(object sender, EventArgs e)
{
this.pdfDocumentViewer1.FindNext();
}







