Why appended

…xin chào… :))

With nodes like shapes and fields

@linh.nv Could you please attach your sample input document here for testing? We will check the issue and provide you more information.
Also, you should note that Cell.getCellFormat().getWidth() not always contains the actual width value. You can try using LayoutCollector and LayoutEnumerator to calculate actual cell width. For example the following code calculate width of the cell:

Document doc = new Document("C:\\Temp\\in.docx");
LayoutCollector collector = new LayoutCollector(doc);
LayoutEnumerator enumerator = new LayoutEnumerator(doc);

// Get cells
Iterable<Cell> cells = doc.getChildNodes(NodeType.CELL, true);
for (Cell cell : cells)
{
    // Move enumerator to cell
    enumerator.setCurrent(collector.getEntity(cell.getFirstParagraph()));
    while (enumerator.getType() != LayoutEntityType.CELL)
        enumerator.moveParent();

    // Get bounding box of the cell
    Rectangle2D rect = enumerator.getRectangle();
    System.out.println("Page: " + enumerator.getPageIndex() + "\tX=" + rect.getX() + "; Y=" + rect.getY() + "; Width=" + rect.getWidth() + "; Height=" + rect.getHeight());
}
1 Like

@alexey.noskov I want to

@linh.nv OfficeMath is not fixed size object. To calculate it’s actual size it is required to build it’s layout. So Cell.getCellFormat().getWidth() does not give you an accurate value.

1 Like

@alexey.noskov Do you ha

@linh.nv I am afraid there is no other way. When you open document in MS Word, it build document layout, so width of the cell is adjusted appropriately.