Free Support Forum - aspose.com

range.Worksheet.Charts[i].ToImage() in WMF format

range.Worksheet.Charts[i].ToImage() in WMF format

can i convert charts into WMF image format?

or how can convert ToImage()'s bitmap result to WMF?

Thanks

Hi,

Please check the following sample code for your requirement:

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
workbook.Open(@"d:\test\TemplateCharts.xls");
Aspose.Cells.Chart chart = workbook.Worksheets["MySheet"].Charts[0];
Bitmap bitmap = chart.ToImage();
bitmap.Save(@"d:\ChartImg.wmf", System.Drawing.Imaging.ImageFormat.Wmf);

Thank you.

you cannot simply save as Wmf because encoding issue…

Hi,

We can save it as Emf format.Please use the following methods:

ToImage(string imageFile)

ToImage(string imageFile, System.Drawing.Imaging.ImageFormat imageFormat)

We convert the chart to WMF format, but it does work as vector map.So please save it as EMF format.