3.10.0及后续版本支持水印添加

依赖引入

  1. <dependency>
  2. <groupId>org.apache.poi</groupId>
  3. <artifactId>ooxml-schemas</artifactId>
  4. <version>1.4</version>
  5. </dependency>

使用

  1. import com.github.liaochong.myexcel.utils.WatermarkUtil;
  2. List<ArtCrowd> dataList = this.getDataList();
  3. Workbook workbook = DefaultExcelBuilder.of(ArtCrowd.class).build(dataList);
  4. // 使用水印工具添加水印
  5. WatermarkUtil.addWatermark(workbook,"艺术生水印");
  6. AttachmentExportUtil.export(workbook, "艺术生信息", response);