211 Star 1.4K Fork 518

GVPofdrw / ofdrw

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Col2Row1.java 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
Cliven 提交于 2023-11-27 19:28 . 补全了单元格相关文档
package org.ofdrw.layout.cases.cell;
import org.ofdrw.layout.OFDDoc;
import org.ofdrw.layout.element.Display;
import org.ofdrw.layout.element.canvas.Cell;
import org.ofdrw.layout.element.canvas.TextAlign;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* 一行两列的表单
*
* @author 权观宇
* @since 2023-11-27 18:51:30
*/
public class Col2Row1 {
public static void main(String[] args) throws IOException {
Path outP = Paths.get("cell-col2row1.ofd");
try (OFDDoc ofdDoc = new OFDDoc(outP)) {
Cell cell1 = new Cell(20d, 10d);
cell1.setBorder(0.353);
cell1.setTextAlign(TextAlign.center);
cell1.setPadding(1d, 3d, 1d, 3d);
cell1.setValue("名 称");
cell1.setFontSize(5d);
cell1.setDisplay(Display.inlineBlock);
cell1.setBackgroundColor("#CDD0D6");
Cell cell2 = new Cell(50d, 10d);
cell2.setBorder(0.353);
cell2.setTextAlign(TextAlign.center);
cell2.setPadding(1d, 3d, 1d, 3d);
cell2.setValue("OFD Reader & Writer");
cell2.setFontSize(5d);
cell2.setMarginLeft(-0.353);
cell2.setDisplay(Display.inlineBlock);
ofdDoc.add(cell1);
ofdDoc.add(cell2);
}
System.out.println(">> 生成文档位置:" + outP.toAbsolutePath());
}
}
Java
1
https://gitee.com/ofdrw/ofdrw.git
git@gitee.com:ofdrw/ofdrw.git
ofdrw
ofdrw
ofdrw
master

搜索帮助