Hello Aspose Support,
I’m having a problem generating some excel files. Basically, I use the same code to change an excel file (the code consists of changing values in several cells) in 2 different machines. What happens is that the results are slightly different, in machine 1 the cells have a height of 20px and in machine 2 the cells have a height of 21px.
I’m using Aspose Cells for Java 19.2.
Do you have any idea why this problem is happening?
Well, it is strange that you are getting different results (using the same code and template file(s)) on two machines. Please check if the underlying fonts are installed on the culprit machine. We are no definite clue why this is happening, so we need your simulation demo code or project (runnable) to evaluate your issue precisely to consequently figure it out soon. Please do the needful and if you still find the issue, kindly do provide your sample project (runnable) and template files (if any) to demonstrate the issue, we will check it soon.
PS. Please try using our latest version/fix v19.5.
I verified and the same fonts are installed on both machines.
We noticed this problem because we have a comparing tool that compares Word and Excel files (using aspose words and aspose cells) and when generating an excel document on a new machine the comparing tool asserts that the Row Height of most of the documents is different (usually by 1 pixel).
I’ll add the template file used, the base document file and the document generate on the new machine.
When I open them in my laptop (MacOS), all have the row height equal to 15.0 -> 15px. Also, the base doc and generated doc seem equal.
But when I open them using aspose cells like this:
final Workbook template = new Workbook(“XLSX Single Issue Detail.xlsx”);
final Workbook baseDoc = new Workbook(“DEM-56_sid.xlsx”);
final Workbook genDoc = new Workbook(“DEM-56.xlsx”);
I checked by opening the file into MS Excel 2013 on Windows8, I found Aspose.Cells gives you valid and correct results. See the screenshot (taken) to confirm the row heights of each file in comparisons for your reference.
Do you use Excel 365 for mac? I suspect Excel 365 might not give you correct results. Generally Aspose.Cells follows MS Excel (windows) and if MS Excel (2007/2010/2013/2016) shows same results (as per the screenshot) as Aspose.Cells gives, then it should not be an issue with the API. screens1.png (51.2 KB)
I confirm that I’m using Excel 365. So, the files have in fact a difference and my excel version is not showing me the right output.
But why are they different if they are generated using the same code (same version of our product with same version of Aspose cells)?
They are generated in different machines. What machine’s differences should I look for that can cause this problem?
@Hugo_Freixo,
Thank you for providing more details. We need to generate these files here for our analysis. Could you please provide us a sample console application (runnable) which can be used to generate the output file which behaves differently on different machines? We will reproduce the files here and provide assistance accordingly.
Hi @ahsaniqbalsidiqui,
I believe I found the source of the problem. Seems like when I autoFit Rows, the row height goes to 20px. But when I do it manually on the height goes to 21px.
final AutoFitterOptions options = new AutoFitterOptions();
options.setAutoFitMergedCells(true);
options.setIgnoreHidden(true);
final Workbook template = new Workbook(“XLSX Single Issue Detail.xlsx”);
final Worksheet worksheet = template.getWorksheets().get(0);
For some reason, in one of the machines this code sets the Height to 21px (like when you do it manually), in the other one it’s set to 20px.
I tested this opening the generated file on Excel 365 and Excel 2016.
@Hugo_Freixo,
We have tested this scenario again on two different machines having Windows and macOS. 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-42920 - Same excel file have different cell size on different machines