Problem with Line Height and Border creating image from Excel area

Creating an image from an Excel area the result has different line height ad text position and some thicker border compared to the source.
I attached a simple test with the source workbook
asposeTests.zip (61.3 KB)

@federico.mameli,

Since your worksheet’s zoom is set to 160%, so you might have issue with data display, line height and other formattings. To cope with it, you may simply auto-fit rows in the sheet prior rendering to image format. See the added line of code in the following code segment:
e.g
Sample code:


Worksheet ws = input.getWorksheets().get(“1”);
ws.autoFitRows();
PageSetup pageSetup = ws.getPageSetup();
pageSetup.setPrintArea(PRINT_AREA1);
pageSetup.setLeftMargin(0.0);
pageSetup.setRightMargin(0.0);
pageSetup.setTopMargin(0.0);
pageSetup.setBottomMargin(0.0);
pageSetup.setPrintQuality(1200);

I have tested by adding the line and it works ok.

Let us know your feedback.

It’s not a solution for me: it modifies the row height, in some cases it’s a problem.
I tried setting the worksheet zoom to 100:
ws.setZoom(100);
instead of
ws.autoFitRows();
but it doesn’t wok.

@federico.mameli,

If you could take the picture of your data area (which has small font size) only, you will get almost same results as per Aspose.Cells produces. Anyways, could you share your expected image, we will check and may log appropriate ticket for it.

Like this, as it appears in excel
result.png (10.6 KB)

@federico.mameli,
We have observed this issue and logged it in our database for further investigation and a fix. You will be automatically notified once any update is ready to share.

This issue is logged as:
CELLSJAVA-43241-Problem with Line Height and Border while creating image from Excel area

@federico.mameli,

We will fix the text position issue.
For the thick border issue, it is because of the code opts.setHorizontalResolution(220);opts.setVerticalResolution(220); is set. If you comment the two lines, the border will be OK.

Regarding the thick border, it seems to be a word issue, in fact if I change the word zoom, the thick lines change.
In any case, if I doesn’t set the resolution (only in case of png), the default one is to low 96p
Thank you for the fix about the text position, I’ll wait for it.

@federico.mameli,

Thanks for providing further details.

And, sure, we will keep you posted regarding new fix and once it is available for public use, we will share the Download link here.

@federico.mameli,

Please try our latest version/fix: Aspose.Cells for Java v20.6.7 (attached)

Let us know your feedback.
aspose-cells-20.6.7-java.zip (7.1 MB)

It works, thanks

@federico.mameli,
You are welcome.

The issues you have found earlier (filed as CELLSJAVA-43241) have been fixed in Aspose.Cells for Java 20.7. This message was posted using Bugs notification tool by Amjad_Sahi