Hi,
I needed to save a grid along with the ultraWinChart in the excel sheet.
I did successfully with all the help provided in the forum. The chart is saved as an image. whereas my requirement is to save chart in editable mode. For eg. If i change the data of grid in excel the corresponding change should also reflect in the chart. I am not getting how to proceed on it.
Plz help.
Thanks
Quick way to export chart to Excel flows..
---
Infragistics.Excel.Workbook objWorkBook = new Infragistics.Excel.Workbook();
// chtClientAsset -- Ultrachart control
SaveChart(objWorkBook, chtClientAsset, "Client Asset");
----------------
private void SaveChart(Workbook w, Infragistics.Win.UltraWinChart.UltraChart ChartCtrl, string Sheetname) { Worksheet s = w.Worksheets.Add(Sheetname); System.IO.MemoryStream ms = new System.IO.MemoryStream(); ChartCtrl.SaveTo(ms, System.Drawing.Imaging.ImageFormat.Png); WorksheetImage i = new WorksheetImage(System.Drawing.Image.FromStream(ms)); //s.Rows[0].Cells[0].Value = "Blue Zone : " + dtpFromDate.DateTime.ToString("dd-MMM-yy"); //s.Rows[1].Cells[0].Value = "Red Zone : " + dtpToDate.DateTime.ToString("dd-MMM-yy"); i.TopLeftCornerCell = s.Rows[0].Cells[0]; i.TopLeftCornerPosition = new PointF(0.0F, 0.0F); i.BottomRightCornerCell = s.Rows[22].Cells[9]; i.BottomRightCornerPosition = new PointF(0.0F, 0.0F); s.Shapes.Add(i); }
It is possible, but not through any feature of the WinChart. To do this, you must create an Excel chart on the worksheet using C#, copy the settings from the WinChart, and copy the data to a cell range to base the Excel chart on.
The Excel chart will only resemble your WinChart based on the settings you copy.