(1)Source code for testing API :
Workbook workbook = new Workbook(“C://test_cell_rotation.xlsx”);
WorksheetCollection worksheetCollection= workbook.getWorksheets();
Worksheet worksheet = worksheetCollection.get(“Sheet1”);
Cells cells =worksheet.getCells();
Cell cellA = cells.get(1,0);
String cellAString = cellA.getStringValue(); // Return “First Name”
int rotationAngleCellA = cellA.getStyle().getRotationAngle(); // Return “45”
Cell cellB = cells.get(1,1);
String cellBString = cellB.getStringValue(); //Return “Last Name”
int rotationAngleCellB = cellB.getStyle().getRotationAngle(); // return “-45”
Cell cellC = cells.get(1,2);
String cellCString = cellC.getStringValue(); // Return “Country”
String cellCHtmlString = cellC.getHtmlString(); // does not contain any line break which is not correct
a. test_cell_rotation.xlsx — Original xlsx
b. convertXlsx_html_Aspose.html ---- output for calling the following code
Workbook workbook = new Workbook("C://test_cell_rotation.xlsx");
//Create HtmlSaveOptions object
HtmlSaveOptions options = new HtmlSaveOptions();
//Set the Presenation preference option
options.PresentationPreference = true;
//Save the Excel file to HTML with specified option
copy the source code from “convertXlsx_html_Aspose.html”,
highlight in “RED” to show you the rotation angle and line break string
Our product calling API (see (1) sample code) to construct html, you could see the html
in this file, highlight in “RED” to show you the rotation angle.
e. Screenshot showing original file and Our product show the “d” aboved in WebUI.
If you see the “RED” in files, you will see “Aspose convert XLSX to html correctly , knowing
the rotation of A1 cell containing First Name as -45 degrees, and if open html, all
look exact the same as original xlsx”, However, “Aspose API” return differently, if
we call API directly, construct the html, we could not get the same result as original file.
test_rotation.zip (226.6 KB)
Thanks for help!