Free Support Forum -

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?



Please check the following sample code for your requirement:

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
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…


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.