English 中文(简体)
用Patricia Poi 3.17制作文字文件,同时制作桌子,如果桌子在步行前结束,则会再制造一个空白页?
原标题:Creating word document with Apache Poi 3.17, while creating table if table row ends just before the footer, it is creating another blank page?

I am using Apache POI version 3.17 and want to stick with that version only, due to some other dependency of the application. Table data is dynamic and I can t fix the row height, sometimes when table s last row ends near the footer, it is creating a separate blank page. Could anyone please help me out how to tackle this scenario?

“enter像

I prefer to prevent the creation of empty pages.

最佳回答

我找到了解决这一问题的办法。 之所以出现这一问题,是因为微软Word在表末自动增加一段。 这种行为造成一个空白页,因为自动增加的段落,表行到一页末和超支。

https://www.technewstoday.com/page-wont-delete-in-word/#:~:text=Since%20Word%20automatic%20adds%20a, paragraph%20marker%20 that%20Word%20inserted

为了在《语言》文件中以人工方式解决这一问题,我采取了以下步骤:

Click on the "Home" tab. Right-click in front of the paragraph marker at the end of the table. Choose the "Paragraph" option from the context menu. In the "Indents and Spacing" tab, set "Before" and "After" fields to 0pt under the "Spacing" section. Set the line spacing to "Exactly" and the "At" value to 0.7pt (minimum).

之后,我采用类似的方案解决办法,使用XWPF文件实例和Apache POI图书馆。 这里我是如何做的:

XWPFParagraph preventBlankPage = document.createParagraph();
preventBlankPage.setSpacingAfter(0);
preventBlankPage.setSpacingBefore(0);
preventBlankPage.setSpacingBetween(0.1, LineSpacingRule.EXACT);

通过在创建表格之后添加一个空段落,然后将段落前后的间隔时间定为0pt,以及按照“实际上”的行距计算在0.1至0.1之间,我得以防止文件申请增加一个额外的空白页。

This approach ensures that the table s layout remains consistent and avoids the appearance of unnecessary blank pages in the document.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签