Spire.Office 6.10.3已发布。本次更新带来了一些新的功能,比如:Spire.PDF支持转换 PDF 到 Doc/Docx 时设置文档属性;Spire.XLS新增了实用图表,比如瀑布图、排列图和直方图等等;Spire.Presentation支持获取超链接的目标幻灯片。此外,该版本还修复了大量已知的问题。详情请阅读以下内容。
该版本涵盖了最新版的Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode。
版本信息如下:
- Spire.Doc.dll v9.10.9
- Spire.Pdf.dll v7.10.4
- Spire.XLS.dll v11.10.5
- Spire.Email.dll v4.7.0
- Spire.DocViewer.Forms.dll v6.8.0
- Spire.PdfViewer.Forms.dll v6.9.1
- Spire.PdfViewer.Asp.dll v6.9.1
- Spire.Presentation.dll v6.10.2
- Spire.Spreadsheet v5.10.0
- Spire.OfficeViewer.Forms.dll v6.10.3
- Spire.Barcode.dll v5.9.4
- Spire.DataExport.dll v4.1.9
- Spire.DataExport.ResourceMgr.dll v2.1.0
- Spire.License.dll v1.4.0
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
Spire.PDF
新功能:
- 支持了转换PDF到Doc/Docx时设置文档属性的功能
Spire.Pdf.Conversion.PdfToDocConverter doc = new Spire.Pdf.Conversion.PdfToDocConverter(inputFile);
doc.DocxOptions.Title = "PDFTODOCX";
doc.DocxOptions.Subject = "Set document properties.";
doc.DocxOptions.Tags = "Test Tags";
doc.DocxOptions.Categories = "PDF";
doc.DocxOptions.Commments = "This document just for testing the properties";
doc.DocxOptions.Authors = "TEST";
doc.DocxOptions.LastSavedBy = "/E-iceblue";
doc.DocxOptions.Revision = (int)7.9;
doc.DocxOptions.Version = "csharp V4.0";
doc.DocxOptions.ProgramName = "Spire.Pdf for .NET";
doc.DocxOptions.Company = "冰蓝科技";
doc.DocxOptions.Manager = "测试"
doc.SaveToDocx(outputFile);
PdfDocument pdf = new PdfDocument();
PdfPageBase page = pdf.Pages.Add();
PdfPolyLineAnnotation polyline = new PdfPolyLineAnnotation(page, new PointF[] { new PointF(0, 60),
new PointF(30, 45), new PointF(60, 90), new PointF(90, 80) });
polyline.Color = Color.PaleVioletRed;
polyline.Text = "This is a polygon annotation";
polyline.Author = "E-ICEBLUE";
polyline.Subject = "polygon annotation demo";
polyline.Name = "Summer";
polyline.Border = new PdfAnnotationBorder(1f);
polyline.ModifiedDate = DateTime.Now;
page.AnnotationsWidget.Add(polyline);
pdf.SaveToFile(output);
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile(inputPath);
StringBuilder builder = new StringBuilder();
//抽取表格
PdfTableExtractor extractor = new PdfTableExtractor(pdf);
PdfTable[] tableLists = null;
for (int pageIndex = 0; pageIndex < pdf.Pages.Count; pageIndex++)
{
tableLists = extractor.ExtractTable(pageIndex);
if (tableLists != null && tableLists.Length > 0)
{
foreach (PdfTable table in tableLists)
{
int row = table.GetRowCount();
int column = table.GetColumnCount();
for (int i = 0; i < row; i++)
{
for (int j = 0; j < column; j++)
{
string text = table.GetText(i, j);
builder.Append(text + " ");
}
builder.Append("\r\n");
}
}
}
}
File.WriteAllText(outputFile, builder.ToString());
问题修复:
- 修复了查找指定文本失败的问题
- 修复了将SVG文件添加到PDF中,内容显示不正确的问题(.NET Core3.0平台)
- 修复了打印PDF程序报错“参数无效”的问题
- 修复了转PDF到SVG内容不正确的问题
- 修复了添加图层并删除图层后结果文档大小增大的问题
- 修复了打印PDF内容不正确的问题
- 修复了转换PDF到Excel区域文化为葡萄牙语时部分列被隐藏的问题
- 修复了填充域时程序抛NullReferenceException异常的问题
Spire.XLS
新功能:
- 支持瀑布图、排列图、直方图、箱型图、树状图、旭日图以及漏斗图
Workbook workbook = new Workbook();
workbook.LoadFromFile("waterfall_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set chart type as waterfall
officeChart.ChartType = ExcelChartType.WaterFall;
//Set data range to the chart from the worksheet
officeChart.DataRange = sheet["A2:B8"];
//Data point settings as total in chart
officeChart.Series[0].DataPoints[3].SetAsTotal = true;
officeChart.Series[0].DataPoints[6].SetAsTotal = true;
//Showing the connector lines between data points
officeChart.Series[0].Format.ShowConnectorLines = true;
//Set the chart title
officeChart.ChartTitle = "Company Profit (in USD)";
//Formatting data label and legend option
officeChart.Series[0].DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
officeChart.Series[0].DataPoints.DefaultDataPoint.DataLabels.Size = 8;
officeChart.Legend.Position = LegendPositionType.Right;
workbook.SaveToFile("waterfall_chart.xlsx");
Workbook workbook = new Workbook();
workbook.LoadFromFile("Pareto_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set chart type as Pareto
officeChart.ChartType = ExcelChartType.Pareto;
//Set data range in the worksheet
officeChart.DataRange = sheet["A2:B8"];
//Set category values as bin values
officeChart.PrimaryCategoryAxis.IsBinningByCategory = true;
officeChart.PrimaryCategoryAxis.OverflowBinValue = 5;
officeChart.PrimaryCategoryAxis.UnderflowBinValue = 1;
//Formatting Pareto line
officeChart.Series[0].ParetoLineFormat.LineProperties.Color = System.Drawing.Color.Blue;
//Gap width settings
officeChart.Series[0].DataFormat.Options.GapWidth = 6;
//Set the chart title
officeChart.ChartTitle = "Expenses";
//Hiding the legend
officeChart.HasLegend = false;
workbook.SaveToFile("Pareto_chart.xlsx");
Workbook workbook = new Workbook();
workbook.LoadFromFile("Histogram_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set chart type as histogram
officeChart.ChartType = ExcelChartType.Histogram;
//Set data range in the worksheet
officeChart.DataRange = sheet["A1:A15"];
//Category axis bin settings
officeChart.PrimaryCategoryAxis.BinWidth = 8;
//Gap width settings
officeChart.Series[0].DataFormat.Options.GapWidth = 6;
//Set the chart title and axis title
officeChart.ChartTitle = "Height Data";
officeChart.PrimaryValueAxis.Title = "Number of students";
officeChart.PrimaryCategoryAxis.Title = "Height";
//Hiding the legend
officeChart.HasLegend = false;
workbook.SaveToFile("Histogram_chart.xlsx");
Workbook workbook = new Workbook();
workbook.LoadFromFile("Boxandwhisker_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set the chart title
officeChart.ChartTitle = "Yearly Vehicle Sales";
//Set chart type as Box and Whisker
officeChart.ChartType = ExcelChartType.BoxAndWhisker;
//Set data range in the worksheet
officeChart.DataRange = sheet["A1:E17"];
//Box and Whisker settings on first series
var seriesA = officeChart.Series[0];
seriesA.DataFormat.ShowInnerPoints = false;
seriesA.DataFormat.ShowOutlierPoints = true;
seriesA.DataFormat.ShowMeanMarkers = true;
seriesA.DataFormat.ShowMeanLine = false;
seriesA.DataFormat.QuartileCalculationType = ExcelQuartileCalculation.ExclusiveMedian;
//Box and Whisker settings on second series
var seriesB = officeChart.Series[1];
seriesB.DataFormat.ShowInnerPoints = false;
seriesB.DataFormat.ShowOutlierPoints = true;
seriesB.DataFormat.ShowMeanMarkers = true;
seriesB.DataFormat.ShowMeanLine = false;
seriesB.DataFormat.QuartileCalculationType = ExcelQuartileCalculation.InclusiveMedian;
//Box and Whisker settings on third series
var seriesC = officeChart.Series[2];
seriesC.DataFormat.ShowInnerPoints = false;
seriesC.DataFormat.ShowOutlierPoints = true;
seriesC.DataFormat.ShowMeanMarkers = true;
seriesC.DataFormat.ShowMeanLine = false;
seriesC.DataFormat.QuartileCalculationType = ExcelQuartileCalculation.ExclusiveMedian;
workbook.SaveToFile("Boxandwhisker_chart.xlsx");
Workbook workbook = new Workbook();
workbook.LoadFromFile("treemap_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set chart type as TreeMap
officeChart.ChartType = ExcelChartType.TreeMap;
//Set data range in the worksheet
officeChart.DataRange = sheet["A2:C11"];
//Set the chart title
officeChart.ChartTitle = "Area by countries";
//Set the Treemap label option
officeChart.Series[0].DataFormat.TreeMapLabelOption = ExcelTreeMapLabelOption.Banner;
//Formatting data labels
officeChart.Series[0].DataPoints.DefaultDataPoint.DataLabels.Size = 8;
workbook.SaveToFile("treemap_chart.xlsx");
Workbook workbook = new Workbook();
workbook.LoadFromFile("Sunburst_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set chart type as Sunburst
officeChart.ChartType = ExcelChartType.SunBurst;
//Set data range in the worksheet
officeChart.DataRange = sheet["A1:D16"];
//Set the chart title
officeChart.ChartTitle = "Sales by annual";
//Formatting data labels
officeChart.Series[0].DataPoints.DefaultDataPoint.DataLabels.Size = 8;
//Hiding the legend
officeChart.HasLegend = false;
workbook.SaveToFile("Sunburst_chart.xlsx");
Workbook workbook = new Workbook();
workbook.LoadFromFile("Funnel_sample.xlsx");
var sheet = workbook.Worksheets[0];
var officeChart = sheet.Charts.Add();
//Set chart type as Funnel
officeChart.ChartType = ExcelChartType.Funnel;
//Set data range in the worksheet
officeChart.DataRange = sheet.Range["A1:B6"];
//Set the chart title
officeChart.ChartTitle = "Funnel";
//Formatting the legend and data label option
officeChart.HasLegend = false;
officeChart.Series[0].DataPoints.DefaultDataPoint.DataLabels.HasValue = true;
officeChart.Series[0].DataPoints.DefaultDataPoint.DataLabels.Size = 8;
workbook.SaveToFile("Funnel_chart.xlsx");
问题修复:
- 修复了转换Excel到PDF内容不正确的问题
- 修复了加载Excel文档程序抛出“Invalid LegendPositionType string val”问题
- 修复了读取混合图表类型不正确的问题
- 修复了复制工作表时程序抛System.ArgumentOutOfRangeException问题
- 修复了转换Excel到PDF表头线条丢失的问题
- 修复了加载文档时程序挂起的问题
- 修复了设置图表的误差线的端点不起作用的问题
- 修复了加载HTML抛异常“Cannot read that as a ZipFile“的问题
- 修复了保存xlsm文档抛出异常“You cannot Write() data for an entry that is a directory”
- 修复了加载文档抛出异常'Invalid MsoLineDashStyle string val'的问题
- 修复了转换Excel到PDF时字符丢失的问题
- 修复了转换Excel到PDF时抛出异常“Object reference is not set to an instance of an object.”的问题
- 修复了添加新的数据后获取到的最大行数和列数不正确的问题
- 修复了加载ods文档时程序挂起的问题
- 修复了设置单元格透明背景色不生效的问题
Spire.Doc
问题修复:
- 修复了使用正则表达式查找文本,结果不全的问题
- 修复了加载HTML抛异常“ArgumentOutOfRangeException”的问题
- 修复了转换Word到PDF,存在额外的空白页的问题
- 修复了转换Word到PDF,换行不正确的问题
- 修复了转换Word到PDF,图片位置改变的问题
- 修复了转换Word到PDF文本重叠的问题
- 修复了比较Word文档抛异常“Collection was modified; enumeration operation may not execute”的问题
- 修复了转换Word到PDF抛异常“Object reference not set to an instance of an object”的问题
- 修复了获取MergeGroupNames时抛异常“Object reference not set to an instance of an object”的问题
- 修复了转换Word到PDF,泰文字符乱码的问题
- 修复了加载Word文档抛异常“Zip exception”的问题
Spire.Presentation
新功能:
- 支持获取超链接的目标幻灯片
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
IAutoShape shape = ppt.Slides[1].Shapes[0] as IAutoShape;
if (shape.Click.ActionType == HyperlinkActionType.GotoSlide)
{
ISlide targetSlide = shape.Click.TargetSlide;
Console.WriteLine("index = " + targetSlide.SlideNumber);
}
问题修复:
- 修复了加载保存后Ole对象无法打开的问题。
- 修复了转换Shape到图片后内容被裁剪的问题。
- 修复了获取文字颜色错误的问题。
- 修复了获取表格内容的字体大小错误的问题。
- 修复了获取图表系列的填充颜色不正确的问题。
- 修复了获取幻灯片切换动作的持续时间不正确的问题。
- 修复了转换PPT公式到图片,部分内容缺失的问题。
Spire. Spreadsheet
问题修复:
- 修复了文本内容被剪切的问题