I want to let users resize the control and import it into Excel without losing its dimensions (aka want it to have optimal resolution, etc without stretching etc.).
I see examples of how to add it to excel - not a problem but it gets stretched.
For instance this will export the grid + the chart but I want to retain the chart size or at least its dimensions (aka width - height ratio). For instance - I want to start the image at Cell [0, 4] and I want it to span as many cells as required to display correctly.
using Infragistics.Documents.Excel;
using Infragistics.UltraChart.Resources.Appearance;
using Infragistics.UltraChart.Shared.Styles;
using Infragistics.Win.UltraWinGrid.ExcelExport;
...
Workbook wb = new Workbook();
wb.SetCurrentFormat(WorkbookFormat.Excel2007);
Worksheet ws = wb.Worksheets.Add("Chart");
exporter.Export(breakdownGrid, ws);
MemoryStream ms = new MemoryStream();
LineChart.SaveTo(ms, Infragistics.UltraChart.Shared.Styles.RenderingType.Image);
WorksheetImage image = new WorksheetImage(Image.FromStream(ms));
image.PositioningMode = ShapePositioningMode.DontMoveOrSizeWithCells;
image.TopLeftCornerCell = ws.Rows[0].Cells[4];
image.TopLeftCornerPosition = new PointF(0.0F, 0.0F);
image.BottomRightCornerCell = ws.Rows[20].Cells[30+4];
image.BottomRightCornerPosition = new PointF(100.0F, 100.0F);
ws.Shapes.Add(image);
wb.Save(dialog.FileName);
ms.Dispose();
Hello Dale,
I am just checking about the progress of this issue. Let me know if you need my further assistance on it.
Thank you for using Infragistics Components.
Thank you for posting in our forum.
If I understand you correctly you are actually trying to export an image to Excel. In order to retain the image size while exporting it to Excel you need to set the necessary column width and row height in the Excel worksheet. You can do this by using Worksheet’s Column.Width and Row.Height properties. Please note the column width is measured in 256th of the ‘0’ digit character width in the workbook’s default font, while the row height is in twips (1/20th of point). More about these two properties you may find by following the next links http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=Infragistics4.Documents.Excel.v14.2~Infragistics.Documents.Excel.WorksheetRow~Height.html and http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=Infragistics4.Documents.Excel.v14.2~Infragistics.Documents.Excel.WorksheetColumn~Width.html
Please find attached a small sample project where I am exporting an UltraChart to Excel as image with specific width and height.
Please let me know if this is what you are looking for or if I am missing something.