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

Free Support Forum - aspose.com

Worksheet to PNG: correct ImageOrPrintOptions for using oleSize in Java

Hello,

we are converting a Worksheet to a PNG file using SheetRender with ImageOrPrintOptions. I’m searching the correct setting for ImageOrPrintOptions so that the SheerRender would use the oleSize (workbook.getWorksheets().getOleSize()). With the oleSize, the SheetRender should determine the area, that we want convered.

Best regards,
Frank

Hi,


Well, there is no such method available to specify Ole Object size in ImageOrPrintOptions class, you may use WorksheetCollection.setOleSize() to specify displayed size. By the way, you may try to use ImageOrPrintOptions.setDesiredSize() to specify the desired width and height (in pixels) of the image.

Thank you.

Hi,

thanks for the super fast reply. But please let me explain my problem more detailed.

In the screenshot “exctel table on slide.png” you can see the excel table on a slide opened in PowerPoint. The visible range is A1:G11, which is saved in the oleSize of the WorksheetCollection. Now we change some data programatically of the embedded excel file so we have to update the picture. The new picture, that we create with your SheetRender, should cover the same range as the original picture. As I mentioned above, that range is stored in the oleSize so we need the SheetRender to use the oleSize to determine which columns and rows should be visible.

Do you know how I can calculate the desiredSize in pixels based on colum number and row number? E.g. if the oleSize is A1:G11, then the picture should contain the first seven columns and the first 11 rows. How many pixels would that be for the SheetRender’s desiredSize?

Thanks in advance.
Frank

Hi Frank,

Thanks for your posting and using Aspose.Cells.

You can get the image of your range i.e A1:G11 by following the approach mentioned in this article.

( http://docs.aspose.com/display/cellsjava/Export+Range+of+Cells+in+a+Worksheet+to+Image )