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

Free Support Forum - aspose.com

Image shrinks after setting width scalable

I am trying to do the following

  1. Convert the TL_Summary_report_Template.xlsx into html
  2. Convert the html back to Excel

If you notice my excel output (both good and bad excel), the Paypal logo in good excel shows the logo nicely but in bad excel it doesn’t show properly.

The difference between those 2 excels are, the html input given to those excel conversion in step 2 for both cases are different. In case of good excel the html input is TL_Summary_Report_Template.html and in case of bad excel the html input is TL_Summary_Report_Template-widthscalable.html.

These 2 html files are generated in step 1 using TL_Summary_report_Template.xlsx with one setting different ‘opts.setWidthScalable’ as shown below. If I set the width scalable and generate the html, then the excel generated from this html in step2 has improper logo, but if I do not set the width scalable during html generation, the excel generated out of this html shows the logo correctly. But I do need to set the width scalable to overcome other issues. So would like to know if we can anyway override this for image alone?

public byte[] convertToHtml(Workbook wb) throws Exception {
HtmlSaveOptions opts = new HtmlSaveOptions();
//opts.setWidthScalable(true);
opts.setExportActiveWorksheetOnly(true);
opts.setExportImagesAsBase64(true);
ByteArrayOutputStream os = new ByteArrayOutputStream();
wb.save(os, opts);
return os.toByteArray();
}

Attached those files for reference

share.zip (70.4 KB)

@paypaluser,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSJAVA-43272 - Image shrinks after setting width scalable

@paypaluser,

This is to inform you that your issue has been resolved and you will soon get the fix after we have performed QA and included other enhancements and fixes.

@paypaluser,

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

Your issue should be fixed in it.
Please note:

  1. We add HtmlSaveOptions.ImageScalable property which indicates whether using scalable unit to describe the image width when using scalable unit to describe the column width. The default value is true.

  2. The sample code in java is as follows:
    e.g
    Sample code:

    HtmlSaveOptions opts = new HtmlSaveOptions();
    opts.setWidthScalable(true);
    opts.setImageScalable(false);
    opts.setExportActiveWorksheetOnly(true);
    opts.setExportImagesAsBase64(true);

    Workbook wb = new Workbook(filePath + “TL_Summary_Report_Template.xlsx”);
    wb.save(filePath + “out_java.html”, opts);

Let us know your feedback.
aspose-cells-20.8.10-java.zip (7.2 MB)

The issues you have found earlier (filed as CELLSJAVA-43272) have been fixed in Aspose.Cells for Java v20.9. This message was posted using Bugs notification tool by ahsaniqbalsidiqui.
You may also get the new version @ Maven repos. (https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-cells/20.9)