Microsoft Excel document with strange behaviour on image size

Hi there,

I’m using Aspose.Cells to create an excel document containing images with fixed size - 100px. When I get the document and open it on my Windows, the column has 87 pixels and the image 2.3 cm. When I check the same using macOS, I got 75 pixels and 2.65 cm.

This doesn’t seems to be related with fonts and this isn’t happening for docx documents.

Could you please help?
TT-22.xlsx.zip (550.2 KB)

Kind regards,
Paulo Alves.

@paulorpa,

Thanks for using Aspose.Cells and the sample file.

Please send us the sample code along with the source images which we will use to create the output XLSX file here. Also send us the images in Windows and macOS showing this difference. It will be helpful for us to re-create the issue and provide our feedback about the issue.

Hi there,

I’m trying to set the cell width like this: getSheet().getCells().setColumnWidthPixel(0, 100); and I got different results.

Here are the screenshots.
Windows 10
windows 10.png (153.2 KB)

macOS High Sierra
macos.png (287.3 KB)

Thank you.
Kind regards,
Paulo Alves.

@paulorpa,

I have tried the following sample code to create an XLSX file having one 100x100 pixels image in the first worksheet. It is observed that output file when opened in Excel 365, shows the column width properly as set by the following code. You may use latest version Aspoce.Cells for Java 18.6 and the following sample code to test the issue again.

Workbook wb = new Workbook();
Worksheet ws = wb.getWorksheets().get(0);
ws.getPictures().add(0, 0, "100PixRedbox.png");
ws.getCells().setColumnWidthPixel(0,100);
wb.save("JavaOutput.xlsx");

If issue is not resolved, please share your sample code, few images which are inserted in the sheet and output generated by the latest Aspose.Cells API. I have used Windows 7 OS and IntelliJ Idea IDE.

JavaOutput.zip (7.4 KB)
100PixRedbox.png (91 Bytes)
ExcelImage.jpeg (62.7 KB)

Hi @ahsaniqbalsidiqui,

Thank you so much for the effort. Although, I opened the excel you sent inside JavaOutput.zip and it doesn’t show 100 pixels on the width.
Could you please test it using the Excel 365 in a macOS operating system?

JavaOutput.png (316.5 KB)

Kind regards,
Thank you.

@paulorpa,

I have performed a test by creating a blank XLSX file using Excel 365 for Windows. Width of first column in the first sheet of this blank file is set to 100 pixels by dragging the cell’s header boundary. Now the file is saved and transferred to macOS.

There this file is opened in Excel and width of the column is checked in macOS. It is observed that width is 86 pixel. Could you please check this scenario at your end and share the feedback? If you get the same behavior, then it shows that its not an issue with Aspose.Cells, but default behavior of Excel.

1 Like

Hi ahsaniqbalsidiqui,

Yes, I was able to reproduce the problem too. I would say the problem is related with Excel.
You can close this ticket.

Thank you so much.

Kind regards,
Paulo Alves.

@paulorpa,

You are welcome and thank you for the feedback.