XWPFTableRow.setHeight(int height)
https://poi.apache.org/apidocs/org/apache/poi/xwpf/usermodel/XWPFTableRow.html#setHeight%28int%29适合我.
高度必须以缇(英制点的二十分之一)设置.
但是,如果要将行高减小到默认行高以下(这取决于字体大小),则必须设置w:hRule =“exact”.这只能使用底层对象并在类路径中具有ooxml-schemas-1.3.jar,如https://poi.apache.org/faq.html#faq-N10025中所述.
例:
import java.io.File;
import java.io.FileOutputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule;
/*
To
org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule;
the fully ooxml-schemas-1.3.jar is needed as mentioned in https://poi.apache.org/faq.html#faq-N10025
*/
public class CreateTable
{ </