Shapes (Arrows) position changed when converting from Excel to HTML(Stream)

Hi,

We noticed when adding Shapes/Arrows in excel, the position of the Shapes/Arrows won’t stay at the same place after converting to html, the position is quite important for us as the main purpose of the picture is to show a specific object or place to indicating, also you can find out the arrows/pictures’ layer info are not the same as the original, the attached screenshot clearly show the issue.
Snag_49bee8.jpg (254.7 KB)
Snag_49cfef.jpg (180.1 KB)
Snag_4a0a48.jpg (246.5 KB)

Here is the code we use:

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
// Set the Presenation preference option
htmlSaveOptions.setPresentationPreference(true);
htmlSaveOptions.setAddTooltipText(true);
htmlSaveOptions.setExcludeUnusedStyles(true);
htmlSaveOptions.setExportPrintAreaOnly(false);
htmlSaveOptions.setExportComments(true);
htmlSaveOptions.setExpImageToTempDir(true);
htmlSaveOptions.setExportGridLines(true);
htmlSaveOptions.setShowAllSheets(true);
htmlSaveOptions.setExportDocumentProperties(true);
htmlSaveOptions.setExportWorkbookProperties(true);
htmlSaveOptions.setExportWorksheetProperties(true);
htmlSaveOptions.setAttachedFilesDirectory(imagePath);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
Workbook workbook = new Workbook(fileNameWithPath);
workbook.save(stream, htmlSaveOptions);
}
} catch (Exception e) {
return e.toString();
}

This is the excel file using in the screenshot.
Arrow_position_shift_problem.zip (469.3 KB)

Thanks advance for your help!

@FSUPTC,

Thanks for the template XLSX file and screesnhots.

Please try our latest version/fix: Aspose.Cells for Java 22.11. I have tested your scenario/case with it using your template file, it works fine and as expected.

Let us know if you still find any issue with latest version/fix.

@Amjad_Sahi
Thanks for your prompt response. Do you know when the repository will have the latest version?

@FSUPTC,

It already has. You can easily get/use the Aspose.Cells for Java API directly in your Maven based projects by adding following configurations to your pom.xml. For the detailed instructions please visit Installing Aspose.Cells for Java from Maven Repository documentation page

hi,

After testing with the latest version, the issue is still there.
you can see from the screenshot that images and arrows shift down a little accumulatively.
Snag_257e17ff.jpg (473.5 KB)
here is the result file test.zip (471.6 KB)
here is the sample fileArrow_position_shift_problem.zip (469.3 KB)
The code using you can find at the top.

FYI, I know the result from the live demo looking good, but for the security concern, unfortunately we cannot use embed base64 image.

Thanks for your help.

@FSUPTC

After an initial test, I am able to reproduce the issue as you mentioned. I found that positon of shape is shifted in the output HTML.

I have logged a ticket with an id “CELLSJAVA-44976” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

Thank for your help, can i have a rough idea about how long can we get the fix?

@FSUPTC,

Since we just logged a ticket for your issue, so we cannot give an ETA on it at the moment. Once we have evaluated and analyzed the issue in details then we might be able to share an ETA or latest updates on it.

Once we have any new information available, we will share with you.

Hi, what is the process to escalate this issue? We are in the process of upgrading our Aspose.Word license to Aspose.Total, but this is definitely a blocker for customers as the converter is used in the context of work instructions, which means that precise location of the objects is critical.

Thanks,
Normand

@ncarbonneau
We are working this issue.
We hope we can fix it in this week.

@ncarbonneau @FSUPTC
Excel and browsers have different definitions of row height. The row height of Excel includes borders, but the row height of HTML should not include borders. So if there is a border, the picture will look smaller in the browser, but the actual size is the same as in Excel. So when we read html into Excel, the size is the same as before.
Remove this line htmlSaveOptions.setExportGridLines(true); and the position of the picture will be much better.

For this issue:
Changing the line height of the output to html will cause a series of problems. A more feasible method is to enlarge the size of the picture when outputting to html, but when Excel opens this file, it cannot get the same file as before.
Please share your points about this issue.

The team already tried that option, but the results are not good at all.
Please let us know about an ETA to have this issue resolved.
If you need more examples, let us know. We cannot claim to our customers that we can import from Excel if on the end result the objects are misplaced.

Thanks,
Normand

@FSUPTC
Please check dest.zip (479.1 KB)
with inner hot fixes 22.11.2.

About your inner hot fixes, where can i get it?

FYI, I removed the htmlSaveOptions.setExportGridLines(true); but the we can still see the position shifting and also some of the image distortion.

@FSUPTC,

The fix will be included in our upcoming release (Aspose.Cells v22.12) which is scheduled in the first half of December, 2022. You will also be notified when the next version is released. So, you may wait for the next (official) version to be released. But if you need the hot fix urgently, you may avail paid support. Please note, fixes are posted in paid support desk only. In normal support forums, we can only share the results tested by our (internal) fix for the users review once we fix the issue.