|
@@ -1418,59 +1418,6 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
|
builder.writeln(content);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 生成文件目录
|
|
|
- */
|
|
|
- private void generateDirectory(DocumentBuilder builder, Document doc) throws Exception {
|
|
|
- Node catalogueNode = doc.getSections().get(0).getBody().getChild(NodeType.PARAGRAPH, 0, true);
|
|
|
- builder.moveTo(catalogueNode);
|
|
|
- //插入分页符
|
|
|
- builder.insertParagraph();
|
|
|
- builder.getCurrentParagraph().getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
|
|
|
- //清除所有样式设置
|
|
|
- builder.getParagraphFormat().clearFormatting();
|
|
|
- //目录居左
|
|
|
- builder.getParagraphFormat().setAlignment(ParagraphAlignment.LEFT);
|
|
|
- //插入目录,这是固定的
|
|
|
- builder.insertTableOfContents("\\o \"1-3\" \\h \\z \\u");
|
|
|
-// //插入分页符
|
|
|
-// builder.insertBreak(com.aspose.words.BreakType.PAGE_BREAK);
|
|
|
- // 更新域
|
|
|
- doc.updateFields();
|
|
|
- //TOC_1:大类 TOC_2:小类 TOC_2:问题标题
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_1).getFont().setSize(12);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_1).getFont().setBold(true);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_1).getFont().setName("仿宋");
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_1).getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_1).getParagraphFormat().setLineSpacingRule(LineSpacingRule.EXACTLY);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_1).getParagraphFormat().setLineSpacing(18);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_2).getFont().setSize(12);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_2).getFont().setName("仿宋");
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_2).getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_2).getParagraphFormat().setLineSpacingRule(LineSpacingRule.EXACTLY);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_2).getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_2).getParagraphFormat().setLineSpacing(18);
|
|
|
-
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_3).getFont().setSize(12);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_3).getFont().setName("仿宋");
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_3).getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_3).getParagraphFormat().setLineSpacingRule(LineSpacingRule.EXACTLY);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_3).getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
|
|
|
- doc.getStyles().getByStyleIdentifier(StyleIdentifier.TOC_3).getParagraphFormat().setLineSpacing(18);
|
|
|
- // 目录字体样式变更后再次更新域
|
|
|
- doc.updateFields();
|
|
|
- com.aspose.words.Paragraph firstParagraph = doc.getSections().get(1).getBody().getFirstParagraph();
|
|
|
- for (int i = 0; i < firstParagraph.getRuns().getCount(); i++) {
|
|
|
- //获取段落里面的文本片段,删除换页符
|
|
|
- Run run = firstParagraph.getRuns().get(i);
|
|
|
- if ("\f".equals(run.getText())) {
|
|
|
- run.remove();
|
|
|
- }
|
|
|
- }
|
|
|
- //改动目录的相关内容都得更新目录域
|
|
|
- doc.updateFields();
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public R wordExportStandard(Map<String, Object> map, HttpServletResponse response) throws Exception {
|
|
|
// a2ccde8da9ec485f83650b75429f0e78
|