We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extract vector WMF from Excel file

Hi,


I am using Aspose 7.7.1.5. I have excel file with vector image in EMF format in one of the worksheets. I save it as WMF file by writing this code:
ImageOrPrintOptions imageOrPrintOptionsWmf = new ImageOrPrintOptions();
imageOrPrintOptionsWmf.setImageFormat(ImageFormat.getWmf());
shape.toImage(“c:/dev/java/AsposeTest/result_chart_builder.wmf”, imageOrPrintOptionsWmf);

Unfiortunately, it looks like the saved image is raster WMF. Is it possible to save the image in vector WMF format using Aspose Cells for Java?

Thanks,
Krzysztof Pawlowski

Hi Krzysztof,

Thanks for your posting and using Aspose.Cells.

Kindly provide us your source xls/xlsx files, we will look into it and see if wmf images could be saved in the vector format instead of rastor images.

Hi Shakeel,


Please find source xlsx file enclosed.

Thanks,
Krzysztof

Hi,


I think you may try to use/ set some attributes for ImageOrPrintOptions, see the sample code that you may try to enhance the WMF image quality:
e.g
Sample code:

String filePath = “Test.xlsx”;


//Load the source workbook

Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.getWorksheets().get(0);


Picture pic = worksheet.getPictures().get(0);


ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setImageFormat(ImageFormat.getWmf());

options.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

options.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

pic.toImage(filePath + “.out1.wmf”, options);


Hope, this helps a bit.

Thank you.

Hi Amjad,


Many thanks for quick response.

I am afraid antialiasing is not what I wanted. I want to pull the image from the excel file as vector wfm file. Is possible to do with Aspose?

Thanks,
Krzysztof

Hi,


Well, I am afraid, I think there is no such APIs to do that in Aspose.Cells APIs list. Anyways, I have logged an investigation ticket with an id “CELLSJAVA-40780” into our database for your feature request. Our concerned developer will check if we could extract vector WMF from an Excel file. We will evaluate your issue/ requirements soon.

Once we have any update on it, we will let you know here.

Thank you.

Many thanks Amjad!

Hi Krzysztof,

Thanks for using Aspose.Cells.

We have analyzed this issue and we are afraid, we cannot support WMF formatted (vector) image.