Spire.Office 7.1已发布。本次更新带来了一些新的功能,例如:Spire.Presentation支持创建“箱形图”图表,“漏斗图”图表,“直方图”图表,“排列图”图表,“旭日图”图表,“树状图”图表以及“瀑布图”图表;Spire.XLS支持为单元格设置Html字符串、为现有数据透视表添加条件格式,还支持向IsPasswordProtected()添加文件流、获取 IPrstGeomShape 的链接单元名称,并且还支持计算单个工作表或单元格范围;Spire.Doc增强了Word到PDF以及HTML到Word的转换功能。此外,该版本还修复了大量已知的问题。详情请阅读以下内容。
该版本涵盖了最新版的 Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode。
版本信息如下:
- Spire.License.dll 1.4.0
- Spire.Barcode.dll 6.1.1
- Spire.Email.dll 5.1.0
- Spire.DataExport.dll 4.1.9
- Spire.Pdf.dll 8.1.6
- Spire.PdfViewer.Forms.dll 7.1.4
- Spire.Doc.dll 10.1.11
- Spire.DocViewer.Forms.dll 7.1.1
- Spire.Presentation.dll 7.1.4
- Spire.Spreadsheet.dll 6.1.3
- Spire.XLS.dll 12.1.7
- Spire.OfficeViewer.Forms.dll 7.1.4
https://www.e-iceblue.cn/Downloads/Spire-Office-NET.html
Spire.Presentation
新功能:
- 支持创建“箱形图”图表
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.BoxAndWhisker, new RectangleF(50, 50, 500, 400), false);
string[] seriesLabel = { "Series 1", "Series 2", "Series 3" };
for (int i = 0; i < seriesLabel.Length; i++)
{
chart.ChartData[0, i + 1].Text = "Series 1";
}
string[] categories = {"Category 1", "Category 1", "Category 1", "Category 1", "Category 1", "Category 1", "Category 1",
"Category 2", "Category 2", "Category 2", "Category 2", "Category 2", "Category 2",
"Category 3", "Category 3", "Category 3", "Category 3", "Category 3"};
for (int i = 0; i < categories.Length; i++)
{
chart.ChartData[i + 1, 0].Text = categories[i];
}
double[,] values = new double[18, 3]{{-7,-3,-24},{-10,1,11},{-28,-6,34},{47,2,-21},{35,17,22},{-22,15,19},{17,-11,25},
{-30,18,25},{49,22,56},{37,22,15},{-55,25,31},{14,18,22},{18,-22,36},{-45,25,-17},
{-33,18,22},{18,2,-23},{-33,-22,10},{10,19,22}};
for (int i = 0; i < seriesLabel.Length; i++)
{
for (int j = 0; j < categories.Length; j++)
{
chart.ChartData[j + 1, i + 1].NumberValue = values[j, i];
}
}
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, seriesLabel.Length];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0];
chart.Series[0].Values = chart.ChartData[1, 1, categories.Length, 1];
chart.Series[1].Values = chart.ChartData[1, 2, categories.Length, 2];
chart.Series[2].Values = chart.ChartData[1, 3, categories.Length, 3];
chart.Series[0].ShowInnerPoints = false;
chart.Series[0].ShowOutlierPoints = true;
chart.Series[0].ShowMeanMarkers = true;
chart.Series[0].ShowMeanLine = true;
chart.Series[0].QuartileCalculationType = QuartileCalculation.ExclusiveMedian;
chart.Series[1].ShowInnerPoints = false;
chart.Series[1].ShowOutlierPoints = true;
chart.Series[1].ShowMeanMarkers = true;
chart.Series[1].ShowMeanLine = true;
chart.Series[1].QuartileCalculationType = QuartileCalculation.InclusiveMedian;
chart.Series[2].ShowInnerPoints = false;
chart.Series[2].ShowOutlierPoints = true;
chart.Series[2].ShowMeanMarkers = true;
chart.Series[2].ShowMeanLine = true;
chart.Series[2].QuartileCalculationType = QuartileCalculation.ExclusiveMedian;
chart.HasLegend = true;
chart.ChartTitle.TextProperties.Text = "BoxAndWhisker";
chart.ChartLegend.Position = ChartLegendPositionType.Top;
ppt.SaveToFile(outputFile, FileFormat.Pptx2013);
ppt.Dispose();
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.Funnel, new RectangleF(50, 50, 550, 400), false);
chart.ChartData[0, 1].Text = "Series 1";
string[] categories = { "Website Visits ", "Download", "Uploads", "Requested price", "Invoice sent", "Finalized" };
for (int i = 0; i < categories.Length; i++)
{
chart.ChartData[i + 1, 0].Text = categories[i];
}
double[] values = { 50000, 47000, 30000, 15000, 9000, 5600 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 1].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, 1];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0];
chart.Series[0].Values = chart.ChartData[1, 1, values.Length, 1];
chart.ChartTitle.TextProperties.Text = "Funnel";
ppt.SaveToFile(outputFile, FileFormat.PPT);
ppt.Dispose();
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.Histogram, new RectangleF(50, 50, 500, 400), false);
chart.ChartData[0, 0].Text = "Series 1";
double[] values = { 1, 1, 1, 3, 3, 3, 3, 5, 5, 5, 8, 8, 8, 9, 9, 9, 12, 12, 13, 13, 17, 17, 17, 19, 19, 19, 25, 25, 25, 25, 25, 25, 25, 25, 29, 29, 29, 29, 32, 32, 33, 33, 35, 35, 41, 41, 44, 45, 49, 49 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 1].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, 0];
chart.Series[0].Values = chart.ChartData[1, 0, values.Length, 0];
chart.PrimaryCategoryAxis.NumberOfBins = 7;
chart.PrimaryCategoryAxis.GapWidth = 20;
chart.ChartTitle.TextProperties.Text = "Histogram";
chart.ChartLegend.Position = ChartLegendPositionType.Bottom;
ppt.SaveToFile(outputFile, FileFormat.PPT);
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.Pareto, new RectangleF(50, 50, 500, 400), false);
chart.ChartData[0, 1].Text = "Series 1";
string[] categories = { "Category 1", "Category 2", "Category 4", "Category 3", "Category 4", "Category 2", "Category 1",
"Category 1", "Category 3", "Category 2", "Category 4", "Category 2", "Category 3",
"Category 1", "Category 3", "Category 2", "Category 4", "Category 1", "Category 1",
"Category 3", "Category 2", "Category 4", "Category 1", "Category 1", "Category 3",
"Category 2", "Category 4", "Category 1"};
for (int i = 0; i < categories.Length; i++)
{
chart.ChartData[i + 1, 0].Text = categories[i];
}
double[] values = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 1].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, 1];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0];
chart.Series[0].Values = chart.ChartData[1, 1, values.Length, 1];
chart.PrimaryCategoryAxis.IsBinningByCategory = true;
chart.Series[1].Line.FillFormat.FillType = FillFormatType.Solid;
chart.Series[1].Line.FillFormat.SolidFillColor.Color = Color.Red;
chart.ChartTitle.TextProperties.Text = "Pareto";
chart.HasLegend = true;
chart.ChartLegend.Position = ChartLegendPositionType.Bottom;
ppt.SaveToFile(outputFile, FileFormat.PPT);
ppt.Dispose();
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.SunBurst, new RectangleF(50, 50, 500, 400), false);
chart.ChartData[0, 3].Text = "Series 1";
string[,] categories = {{"Branch 1","Stem 1","Leaf 1"},{"Branch 1","Stem 1","Leaf 2"},{"Branch 1","Stem 1", "Leaf 3"},
{"Branch 1","Stem 2","Leaf 4"},{"Branch 1","Stem 2","Leaf 5"},{"Branch 1","Leaf 6",null},{"Branch 1","Leaf 7", null},
{"Branch 2","Stem 3","Leaf 8"},{"Branch 2","Leaf 9",null},{"Branch 2","Stem 4","Leaf 10"},{"Branch 2","Stem 4","Leaf 11"},
{"Branch 2","Stem 5","Leaf 12"},{"Branch 3","Stem 5","Leaf 13"},{"Branch 3","Stem 6","Leaf 14"},{"Branch 3","Leaf 15",null}};
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 3; j++)
chart.ChartData[i + 1, j].Value = categories[i, j];
}
double[] values = { 17, 23, 48, 22, 76, 54, 77, 26, 44, 63, 10, 15, 48, 15, 51 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 3].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 3, 0, 3];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, values.Length, 2];
chart.Series[0].Values = chart.ChartData[1, 3, values.Length, 3];
chart.Series[0].DataLabels.CategoryNameVisible = true;
chart.ChartTitle.TextProperties.Text = "SunBurst";
chart.HasLegend = true;
chart.ChartLegend.Position = ChartLegendPositionType.Top;
ppt.SaveToFile(outputFile, FileFormat.PPT);
ppt.Dispose();
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.TreeMap, new RectangleF(50, 50, 500, 400), false);
chart.ChartData[0, 3].Text = "Series 1";
string[,] categories = {{"Branch 1","Stem 1","Leaf 1"},{"Branch 1","Stem 1","Leaf 2"},{"Branch 1","Stem 1", "Leaf 3"},
{"Branch 1","Stem 2","Leaf 4"},{"Branch 1","Stem 2","Leaf 5"},{"Branch 1","Stem 2","Leaf 6"},{"Branch 1","Stem 2","Leaf 7"},
{"Branch 2","Stem 3","Leaf 8"},{"Branch 2","Stem 3","Leaf 9"},{"Branch 2","Stem 4","Leaf 10"},{"Branch 2","Stem 4","Leaf 11"},
{"Branch 2","Stem 5","Leaf 12"},{"Branch 3","Stem 5","Leaf 13"},{"Branch 3","Stem 6","Leaf 14"},{"Branch 3","Stem 6","Leaf 15"}};
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 3; j++)
chart.ChartData[i + 1, j].Text = categories[i, j];
}
double[] values = { 17, 23, 48, 22, 76, 54, 77, 26, 44, 63, 10, 15, 48, 15, 51 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 3].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 3, 0, 3];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, values.Length, 2];
chart.Series[0].Values = chart.ChartData[1, 3, values.Length, 3];
chart.Series[0].DataLabels.CategoryNameVisible = true;
chart.Series[0].TreeMapLabelOption = TreeMapLabelOption.Banner;
chart.ChartTitle.TextProperties.Text = "TreeMap";
chart.HasLegend = true;
chart.ChartLegend.Position = ChartLegendPositionType.Top;
ppt.SaveToFile(outputFile, FileFormat.PPT);
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.WaterFall, new RectangleF(50, 50, 500, 400), false);
chart.ChartData[0, 1].Text = "Series 1";
string[] categories = { "Category 1", "Category 2", "Category 3", "Category 4", "Category 5", "Category 6", "Category 7" };
for (int i = 0; i < categories.Length; i++)
{
chart.ChartData[i + 1, 0].Text = categories[i];
}
double[] values = { 100, 20, 50, -40, 130, -60, 70 };
for (int i = 0; i < values.Length; i++)
{
chart.ChartData[i + 1, 1].NumberValue = values[i];
}
chart.Series.SeriesLabel = chart.ChartData[0, 1, 0, 1];
chart.Categories.CategoryLabels = chart.ChartData[1, 0, categories.Length, 0];
chart.Series[0].Values = chart.ChartData[1, 1, values.Length, 1];
ChartDataPoint chartDataPoint = new ChartDataPoint(chart.Series[0]);
chartDataPoint.Index = 2;
chartDataPoint.SetAsTotal = true;
chart.Series[0].DataPoints.Add(chartDataPoint);
ChartDataPoint chartDataPoint2 = new ChartDataPoint(chart.Series[0]);
chartDataPoint2.Index = 5;
chartDataPoint2.SetAsTotal = true;
chart.Series[0].DataPoints.Add(chartDataPoint2);
chart.Series[0].ShowConnectorLines = true;
chart.Series[0].DataLabels.LabelValueVisible = true;
chart.ChartLegend.Position = ChartLegendPositionType.Right;
chart.ChartTitle.TextProperties.Text = "WaterFall";
ppt.SaveToFile(outputFile, FileFormat.PPT);
ppt.Dispose();
问题修复:
- 修复了PPT转PDF后项目符号丢失的问题。
- 修复了保存形状到图片后内容不正确的问题。
- 修复了获取的表格单元格文字字体不正确的问题。
- 优化了PPT文件转图片的耗时。
- 修复了应用加载PPT文件时抛出“System.NullReferenceException”的问题。
- 修复了获取的文本字体不正确的问题。
- 修复了获取的动画时长不正确的问题。
- 修复了应用程序在将形状保存到图像时抛出“System.NullReferenceException”的问题。
- 修复了使用 IsPasswordProtected 时内存未释放的问题。
- 修复了程序在加载 PPT 文件时抛出“OutOfMemoryException”的问题。
- 修复了将图表保存到图像时程序抛出“System.NullReferenceException”的问题。
- 修复了“generatePublisherEvidence”设置为“false”时许可验证受到影响的问题。
Spire.XLS
新功能:
- 支持为单元格设置 Html 字符串
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"input.xlsx");
Worksheet sheet = workbook.Worksheets[0];
sheet.Range["A1"].HtmlString = "<div>xxxx<br>yyyy</div>";
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"input.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
PivotTable table = worksheet.PivotTables[0] as PivotTable;
PivotConditionalFormatCollection pcfs = table.PivotConditionalFormats;
PivotConditionalFormat pc = pcfs.AddPivotConditionalFormat();
IConditionalFormat cf = pc.AddCondition();
cf.FormatType = ConditionalFormatType.ContainsBlanks;
cf.FillPattern = ExcelPatternType.Solid;
cf.BackColor = Color.Red;
bool havepwd = Workbook.IsPasswordProtected(File.OpenRead(inputFile));
var docBytes = File.ReadAllBytes(inputFile);
MemoryStream ms = new MemoryStream(docBytes);
bool havepwd = Workbook.IsPasswordProtected(ms);
Workbook book = new Workbook();
book.LoadFromFile("input.xlsx");
Worksheet sheet = book.Worksheets["sheet1"];
PrstGeomShapeCollection prstGeomShapeCollection = sheet.PrstGeomShapes;
IPrstGeomShape shape = prstGeomShapeCollection["a"];
shape.LinkedCell.RangeAddressLocal;
Workbook workbook = new Workbook();
workbook.LoadFromFile("input.xlsx");
workbook.Worksheets[0].CalculateAllValue();
workbook.Worksheets[0].Range["A1:C3"].CalculateAllValue();
问题修复:
- 修复了图表保存到图片后内容不正确的问题。
- 修复了html文件转excel时内容格式不正确的问题。
- 修复了excel文件转PDF后内容不正确的问题。
- 修复了将数据透视表工作表复制到另一个工作表后结果文件打开错误的问题。
- 修复了excel文件转ODF后边框丢失的问题。
- 优化了将图表保存到图像时的时间消耗。
- 修复了工作表保存为 Html 后内容不正确的问题。
- 修复了将 Excel 文件转换为 PDF 时程序抛出“System.FormatException”的问题。
- 修复了 Html 转 Excel 后结果文件为空的问题。
- 修复了Excel转PDF时表格列宽设置不生效的问题。
- 修复了已设置行高的单元格合并后行高发生变化的问题。
- 修复了Excel转Html后内容不正确的问题。
- 修复了程序在多线程中将 Excel 文件转换为 PDF 时抛出异常的问题。
- 修复了Excel转Html后内容格式不正确的问题。
- 修复了为工作表添加两个小计时程序长时间挂起的问题。
- 修复了添加 SparklineGroup 时应用程序抛出“System.ArgumentOutOfRangeException”的问题。
- 修复了多次签名后只剩下最后一个签名的问题。
- 修复了程序在使用 IsPasswordProtected() 时抛出“IOException”的问题。
- 修复了IPrstGeomShape获取值不正确的问题。
Spire.Doc
问题修复:
- 修复了合并Word文档后,生成文档中的公式变形的问题。
- 修复了通过HTML向Word文档插入公式后,公式位置错误的问题
- 修复了转换HTML到Word文档后,生成文档内表格多出边框的问题。
- 修复了转换Word到PDF后,生成文档内容格式错误的问题。
- 修复了接受Word文档中的修订后,生成文档接受失败的问题。
- 修复了设置BuiltinStyle时,程序抛异常“System.NullReferenceException”的问题。
- 修复了使用AppendHTML方法时,程序抛异常“System.NullReferenceException”的问题