public class TableUtil extends Object
Constructor and Description |
---|
TableUtil() |
Modifier and Type | Method and Description |
---|---|
static org.apache.poi.xwpf.usermodel.XWPFTable |
createTable(org.apache.poi.xwpf.usermodel.XWPFDocument doc)
创建空表,只有一行
|
static org.apache.poi.xwpf.usermodel.XWPFTable |
createTable(org.apache.poi.xwpf.usermodel.XWPFDocument doc,
Iterable<?> data)
创建表格并填充数据,默认表格
|
static org.apache.poi.xwpf.usermodel.XWPFTableCell |
getOrCreateCell(org.apache.poi.xwpf.usermodel.XWPFTableRow row,
int index)
获取或创建新单元格
存在则直接返回,不存在创建新的单元格 |
static org.apache.poi.xwpf.usermodel.XWPFTableRow |
getOrCreateRow(org.apache.poi.xwpf.usermodel.XWPFTable table,
int index)
获取或创建新行
存在则直接返回,不存在创建新的行 |
static void |
writeRow(org.apache.poi.xwpf.usermodel.XWPFTableRow row,
Iterable<?> rowData)
写行数据
|
static void |
writeRow(org.apache.poi.xwpf.usermodel.XWPFTableRow row,
Map<?,?> rowMap,
boolean isWriteKeyAsHead)
写行数据
|
static void |
writeRow(org.apache.poi.xwpf.usermodel.XWPFTableRow row,
Object rowBean,
boolean isWriteKeyAsHead)
写一行数据
|
static org.apache.poi.xwpf.usermodel.XWPFTable |
writeTable(org.apache.poi.xwpf.usermodel.XWPFTable table,
Iterable<?> data)
为table填充数据
|
public static org.apache.poi.xwpf.usermodel.XWPFTable createTable(org.apache.poi.xwpf.usermodel.XWPFDocument doc)
doc
- XWPFDocument
XWPFTable
public static org.apache.poi.xwpf.usermodel.XWPFTable createTable(org.apache.poi.xwpf.usermodel.XWPFDocument doc, Iterable<?> data)
doc
- XWPFDocument
data
- 数据XWPFTable
public static org.apache.poi.xwpf.usermodel.XWPFTable writeTable(org.apache.poi.xwpf.usermodel.XWPFTable table, Iterable<?> data)
table
- XWPFTable
data
- 数据XWPFTable
public static void writeRow(org.apache.poi.xwpf.usermodel.XWPFTableRow row, Object rowBean, boolean isWriteKeyAsHead)
row
- 行rowBean
- 行数据isWriteKeyAsHead
- 如果为Map或者Bean,是否写标题public static void writeRow(org.apache.poi.xwpf.usermodel.XWPFTableRow row, Map<?,?> rowMap, boolean isWriteKeyAsHead)
row
- 行rowMap
- 行数据isWriteKeyAsHead
- 是否写标题public static void writeRow(org.apache.poi.xwpf.usermodel.XWPFTableRow row, Iterable<?> rowData)
row
- 行rowData
- 行数据public static org.apache.poi.xwpf.usermodel.XWPFTableRow getOrCreateRow(org.apache.poi.xwpf.usermodel.XWPFTable table, int index)
table
- XWPFTable
index
- 索引(行号),从0开始XWPFTableRow
public static org.apache.poi.xwpf.usermodel.XWPFTableCell getOrCreateCell(org.apache.poi.xwpf.usermodel.XWPFTableRow row, int index)
row
- XWPFTableRow
行index
- index 索引(列号),从0开始XWPFTableCell
Copyright © 2024. All rights reserved.