当前位置:网站首页>利用Poi-tl在word模板表格单元格内一次插入多张图片和多行单元格相同数据自动合并的功能组件
利用Poi-tl在word模板表格单元格内一次插入多张图片和多行单元格相同数据自动合并的功能组件
2022-07-29 05:09:00 【晶格点阵】
一、插入多张图片的方法
1)文档中提供的使用区块实现多张图片的插入
区块的使用:在word模板中使用:
{ {?images}}
{ {url}}
{ {/images}}
这样定义模板后,数据模型的结构如下:
data.put("items", new ArrayList<JSONObject>(){
{
add(new JSONObject().fluentPut("url", "图片链接1"));
add(new JSONObject().fluentPut("url", "图片链接2"));
add(new JSONObject().fluentPut("url", "图片链接3"));
}});上述图片链接也可以通过 Pictures.ofUrl().create() 构建 PictureRenderData 使用。
2)自定义插件实现多张图片的插入
按照方法插入多张图片时,必须使用对象的列表,也就是说必须在items列表添加包含url属性的对象;我们想让插入多张图变得更方便,使用'&'字符做为自定义插件的前缀。
插入多张图片的插件代码如下:
package com.fight.strive.sys.modules.poi_tl;
import com.deepoove.poi.data.PictureRenderData;
import com.deepoove.poi.policy.AbstractRenderPolicy;
imp边栏推荐
- With cloud simulation platform, Shichuang technology supports the upgrading of "China smart manufacturing"
- MySQL的基础概念+数据库系统结构+拓展延申+基础命令学习
- 阿里云架构师细说游戏行业九大趋势
- 递归的基本原理
- Helm chart for Kubernetes
- webgl1.0下texture2D和texture2DProj区别
- QML custom tabbar
- 365 day challenge leetcode 1000 questions - day 041 two point search completion anniversary + nth magic number + online election
- 分配内存:malloc()和free()
- 51万奖池邀你参战!第二届阿里云ECS CloudBuild开发者大赛来袭
猜你喜欢

【C语言系列】— 打印100~200之间的素数

重定向和文件

365 day challenge leetcode1000 question - distance between bus stops on day 038 + time-based key value storage + array closest to the target value after transforming the array and + maximum value at t

365天挑战LeetCode1000题——Day 035 每日一题 + 二分查找 13

QML type: mousearea

Occt learning 001 - Introduction

C语言 一级指针

牛客网编程题—【WY22 Fibonacci数列】和【替换空格】详解

Preemptive appointment | Alibaba cloud shadowless cloud application online conference appointment opens

关于局部变量
随机推荐
Allocate memory: malloc() and free()
365天挑战LeetCode1000题——Day 041 二分查找完结纪念 + 第 N 个神奇数字 + 在线选举
Differences between texture2d and texture2dproj under webgl1.0
365天挑战LeetCode1000题——Day 035 每日一题 + 二分查找 13
B - 识别浮点常量问题
省市区三级联动(简单又完美)
Occt learning 002 - environment construction
APP常用跨端技术栈深入分析
直播预告:京东云DevOps与JFrog制品库的融合
JD cloud golden autumn cloud special offer is in progress! Code scanning participation activities
数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录
365 day challenge leetcode1000 question - distance between bus stops on day 038 + time-based key value storage + array closest to the target value after transforming the array and + maximum value at t
力扣994:腐烂的橘子(BFS)
C语言文件操作
关于局部变量
如视技术副总裁杨永林:当传统产业遇到“数字空间”
Best practices for elastic computing in the game industry
Helm chart for Kubernetes
千人规模互联网公司研发效能成功之路
英伟达周锡健:设计到数字营销的最后一公里