1

I'm creating a spreadsheet with EPPlus library on a .NET 4.0 command line application.

I successfully loaded all the data from the data base, at the end I'm creating a graphic, this is my code:

var chart = sheet.Drawings.AddChart("Revenue", OfficeOpenXml.Drawing.Chart.eChartType.ColumnClustered);

chart.SetPosition(2, 0, 4, 0);
chart.SetSize(650, 400);

chart.Series.Add(ExcelRange.GetAddress(3, 2, 14, 2),ExcelRange.GetAddress(3, 1, 14, 1));
chart.Title.Text = "Revenue";

I open the generated file in MS Office 2010 and everything looks fine, the data the graphic, etc.. but if I open the same generated file in OpenOffice 3.3 the graphics are empty.

The weird thing is, if I open the file in Office 2010 and make a copy (Save As).. and I open the copy in OpenOffice, the graphics are good... so I'm wondering if I'm missing something in my code to make it compatible with both Office2010 and OpenOffice

Thanks for the help!

4

1 回答 1

3

看起来,当 EPPlus 创建图表时,它只存储数据系列的单元格引用。它实际上并不存储每个数据点的值。

Microsoft Excel 将重新计算每个数据点的值(我相信),可能会忽略电子表格文件中的任何数据点缓存。

OpenOffice/LibreOffice 似乎只读取图表部分中的缓存数据点值。这就是图表没有出现在 OpenOffice 中的原因,因为没有通过 EPPlus 写入的数据点值。

于 2013-06-10T04:23:09.280 回答