Package org.aoju.bus.office.word
Class Word07Writer
java.lang.Object
org.aoju.bus.office.word.Word07Writer
- All Implemented Interfaces:
Closeable,AutoCloseable
Word生成器
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWord07Writer(File destFile) 构造Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc) 构造Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc, File destFile) 构造 -
Method Summary
Modifier and TypeMethodDescriptionaddPicture(File picFile, int width, int height) 增加图片,单独成段落addPicture(InputStream in, PicType picType, String fileName, int width, int height) 增加图片,单独成段落,增加后图片流关闭,默认居中对齐addPicture(InputStream in, PicType picType, String fileName, int width, int height, org.apache.poi.xwpf.usermodel.ParagraphAlignment align) 增加图片,单独成段落,增加后图片流关闭增加表格数据增加一个段落增加一个段落voidclose()关闭Word文档 如果用户设定了目标文件,先写出目标文件后给关闭工作簿protected void关闭Word文档但是不写出flush()将Excel Workbook刷出到预定义的文件 如果用户未自定义输出的文件,将抛出NullPointerException预定义文件可以通过setDestFile(File)方法预定义,或者通过构造定义将Excel Workbook刷出到文件 如果用户未自定义输出的文件,将抛出NullPointerExceptionflush(OutputStream out) 将Word Workbook刷出到输出流flush(OutputStream out, boolean isCloseOut) 将Word Document刷出到输出流org.apache.poi.xwpf.usermodel.XWPFDocumentgetDoc()获取XWPFDocumentsetDestFile(File destFile) 设置写出的目标文件
-
Field Details
-
destFile
目标文件 -
isClosed
protected boolean isClosed是否被关闭
-
-
Constructor Details
-
Word07Writer
public Word07Writer() -
Word07Writer
构造- Parameters:
destFile- 写出的文件
-
Word07Writer
public Word07Writer(org.apache.poi.xwpf.usermodel.XWPFDocument doc) 构造- Parameters:
doc-XWPFDocument
-
Word07Writer
构造- Parameters:
doc-XWPFDocumentdestFile- 写出的文件
-
-
Method Details
-
getDoc
public org.apache.poi.xwpf.usermodel.XWPFDocument getDoc()获取XWPFDocument- Returns:
XWPFDocument
-
setDestFile
设置写出的目标文件- Parameters:
destFile- 目标文件- Returns:
- this
-
addText
增加一个段落- Parameters:
font- 字体信息Fonttexts- 段落中的文本,支持多个文本作为一个段落- Returns:
- this
-
addText
public Word07Writer addText(org.apache.poi.xwpf.usermodel.ParagraphAlignment align, Font font, String... texts) 增加一个段落- Parameters:
align- 段落对齐方式ParagraphAlignmentfont- 字体信息Fonttexts- 段落中的文本,支持多个文本作为一个段落- Returns:
- this
-
addPicture
增加图片,单独成段落- Parameters:
picFile- 图片文件width- 宽度height- 高度- Returns:
- this
-
addPicture
public Word07Writer addPicture(InputStream in, PicType picType, String fileName, int width, int height) 增加图片,单独成段落,增加后图片流关闭,默认居中对齐- Parameters:
in- 图片流picType- 图片类型,见Document.PICTURE_TYPE_XXXfileName- 文件名width- 宽度height- 高度- Returns:
- this
-
addPicture
public Word07Writer addPicture(InputStream in, PicType picType, String fileName, int width, int height, org.apache.poi.xwpf.usermodel.ParagraphAlignment align) 增加图片,单独成段落,增加后图片流关闭- Parameters:
in- 图片流picType- 图片类型,见Document.PICTURE_TYPE_XXXfileName- 文件名width- 宽度height- 高度align- 图片的对齐方式- Returns:
- this
-
addTable
增加表格数据- Parameters:
data- 表格数据,多行数据 元素表示一行数据,当为集合或者数组时,为一行;当为Map或者Bean时key表示标题,values为数据- Returns:
- this
-
flush
将Excel Workbook刷出到预定义的文件 如果用户未自定义输出的文件,将抛出NullPointerException预定义文件可以通过setDestFile(File)方法预定义,或者通过构造定义- Returns:
- this
- Throws:
org.aoju.bus.core.exception.InternalException- IO异常
-
flush
将Excel Workbook刷出到文件 如果用户未自定义输出的文件,将抛出NullPointerException- Parameters:
destFile- 写出到的文件- Returns:
- this
- Throws:
org.aoju.bus.core.exception.InternalException- IO异常
-
flush
将Word Workbook刷出到输出流- Parameters:
out- 输出流- Returns:
- this
- Throws:
org.aoju.bus.core.exception.InternalException- IO异常
-
flush
public Word07Writer flush(OutputStream out, boolean isCloseOut) throws org.aoju.bus.core.exception.InternalException 将Word Document刷出到输出流- Parameters:
out- 输出流isCloseOut- 是否关闭输出流- Returns:
- this
- Throws:
org.aoju.bus.core.exception.InternalException- IO异常
-
close
public void close()关闭Word文档 如果用户设定了目标文件,先写出目标文件后给关闭工作簿- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
closeWithoutFlush
protected void closeWithoutFlush()关闭Word文档但是不写出
-