public class Word07Writer extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
protected File |
destFile
目标文件
|
protected boolean |
isClosed
是否被关闭
|
Constructor and Description |
---|
Word07Writer() |
Word07Writer(File destFile)
构造
|
Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc)
构造
|
Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc,
File destFile)
构造
|
Modifier and Type | Method and Description |
---|---|
Word07Writer |
addPicture(File picFile,
int width,
int height)
增加图片,单独成段落
|
Word07Writer |
addPicture(InputStream in,
PicType picType,
String fileName,
int width,
int height)
增加图片,单独成段落,增加后图片流关闭,默认居中对齐
|
Word07Writer |
addPicture(InputStream in,
PicType picType,
String fileName,
int width,
int height,
org.apache.poi.xwpf.usermodel.ParagraphAlignment align)
增加图片,单独成段落,增加后图片流关闭
|
Word07Writer |
addTable(Iterable<?> data)
增加表格数据
|
Word07Writer |
addText(Font font,
String... texts)
增加一个段落
|
Word07Writer |
addText(org.apache.poi.xwpf.usermodel.ParagraphAlignment align,
Font font,
String... texts)
增加一个段落
|
void |
close()
关闭Word文档
如果用户设定了目标文件,先写出目标文件后给关闭工作簿 |
protected void |
closeWithoutFlush()
关闭Word文档但是不写出
|
Word07Writer |
flush()
将Excel Workbook刷出到预定义的文件
如果用户未自定义输出的文件,将抛出 NullPointerException 预定义文件可以通过 setDestFile(File) 方法预定义,或者通过构造定义 |
Word07Writer |
flush(File destFile)
将Excel Workbook刷出到文件
如果用户未自定义输出的文件,将抛出 NullPointerException |
Word07Writer |
flush(OutputStream out)
将Word Workbook刷出到输出流
|
Word07Writer |
flush(OutputStream out,
boolean isCloseOut)
将Word Document刷出到输出流
|
org.apache.poi.xwpf.usermodel.XWPFDocument |
getDoc()
获取
XWPFDocument |
Word07Writer |
setDestFile(File destFile)
设置写出的目标文件
|
protected File destFile
protected boolean isClosed
public Word07Writer()
public Word07Writer(File destFile)
destFile
- 写出的文件public Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc)
doc
- XWPFDocument
public Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc, File destFile)
doc
- XWPFDocument
destFile
- 写出的文件public org.apache.poi.xwpf.usermodel.XWPFDocument getDoc()
XWPFDocument
XWPFDocument
public Word07Writer setDestFile(File destFile)
destFile
- 目标文件public Word07Writer addText(Font font, String... texts)
font
- 字体信息Font
texts
- 段落中的文本,支持多个文本作为一个段落public Word07Writer addText(org.apache.poi.xwpf.usermodel.ParagraphAlignment align, Font font, String... texts)
align
- 段落对齐方式ParagraphAlignment
font
- 字体信息Font
texts
- 段落中的文本,支持多个文本作为一个段落public Word07Writer addTable(Iterable<?> data)
data
- 表格数据,多行数据。元素表示一行数据,当为集合或者数组时,为一行;当为Map或者Bean时key表示标题,values为数据TableUtil.createTable(XWPFDocument, Iterable)
public Word07Writer addPicture(File picFile, int width, int height)
picFile
- 图片文件width
- 宽度height
- 高度public Word07Writer addPicture(InputStream in, PicType picType, String fileName, int width, int height)
in
- 图片流picType
- 图片类型,见Document.PICTURE_TYPE_XXXfileName
- 文件名width
- 宽度height
- 高度public Word07Writer addPicture(InputStream in, PicType picType, String fileName, int width, int height, org.apache.poi.xwpf.usermodel.ParagraphAlignment align)
in
- 图片流picType
- 图片类型,见Document.PICTURE_TYPE_XXXfileName
- 文件名width
- 宽度height
- 高度align
- 图片的对齐方式public Word07Writer flush() throws IORuntimeException
NullPointerException
setDestFile(File)
方法预定义,或者通过构造定义IORuntimeException
- IO异常public Word07Writer flush(File destFile) throws IORuntimeException
NullPointerException
destFile
- 写出到的文件IORuntimeException
- IO异常public Word07Writer flush(OutputStream out) throws IORuntimeException
out
- 输出流IORuntimeException
- IO异常public Word07Writer flush(OutputStream out, boolean isCloseOut) throws IORuntimeException
out
- 输出流isCloseOut
- 是否关闭输出流IORuntimeException
- IO异常public void close()
close
in interface Closeable
close
in interface AutoCloseable
protected void closeWithoutFlush()
Copyright © 2024. All rights reserved.