尝试修改word对齐方式

dev
a15234804788@163.com 3 years ago
parent b529a4498e
commit 33f2786c74
  1. 8
      lab-service/lab-lims/src/main/java/org/springblade/lims/service/impl/EntrustServiceImpl.java

@ -2942,14 +2942,22 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
/** ------------------尝试修改对齐方式 start ----------------------------**/ /** ------------------尝试修改对齐方式 start ----------------------------**/
XWPFTable xwpfTable = doc.getTables().get(1);//获取第几个表格,从0开始 XWPFTable xwpfTable = doc.getTables().get(1);//获取第几个表格,从0开始
XWPFTableRow row = xwpfTable.getRow(2);//获取表格的数据行 XWPFTableRow row = xwpfTable.getRow(2);//获取表格的数据行
XWPFTableCell cell11 = row.getCell(1);
XWPFTableCell cell1 = row.getCell(2); XWPFTableCell cell1 = row.getCell(2);
XWPFTableCell cell22 = row.getCell(4);
XWPFTableCell cell2 = row.getCell(5); XWPFTableCell cell2 = row.getCell(5);
XWPFParagraph sourcePara1 = cell1.getParagraphs().get(0);//获取每一行 XWPFParagraph sourcePara1 = cell1.getParagraphs().get(0);//获取每一行
XWPFParagraph sourcePara11 = cell11.getParagraphs().get(0);
sourcePara11.setAlignment(StringUtils.equals("阳性",sourcePara1.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT );
sourcePara1.setAlignment(StringUtils.equals("阳性",sourcePara1.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT ); sourcePara1.setAlignment(StringUtils.equals("阳性",sourcePara1.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT );
XWPFParagraph sourcePara2 = cell2.getParagraphs().get(0);//获取每一行 XWPFParagraph sourcePara2 = cell2.getParagraphs().get(0);//获取每一行
XWPFParagraph sourcePara22 = cell22.getParagraphs().get(0);
sourcePara2.setAlignment(StringUtils.equals("阳性",sourcePara2.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT ); sourcePara2.setAlignment(StringUtils.equals("阳性",sourcePara2.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT );
sourcePara22.setAlignment(StringUtils.equals("阳性",sourcePara2.getText()) ? ParagraphAlignment.LEFT : ParagraphAlignment.RIGHT );
/** ------------------尝试修改对齐方式 end ------------------------------**/ /** ------------------尝试修改对齐方式 end ------------------------------**/
// fos = new FileOutputStream("C://Users//AAA//Desktop//shuojin//dayin//检测报告2.docx"); // fos = new FileOutputStream("C://Users//AAA//Desktop//shuojin//dayin//检测报告2.docx");

Loading…
Cancel
Save