Spire.Presentation 9.9.2 已发布。该版本支持在执行转换功能时设置全局的字体目录,还增加了两个属性用于获取图表数据源的最后一行和最后一列。此外,两个在 PPTX 转 SVG、以及复制形状时出现的问题也已成功被修复。详情请查看下文。
新功能:
- 在执行转换功能时,支持设置全局的字体目录。
- 新增 IChart.ChartData.LastRowIndex 和 IChart.ChartData.LastColIndex 两个属性,用于获取图表的数据源的最后一行和最后一列。
Presentation.SetCustomFontsDirctory("myfonts");
Presentation ppt = new Presentation();
ppt.LoadFromFile(inputFile);
StringBuilder stringBuilder= new StringBuilder();
IChart chart = ppt.Slides[0].Shapes[0] as IChart;
if (chart != null)
{
int lastRow = chart.ChartData.LastRowIndex;
int lastCol = chart.ChartData.LastColIndex;
sb.AppendLine("lastRow" + lastRow + "\r\n" + "lastColumn" + lastCol);
int dataRow = chart.Series[2].Values[chart.Series[2].Values.Count - 1].Row;
int dataColumn = chart.Series[2].Values[chart.Series[2].Values.Count - 1].Column;
sb.AppendLine("dataRow" + datarow + "\r\n" + "dataColumn" + dataColumn);
chart.ChartData.Clear(dataRow + 1, 0, lastRow + 1, lastCol + 1);
chart.ChartData.Clear(0, dataColumn + 1, lastRow + 1, lastCol + 1);
}
File.WriteAllText(outputFile_T,stringBuilder.ToString());
ppt.SaveToFile(outputFile, FileFormat.Pptx2013);
ppt.Dispose();
问题修复:
- 修复了复制形状时,类型由 "graphic" 变成 "image" 的问题。
- 修复了转换 PPTX 文档到 SVG 文档时,内容不正确的问题。
获取 Spire.Presentation 9.9.2,请点击:
https://www.e-iceblue.cn/Downloads/Spire-Presentation-NET.html