Broken convert json to html

  1. i have
    openjdk version “11.0.8” 2020-07-14
    OpenJDK Runtime Environment 18.9 (build 11.0.8+10)
    OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode, sharing)

  2. i use
    https://releases.aspose.com/java/repo/com/aspose/aspose-cells/23.9/aspose-cells-23.9.jar

  3. my code
    Workbook workbook = new Workbook(“/opt/scripts/convert/test.json”)
    HtmlSaveOptions options = new HtmlSaveOptions()
    workbook.save(“/opt/scripts/convert/test.html”, SaveFormat.HTML)

  4. json file

Сводка

[
{
BEFORE: ‘before cell’,
TEST: ‘asd1’,
AFTER: ‘after cell’
},
{
BEFORE: ‘before cell’,
TEST: ‘asd2’,
AFTER: ‘after cell’
},
{
BEFORE: ‘before cell’,
TEST: ‘asd3’,
AFTER: ‘after cell’
},
{
BEFORE: ‘before cell’,
TEST: ‘asd4’,
AFTER: ‘after cell’
}
]

  1. html file
Сводка

This page uses frames, but your browser doesn't support them.

  1. test_files directory
    test_files.zip (4.0 КБ)

if perform the conversion on the site

then it runs successfully

Сводка
BEFORE TEST AFTER
before cell asd1 after cell
before cell asd2 after cell
before cell asd3 after cell
before cell asd4 after cell

@dmitry6287,
By using the latest version for testing, we can obtain the correct results. Please refer to the attachment (6.4 KB).

The sample code as follows:

Workbook workbook = new Workbook(filePath + "test.json");
HtmlSaveOptions options = new HtmlSaveOptions();
workbook.save(filePath + "out_java.html", options);

By reviewing the file you provided, we have found that there is already correct data in it. It’s just that your compressed package doesn’t contain the main file “test.html”.

 <tr height='17' style='mso-height-source:userset;height:12.75pt'>
<td height='17' width='74' style='height:12.75pt;width:55.5pt;'>BEFORE</td>
<td width='41' style='width:30.75pt;'>TEST</td>
<td width='63' style='width:47.25pt;'>AFTER</td>
 </tr>
 <tr height='17' style='mso-height-source:userset;height:12.75pt'>
<td height='17' style='height:12.75pt;'>before cell</td>
<td>asd1</td>
<td>after cell</td>
 </tr>
 <tr height='17' style='mso-height-source:userset;height:12.75pt'>
<td height='17' style='height:12.75pt;'>before cell</td>
<td>asd2</td>
<td>after cell</td>
 </tr>
 <tr height='17' style='mso-height-source:userset;height:12.75pt'>
<td height='17' style='height:12.75pt;'>before cell</td>
<td>asd3</td>
<td>after cell</td>
 </tr>
 <tr height='17' style='mso-height-source:userset;height:12.75pt'>
<td height='17' style='height:12.75pt;'>before cell</td>
<td>asd4</td>
<td>after cell</td>
 </tr>

It’s just that your compressed package doesn’t contain the main file “test.html”

here is the file
test.zip (3.0 КБ)
the problem is related to him

@dmitry6287,
After decompression, I can open and view the HTML file correctly. Please refer to the attachment (3.9 KB).

Would you like to take screenshots and clearly indicate the issue?

This option helped me

HtmlSaveOptions saveOptions = new HtmlSaveOptions(SaveFormat.HTML);
saveOptions.setSaveAsSingleFile(true);

@dmitry6287,

It seems you have sorted out your issue, correct me if if I am wrong?
Feel free to write us back if you have queries or issue.

Yes that’s right. Thank you, the issue can be closed

@dmitry6287,

You are welcome.