-
Notifications
You must be signed in to change notification settings - Fork 375
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
Apache POI document to PDF with table borders creates PDF with texts in cells positioned too low in the cells #640
Comments
Any contribution are welcome! |
I do not know what to do. I am here because I do not know. It is your repository so fix it. |
|
@xdx2599 Yes, that is the same that I get with English letters and numbers. Have tried to lift the content up in the cells, but it does not seem to work. |
Let me tell you, baby. You can use POI to set the after property to avoid this situation. In the current situation where the author does not have the energy to maintain it, this should be the most appropriate method. Adding more water is necessary. I hope you can understand what I mean ,(让我来告诉你吧 宝贝 你可以使用poi设置after属性来避免这种情况 在如今作者没有精力去维护的情况下 这应该是最合适的方法 面多了加水 我希望你能明白我的意思) |
----- 原始邮件 -----
发件人:Adriansun ***@***.***>
收件人:opensagres/xdocreport ***@***.***>
抄送人:xdx2599 ***@***.***>, Mention ***@***.***>
主题:Re: [opensagres/xdocreport] Apache POI document to PDF with table borders creates PDF with texts in cells positioned too low in the cells (Issue #640)
日期:2024年05月11日 01点09分
@xdx2599 Yes, that is the same that I get with English letters and numbers. Have tried to lift the content up in the cells, but it does not seem to work.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
Message ID: ***@***.***>
|
NiceXWPFDocument xwpfDocument = template.getXWPFDocument(); |
3Q 我也是用的同样的方法解决的
----- 原始邮件 -----
发件人:良良 陈 ***@***.***>
收件人:opensagres/xdocreport ***@***.***>
抄送人:xdx2599 ***@***.***>, Mention ***@***.***>
主题:Re: [opensagres/xdocreport] Apache POI document to PDF with table borders creates PDF with texts in cells positioned too low in the cells (Issue #640)
日期:2024年05月29日 09点39分
…----- 原始邮件 ----- 发件人:Adriansun @.> 收件人:opensagres/xdocreport @.> 抄送人:xdx2599 @.>, Mention @.> 主题:Re: [opensagres/xdocreport] Apache POI document to PDF with table borders creates PDF with texts in cells positioned too low in the cells (Issue #640) 日期:2024年05月11日 01点09分 @xdx2599 Yes, that is the same that I get with English letters and numbers. Have tried to lift the content up in the cells, but it does not seem to work. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned. Message ID: @.***>
NiceXWPFDocument xwpfDocument = template.getXWPFDocument();
for (int tableNum = 0; tableNum < xwpfDocument.getTables().size(); tableNum++) {
if (tableNum == 0) continue;
XWPFTable xwpfTable = xwpfDocument.getTables().get(tableNum);
xwpfTable.getRows()
.forEach(row -> {
row.getTableCells().forEach( cell -> {
cell.getParagraphs().forEach(xwpfParagraph -> {
CTP ctp = xwpfParagraph.getCTP();
CTPPr ppr = ctp.isSetPPr() ? ctp.getPPr() : ctp.addNewPPr();
CTSpacing spacing = ppr.isSetSpacing()? ppr.getSpacing() : ppr.addNewSpacing();
spacing.setAfter(BigInteger.valueOf(40));
spacing.setBefore(BigInteger.valueOf(0));
spacing.setLineRule(lineRule);
spacing.setLine(BigInteger.valueOf(lineSpacing));
});
});
});
};
it is my code it help me solve this problem,you can try it
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Doing a convert from Apache POI document to a PDF document will result that the texts in the cells in tables are lower than the bottom border, even though in the original .dotx document that Apache POI use has cells with texts in the upper left corner. Using other things to update a document and saving the POI object to .dotx and .docx will result in good cells. It is just about converting the object to PDF that makes the cells not being in line with the original object. Is there a default position for cells when converting? Center center would be enough. Right now it looks wonky.
The text was updated successfully, but these errors were encountered: