gpt4 book ai didi

java - 在单词表中显示单独的水平线

转载 作者:行者123 更新时间:2023-12-02 12:20:18 24 4
gpt4 key购买 nike

我正在尝试显示 Apache-POI 中表中特定行的水平线。使用表格,我可以显示所有水平线,但是当我转到特定行时,我看不到如何操作。我使用 getTable 但它再次适用于整个表:(

有人可以帮我解决这个问题吗?

        XWPFTableRow tableRow = table.createRow();
tableRow.getTable().setInsideHBorder(XWPFBorderType.SINGLE,10, 5, "1C7331");

for (int col=0; col<3; col++){
tableCell = tableRow.getCell(col);
tableCell.removeParagraph(0);
textCell = tableCell.addParagraph();
textCell.setAlignment(ParagraphAlignment.LEFT);
textCell.setIndentFromLeft(50);
run= textCell.createRun();
run.setBold(true);
switch(col){
case 0: run.setText(plantingDate);
break;
case 1: run.setBold(false);
run.setText(sampleName);
break;
case 2: run.setBold(false);
run.setText(sample.getCount());
break;
}
}

最佳答案

我不完全确定您要绘制哪些线条,但向单元格添加边框的典型方法是

textCell.setBorderBottom(Borders.NONE);

对于没有线路和 - 例如 -

textCell.setBorderBottom(Borders.BASIC_WIDE_MIDLINE);

一行。

您还可以像这样设置左右边框。这有帮助吗?

关于java - 在单词表中显示单独的水平线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45834468/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com