Convert just a part of a Worksheet to image

I need to convert to image just a part of a worksheet, from A1 to C25 so I can get in the same image two different charts. I need a PNG of what is marked in red in the following picture. Unfortunately Chart.toimage() just retrieves a small part of the worksheet. How do I set the area that I want to copy?




Thank you


Jorge Obregón

Hi,

Please try this code using the latest version:

<a href="https://forum.aspose.com/t/123032">Aspose.Cells for Java v7.0.1.5</a>
<br><br><font size="2" face="Courier New"><font color="#FF0000"><BLOCKQUOTE><div>Please also make sure, you have all the <b>additional java libraries</b> required by <b>Aspose.Cells for Java V7.0.0 and later</b>. You can download them from the major version: <a id="ctl00_ctl01_bcr_ctl00___ctl00_Entrylisting1___Entries_ctl01_Name" href="http://www.aspose.com/community/files/72/java-components/aspose.cells-for-java/entry329168.aspx">Aspose.Cells for Java 7.0.1</a><br><br>Or you can download them separately from this link: 

<a href="">Additional Java Libraries For V7.0.0 and Later</a></div></BLOCKQUOTE></font> <br></font><br>It will convert your desired range into image.<br><br><b>Java</b><br><div class="csharpcode">

String path = “F:\Shak-Data-RW\Downloads\Report_2011-9-2_10-5-28.xlsx”;

Workbook workbook = new Workbook(path);


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


//Apply different Image / Print options.

ImageOrPrintOptions options = new ImageOrPrintOptions();

worksheet.getPageSetup().setPrintArea(“A1:C25”);


SheetRender sr = new SheetRender(worksheet, options);


sr.toImage(0, path + “.out.jpeg”);