refactor(generateDocx):调整文档生成框架,生成模块完成
This commit is contained in:
parent
14bd36e714
commit
c9e660af13
@ -8,9 +8,12 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Ding
|
||||
*/
|
||||
public class generateDocx {
|
||||
void generateSpider4(List<Map<String, Object>> rawData) {
|
||||
String resource = "src/main/resources/docxTemplate/spiderFourModel.docx";
|
||||
String resource = "src/main/resources/docxTemplate/model.docx";
|
||||
String target = "src/main/resources/docxTemplate/resultDocx.docx";
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
|
@ -3,6 +3,10 @@ package com.zsc.edu.dify.framework.generateDocx.styleConfig;
|
||||
import com.deepoove.poi.data.style.Style;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description 创建特定样式
|
||||
* @author Ding
|
||||
*/
|
||||
@Data
|
||||
public class labelStyles {
|
||||
private final Style titleStyle;
|
||||
@ -18,7 +22,7 @@ public class labelStyles {
|
||||
public static labelStyles createDefault() {
|
||||
Style titleStyle = new Style();
|
||||
titleStyle.setBold(true);
|
||||
titleStyle.setFontSize(11);
|
||||
titleStyle.setFontSize(20);
|
||||
|
||||
Style textStyle = new Style();
|
||||
textStyle.setFontSize(11);
|
||||
|
@ -1,20 +0,0 @@
|
||||
package com.zsc.edu.dify.framework.generateDocx.styleConfig;
|
||||
|
||||
import com.deepoove.poi.data.style.ParagraphStyle;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class paragraphStylesTesting {
|
||||
private final ParagraphStyle commonParagraphStyles;
|
||||
|
||||
private paragraphStylesTesting(ParagraphStyle commonParagraphStyles) {
|
||||
this.commonParagraphStyles = commonParagraphStyles;
|
||||
}
|
||||
|
||||
public static paragraphStylesTesting createDefault() {
|
||||
ParagraphStyle paragraphStyle = new ParagraphStyle();
|
||||
paragraphStyle.setSpacing(1.0);
|
||||
return new paragraphStylesTesting(paragraphStyle);
|
||||
}
|
||||
|
||||
}
|
@ -10,6 +10,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @description 用于将样式与字段绑定
|
||||
* @author Ding
|
||||
*/
|
||||
public class styleDataWrapper {
|
||||
static labelStyles styles = labelStyles.createDefault();
|
||||
|
||||
@ -31,10 +36,6 @@ public class styleDataWrapper {
|
||||
rawMap.forEach((key, value) -> {
|
||||
Style style = STYLE_MAPPING.getOrDefault(key, STYLE_MAPPING.get("*"));
|
||||
TextRenderData textRenderData = new TextRenderData(value.toString(), style);
|
||||
|
||||
// ParagraphRenderData paragraph = Paragraphs.of(textRenderData).create();
|
||||
// paragraph.setParagraphStyle(paragraphStylesTesting.createDefault().getCommonParagraphStyles());
|
||||
|
||||
styledMap.put(key, textRenderData);
|
||||
});
|
||||
return styledMap;
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user