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

Free Support Forum - aspose.com

Excel to image of specific size

Hi, I want to convert excel file to image of specific size. can you please let me know how can i achive this.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please refer to the following documentation article that explains how to convert your worksheet into image.

http://www.aspose.com/docs/display/cellsnet/Converting+Worksheet+to+Image

I am looking ans for Java and link provided by you is not working.

Hi,

Thanks for your posting and using Aspose.Cells.

Please try the following java link and see if it works for you.

http://www.aspose.com/docs/display/cellsjava/Converting+Worksheet+to+Image

I refer this code but the probelm is this my page is too wide and for this it will create 3 image filea and i want only one page per worksheet.


PageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setFitToPagesTall(0);

ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setImageFormat(ImageFormat.getPng());
imgOptions.setOnlyArea(true);

Worksheet sheet = workbook.getWorksheets().get(0);
SheetRender sr = new SheetRender(sheet, imgOptions);

for (int j = 0; j < sr.getPageCount(); j++) {
sr.toImage(j, );
}

By this way I get 1 image per workbook but output iamge is of A4 size and of very low quality (on zoom nothing is clear). i want image to be clear and of customised size like 12*14. Is it possible?

Hi,

Thanks for your posting and using Aspose.Cells for Java.

Please use the following code to convert your entire worksheet contents in a single page.

Java


Workbook workbook = new Workbook(path);


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


ImageOrPrintOptions options = new ImageOrPrintOptions();

options.setOnePagePerSheet(true);

options.setImageFormat(ImageFormat.getEmf());


SheetRender sr = new SheetRender(worksheet, options);

sr.toImage(0, new FileOutputStream(path + “.out.png”));

Thanks for your response will work for me :slight_smile: