|
@@ -0,0 +1,26 @@
|
|
|
|
+package com.rongwei.bscommon.sys.service.impl.commission;
|
|
|
|
+
|
|
|
|
+import com.aspose.words.*;
|
|
|
|
+import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
|
+import com.rongwei.rwcommoncomponent.excel.aspose.field.HandleMergeField4Heading;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+@Slf4j
|
|
|
|
+@Component
|
|
|
|
+public class CustHandleMergeField4Heading extends HandleMergeField4Heading {
|
|
|
|
+ @Override
|
|
|
|
+ public void handle(FieldMergingArgs args) {
|
|
|
|
+ super.handle(args);
|
|
|
|
+
|
|
|
|
+ final Object fieldValue = args.getFieldValue();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ DocumentBuilder builder = new DocumentBuilder(args.getDocument());
|
|
|
|
+ builder.insertHtml("<h1 style='text-align:left;font-family:Simsun;'>一级标题</h1>");
|
|
|
|
+// builder.insertHtml("<p></p>");
|
|
|
|
+ builder.insertHtml("<h2 style='text-align:left;font-family:Simsun;'>二级标题</h2>");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|