I have troubles creating a simple column chart. Creation works fine but I get a warning when I open the xlsx : "Excel has encountered some unreadable content....".
I made a sample application with the simplest code :
- Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
Workbook Book = new Workbook();
Book.LoadFromFile(Application.StartupPath + "\\Sample.xlsx");
Chart MyChart = Book.Worksheets[0].Charts.Add(ExcelChartType.ColumnClustered);
MyChart.LeftColumn = 4;
MyChart.RightColumn = 14;
MyChart.TopRow = 1;
MyChart.BottomRow = 11;
MyChart.DataRange = Book.Worksheets[0].Range[1, 1, 15, 2];
Book.SaveToFile("c:\\Test.xlsx");
System.Diagnostics.Process.Start("c:\\Test.xlsx");
this.Close();
}
you will find Sample.xlsx as attachment. I had to compress it since this forum does not allow xlsx files to be uploaded (funny isn't it ? :p).
Thanks in advance and Have a nice day !
Michael.