I am using Aspose cell java API to convert XLSX file to HTML
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>21.6</version>
</dependency>
I tried this by two different ways.
First Method (Failing)
File file = new File("path/to/file/TestAspose.xlsx");
ByteArrayInputStream in = new ByteArrayInputStream(FileUtils.readFileToByteArray(file));
ByteArrayOutputStream out = new ByteArrayOutputStream();
Workbook workbook = new Workbook(in);
HtmlSaveOptions options = new HtmlSaveOptions();
options.setPresentationPreference(true);
workbook.save(out, options);
FileOutputStream fout = new FileOutputStream("TestAspose.html");
fout.write(out.toByteArray());
fout.flush();
This is what I can see when I open the converted file(.html) open in the chrome browser.
Second Method (Succeeded)
File file = new File("path/to/file/TestAspose.xlsx");
ByteArrayInputStream in = new ByteArrayInputStream(FileUtils.readFileToByteArray(file));
ByteArrayOutputStream out = new ByteArrayOutputStream();
Workbook workbook = new Workbook(in);
HtmlSaveOptions options = new HtmlSaveOptions();
options.setPresentationPreference(true);
workbook.save("TestAsposeWorking.html", options);
Both cases can convert the file without any error but first way the converted file not loading properly and in second case can load the generated html in the browser without any issue. But I need to use first way save method to do the task. Here I have attached the different of these generated files as a screenshot.
(in image Second Method Result Left & First Method Result Right)
Appreciate if anyone can explain what is the issue in my code in first way.
OS : Ubuntu 20.4
Java Version : openjdk version “1.8.0_282”
Maven Version : Apache Maven 3.6.3