I have a spreadsheet which contains a chart. The chart data is mapped to a range of cells which are empty. From within my application I create a copy of the spreadsheet and then populate the range of cells. When I open the spreadsheet the data is there but the chart is empty. Is this not a correct approach to displaying a chart in Excel?
I have read several posts about using UltraChart and saving that as a bitmap and writing that to Excel but that seems an awfully long-winded approach.
Thanks
Just to make sure I understand correctly: you have an Excel file which already contains a chart mapped to a range of data. By using the Infragistics Excel library, you are loading the file, populating the range with data, and then saving out again? I believe this should work. If it is not, I will put you in contact with Developer Support so this issue can be investigated,
Thanks for the reply. Yes, that is exactly the case. I have an xls (created in 2007 but saved in 97/2003 format). In that spreadsheet I have a rectangular range of cells containing to which I map a simple column chart. If I type numbers in the cells columns immediately appear in the chart.
In code I make a copy of this file, and then use WorkBook.Load to open the copy. I select the worksheet from the worksheets collection then write data to the cells from a DataRow using:
object oVal = oRow[ iCol ]; oWorkSheet.GetCell( CellAddress ).Value = oVal;
where CellAddress is a string containing values like "B21" etc.
Then I save the spreadsheet using WorkSheet.Save.
When I double-click on the spreadsheet I get a warning saying that Office has detected a problem and that the file is probably dangerous. When the spreadsheet opens I can see all the data in the correct place. The chart is still there but it is empty. Interestingly, if I type values directly into the cells, columns do not appear in the chart. It seems as if the chart has lost its association with the cell range.
I am using v 10.2 of your libraries.
Should this work or am I taking the wrong approach?