After migration from 7.1.2 to 7.6.0 We found the next problem.
Operations with cells.toImage were become too long and too many memory.
The saving word with many images in PDF, HTML and docx.
I reproduced it as conversion the excel with 300 images to PDF.
private static void convertChartsFromFile() throws Exception {
Workbook workbook = new Workbook(“big.xlsx”);
SaveOptions saveOptions = new PdfSaveOptions();
Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
ChartCollection chartCollection = workbook.getWorksheets().get(0).getCharts();
final long start = System.currentTimeMillis();
for (int i = 0; i< chartCollection.getCount(); i++) {
ByteArrayOutputStream pictureBytes = new ByteArrayOutputStream();
ImageOrPrintOptions imageOptions = new ImageOrPrintOptions ();
imageOptions.setImageFormat( ImageFormat.getPng());
imageOptions.setHorizontalResolution( (int) (AsposeUtility.EXCEL_CHART_WIDTH * AsposeUtility.PIXELS_TO_POINTS) );
imageOptions.setVerticalResolution( (int) (AsposeUtility.EXCEL_CHART_HEIGHT * AsposeUtility.PIXELS_TO_POINTS) );
Chart chart = chartCollection.get(i);
chart.toImage( pictureBytes, imageOptions );
byte[] data = pictureBytes.toByteArray();
// Create image by bytes
BufferedImage image = ImageIO.read(new ByteArrayInputStream(data));
builder.insertImage(image);
final long end = System.currentTimeMillis();
System.out.println("Count: " + i + “, Time: " + ((end - start)/1000f) + " sec”);
}
long startSave = System.currentTimeMillis();
document.save(“big_from_excell7.1.6.pdf”, com.aspose.words.SaveFormat.PDF);
System.out.println(“Save. Time: " + ((System.currentTimeMillis() - startSave)/1000f) + " sec”);
}
The result for 7.1.2
conversation images - Count: 299, Time: 50.676 sec
the saving all documents - Save. Time: 10.908 sec
The result for 7.6.0
conversation images - Count: 299, Time: 351.774 sec
the saving all documents - Save. Time: 82.588 sec
The source excel is “big.xlsx”.
The usage of memory in 7.1.2 you can see in "memory7.1.2.png"
The usage of memory in 7.1.2 you can see in “memory7.6.0.png”