Skip to content

Commit

Permalink
Fix the docx issue with the unset margin of the header-footer-contain…
Browse files Browse the repository at this point in the history
  • Loading branch information
speckyspooky authored Jan 25, 2024
1 parent fa95ec0 commit f32bef1
Showing 1 changed file with 23 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,28 +306,32 @@ public void startTable(IStyle style, int tablewidth, boolean inForeign) {
writeAlign(style.getTextAlign(), style.getDirection());
}
if (inForeign) {
writer.openTag("w:tblCellMar");
writer.openTag("w:top");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:top");
writer.openTag("w:left");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:left");
writer.openTag("w:bottom");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:bottom");
writer.openTag("w:right");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:right");
writer.closeTag("w:tblCellMar");
writeTableCellMarginZero();
}
writer.closeTag("w:tblPr");
}

private void writeTableCellMarginZero() {
writer.openTag("w:tblCellMar");
writer.openTag("w:top");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:top");
writer.openTag("w:left");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:left");
writer.openTag("w:bottom");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:bottom");
writer.openTag("w:right");
writer.attribute("w:w", 0);
writer.attribute("w:type", "dxa");
writer.closeTag("w:right");
writer.closeTag("w:tblCellMar");
}

private void writeTableBorders(IStyle style) {
writer.openTag("w:tblBorders");
writeBorders(style, 0, 0, 0, 0);
Expand Down Expand Up @@ -1377,6 +1381,7 @@ protected void startHeaderFooterContainer(int headerHeight, int headerWidth, boo
writer.openTag("w:tblPr");
writeTableWidth(headerWidth);
writeAttrTag("w:tblLook", "01E0");
writeTableCellMarginZero();
writeTableLayout();
writer.closeTag("w:tblPr");
if (writeColumns) {
Expand Down

0 comments on commit f32bef1

Please sign in to comment.