Hello,
we use Apose.Cells 25.11 and Aspose.Word 25.11.
We have an Excel File that contains a print area with cells with rotate text.
When we extract this area as html and we try to insert it into a Word document using DocumentBuilder.insertHtml, the text rotation is lost.
The html file extracted from Excel keep the text rotation.
Could you help me to understand if it is possible keep the text rotation, please?
We attach a zip file contains the follow files:
- IDS-4810.xlsx (file excel where you find the text rotation)
- test-aspose-tabella.html (print area extracted from Excel file)
- InsertTableFromHtmlIntoDocumentTest.java (launch the unit test named insertTableFromHtmlIntoDocumentTestForVerticalHeader to reproduce the case
- result1.docx (the result)
Many thanks,
Giulio
@giulio.andolfi
What we see
- You extract a print‑area from Excel as HTML (the HTML keeps the rotated text).
- When the same HTML is inserted into a Word document with
DocumentBuilder.insertHtml, the rotation disappears.
- The same behaviour is reported in the Aspose .Words forum (CSS
writing‑mode: vertical‑lr is not applied after insertHtml).
Current limitation
DocumentBuilder.insertHtml parses only a subset of CSS.
Text‑direction/rotation styles such as writing-mode, transform: rotate(...), or the Excel‑specific <x:Rotate> are not supported by Aspose.Words 25.11. Consequently the HTML that contains those styles is rendered in Word without rotation.
Possible work‑arounds
-
Apply rotation after insertion – once the table is in the document, set the cell/paragraph direction programmatically:
Table table = (Table)doc.getFirstSection().getBody().getChild(NodeType.TABLE, 0, true);
for (Cell cell : (Iterable<Cell>)table.getRows().get(0).getCells()) {
cell.getCellFormat().setTextDirection(TextDirection.VERTICAL);
}
(Use the appropriate API for the language you are working in.)
-
Convert rotated cells to images before inserting the HTML, then embed the images in the table.
-
Create the table directly with Aspose.Words APIs and set the TextDirection/RotationAngle on the required cells instead of relying on HTML.
What to try next
- Verify the HTML you are feeding to
insertHtml contains the writing-mode (or transform) style.
- Run a minimal repro (a single cell with
style="writing-mode:vertical-lr"). If the rotation is still lost, it confirms the limitation.
- If you need the rotation preserved, choose one of the work‑arounds above.
Bottom line
At present Aspose.Words does not retain text rotation defined via CSS when importing HTML with DocumentBuilder.insertHtml. The rotation must be applied manually after insertion or handled as an image. If you need further assistance building the manual rotation code for your specific language, let us know.
@giulio.andolfi Could you please attach a simple problematic input HTML here for testing? We will check the issue and provide you more information.
Sorry, I forgot the attach file.
Thanks
Giulio
IDS-4810.zip (25.8 KB)
@giulio.andolfi
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28892
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
By the way, MS Word also does not preserve text direction in the provided HTML.
Perfect, many thanks @alexey.noskov.
We will follow the release notes to understand when the bug will be released.
1 Like