When exporting the following html content to a cell, the content is not being exported correctly.
HTML content:
test
test1
test2
test3
test4
Expected result:
test
test1
test2
test3
test4
Actual result
test
test1
test2
test3
test4
Please let me know you comments.
Thanks.
Gerardo
@gguardlz
Thanks for using Aspose APIs.
Please use the following code with the most recent version and it works fine and generates the correct results. Please see the output Excel file generated by the code and screenshot for a reference.
Download Link:
Cells-output.zip (5.6 KB)
Java
//Create the empty workbook
Workbook wb = new Workbook();
//Access the first worksheet
Worksheet ws = wb.getWorksheets().get(0);
//Sample string to be inserted
String str = "test\n test1\n test2\n test3\n test4";
//Access cell B7
Cell b7 = ws.getCells().get("B7");
//Put the string in cell B7
b7.putValue(str);
//Wrap the cell text
Style st = b7.getStyle();
st.setTextWrapped(true);
b7.setStyle(st);
//Set the column width
ws.getCells().setColumnWidth(b7.getColumn(), 14);
//Save the workbook
wb.save(dirPath + "output.xlsx");
Screenshot: