Problem while upgrading the Obsolete method Worksheet.SheetToImage() method

Hi,

While upgrading from Aspose.Cells 4.8 version to upgrade to 5.2 version, I got several obsolete method warnings.

So the code which I want to want to upgrade is:

Workbook.Worksheets[dataSheetIdx].SheetToImage("ImageName.emf", System.Drawing.Imaging.ImageFormat.Emf);

and I replaced the above code with the code written below in the latest (5.2) version:

ImageOrPrintOptions imageOrPrintOptions = new ImageOrPrintOptions();
imageOrPrintOptions.ImageFormat = ImageFormat.Emf;
SheetRender render = new SheetRender(Workbook.Worksheets[dataSheetIdx], imageOrPrintOptions);
render.ToImage(0, "ImageName.emf");

First of all, Just wanted to confirm that the code changes are correct?
Secondly, Can I get single image for all the page in Worksheet.

Regards,
Ankush Chauhan

Hi,

Yes, the updated code is fine.

See the documents for your complete reference about Sheet to Image feature.

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/converting-worksheet-to-image.html

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/converting-worksheet-to-image-worksheet-to-image-by-page.html

http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/converting-worksheet-to-image-using-imageorprint-options.html

To get a single page for a worksheet, you may add:

//Only one page for the whole sheet would be rendered

imageOrPrintOptions.OnePagePerSheet = true;