Alternative of setImageFormat() method

Hi Team,

We are using setImageFormat() method in our project which is now removed from Aspose.cell 22.7

ImageOrPrintOptions saveOptions = new ImageOrPrintOptions();
saveOptions.setImageFormat(ImageFormat.getJpeg());

Also, setChartImageType() and setImageType() methods are deprecated.

Can you please let us know alternative of setImageFormat(), setChartImageType() and setImageType() method.

Thanks,
Arvind

@rnara,

Please try:

ImageOrPrintOptions saveOptions = new ImageOrPrintOptions();
saveOptions.setSaveFormat(SaveFormat.JPG);

Thanks for update. I will try.

For below code what would be alternative

saveOptions.setImageType(ImageFormat.getPng());

As setImageType() method is also deprecated

Regards,
Arvind

@rnara,

Please ignore my previous reply. In the new version (Aspose.Cells for Java v22.8), you may refer to the following lines of code for guidance.
e.g.
Sample code:

         ImageOrPrintOptions saveOptions = new ImageOrPrintOptions();
    	 saveOptions.setImageType(ImageType.JPEG);
    	 saveOptions.setImageType(ImageType.PNG);

ImageOrPrintOptions.setImageType() is not deprecated or removed rather you will use it in the above way. Moreover, setSaveFormat is deprecated.

@rnara

For ImageOrPrintOptions.setImageFormat, please use ImageOrPrintOptions.setImageType instead.

For ImageOrPrintOptions.setChartImageType and PdfSaveOptions.setImageType:
Because Chart and Shape are always rendered as vector elements(e.g. point, line) for rendering quality, so please just remove them.

Hi Team,

We are using below code

com.aspose.cells.PdfSaveOptions saveOptions;
saveOptions.setImageType(ImageFormat.getPng());

What alternative we can use for above setImageType() method?
As setImageType() method is deprecated.

Thanks,
Arvind

@rnara

Just remove the line saveOptions.setImageType(ImageFormat.getPng());.