Hi,
Can someone please help me out in creating chart in Excel 2007 using OpenXML. We are done with creating an excel 2007 with data from database but could not proceed further to create the excel chart out of it.
ASP.NET 3.5
VS2008 and Windows 2003 Server (Without Office Installed on Server).
Please treat this as urgent.
Thanks,
Yashwanth
Thanks Daniel for your reply.
Actually, I am looking a related sample code as below, which is working good for me (i.e, creation of Excel Sheet on Server, where no MS-Office is installed). But, I am totally stuck after this, I could not find the code related to creation of Chart on Excel.
Our customer requirement is that, it should be created in two different sheet (i.e Sheet1 will have all the data from database with some columns and relevant chart of the data in Sheet1 to be displayed in another sheet "Sheet2")
**********Working sample for excel sheet generation**********
private
{
sheetData.AppendChild(contentRow);
date = date.AddDays(7);
salesLastYear += (
salesThisYear += (
}
worksheet.Append(sheetData);
worksheetPart.Worksheet = worksheet;
worksheetPart.Worksheet.Save();
sheets.Append(sheet);
workbook.Append(fileVersion);
workbook.Append(sheets);
s.WorkbookPart.Workbook = workbook;
s.WorkbookPart.Workbook.Save();
s.Close();
FixChartData(workbookPart, i - 1);
r.Append(cell1);
r.Append(cell2);
r.Append(cell3);
istring.Append(t);
c.Append(istring);
c.Append(v);
*********************************
Any help will be much appreciated.
One quick note, I am using OpenXMLSDKv2.msi on my desktop and nothing relevant on the Webserver i.e (SDK or MS-Office)
Added reference to "DocumentFormat.OpenXml" in the project solution.
It is just another method to create the dataset from DB and later populate it on the excel sheet.
Thanks and regards,
I have tried to create a combination chart ( series1-> Area Chart, series2-> Line Chart...) in spreadsheetML.
My xlsx file contains 2 sheets. First with the data, the second with chart.
The CharSpace contains a Chart, to which I have appended title,areachart,linechart,category axis and values axis.
While creating the chart I did not get any error. I have even tried to validate the package using OpenXML SDK 2.0 Productivity Tool. I am not getting any errors when I validate the package.
But when I open the xlsx file, I get the message saying, 'Drawing part has been removed from the sheet' ( i don't know the exact message..but some thing like this). This error will not come if I create only one chart.
I have spent almost 4 days to identify the reason for it. But no progress in it.
Have any of you got such an error before?? Is it possible to create combination charts using open xml?