Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the docx issue with the unset margin of the header-footer-container (#1547) #1552

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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