程序包 org.ddr.poi.html
类 HtmlRenderContext
java.lang.Object
com.deepoove.poi.render.RenderContext<String>
org.ddr.poi.html.HtmlRenderContext
HTML字符串渲染上下文
- 从以下版本开始:
- 2021-02-08
-
构造器概要
构造器构造器说明HtmlRenderContext(com.deepoove.poi.render.RenderContext<String> context, ElementRendererProvider rendererProvider) 构造方法 -
方法概要
修饰符和类型方法说明intcomputeLengthInEMU(String length, String maxLength, int naturalEMU, int parentEMU) 考虑约束计算长度,以EMU为单位intcomputeLengthInEMU(CSSLength cssLength, int naturalEMU, int parentEMU) 考虑约束计算长度,以EMU为单位org.apache.xmlbeans.XmlObjectcom.steadystate.css.dom.CSSStyleDeclarationImpl当前元素的样式声明,在HTML元素渲染开始时立即调用才可得到正确的声明,因为在解析的过程中可能会动态插入样式voidvoid结束渲染超链接intintintorg.apache.poi.xwpf.usermodel.XWPFParagraph获取最近的段落,如果当前最近位置的内容元素是表格,则创建一个与之平级的段落org.apache.poi.xwpf.usermodel.XWPFTable获取最近的表格,仅可在渲染表格及其内部元素的时候使用org.apache.poi.xwpf.usermodel.IBodycom.steadystate.css.dom.CSSStyleDeclarationImplgetCssStyleDeclaration(org.jsoup.nodes.Element element) org.apache.poi.xwpf.usermodel.XWPFRunintgetPropertyValue(String property) 获取样式值,将被转换为小写getPropertyValue(String property, boolean inlineOnly) 获取样式值,将被转换为小写getPropertyValue(String property, boolean caseSensitive, boolean inlineOnly) 获取样式值voidbooleanbooleanintlengthToEMU(CSSLength length) 将长度换算为EMUvoidmarkDedupe(org.apache.poi.xwpf.usermodel.XWPFParagraph paragraph) 标记段落以防止块状元素嵌套产生多余的空段落org.apache.poi.xwpf.usermodel.XWPFParagraphnewParagraph(org.apache.poi.xwpf.usermodel.IBody container, org.apache.xmlbeans.XmlCursor cursor) 新建段落org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRnewRun()新建CTRvoid父容器出栈boolean返回之前保存的指针位置void行内样式出栈voidpushContainer(org.apache.poi.xwpf.usermodel.IBody body) 父容器入栈voidpushCursor(org.apache.xmlbeans.XmlCursor targetCursor) 保存当前指针位置并移动到目标指针位置voidpushInlineStyle(com.steadystate.css.dom.CSSStyleDeclarationImpl inlineStyle, boolean block) 行内样式入栈booleanrenderAsBlock(org.jsoup.nodes.Element element) HTML元素是否按照块状进行渲染voidrenderDocument(org.jsoup.nodes.Document document) voidrenderElement(org.jsoup.nodes.Element element) voidrenderNode(org.jsoup.nodes.Node node) voidrenderPicture(InputStream pictureData, int pictureType, String filename, int width, int height, byte[] svgData) 渲染图片voidrenderText(String text) 渲染文本voidsetGlobalFont(String globalFont) voidsetGlobalFontSize(BigInteger globalFontSize) voidsetMathRenderConfig(MathRenderConfig mathRenderConfig) voidsetShowDefaultTableBorderInTableCell(boolean showDefaultTableBorderInTableCell) voidstartHyperlink(String uri) 开始渲染超链接void取消段落防重标记从类继承的方法 com.deepoove.poi.render.RenderContext
getConfig, getData, getEleTemplate, getRun, getTagSource, getTemplate, getThing, getWhere, getWhereDelegate, getXWPFDocument
-
构造器详细资料
-
HtmlRenderContext
public HtmlRenderContext(com.deepoove.poi.render.RenderContext<String> context, ElementRendererProvider rendererProvider) 构造方法- 参数:
context- 原始渲染上下文
-
-
方法详细资料
-
getContainer
public org.apache.poi.xwpf.usermodel.IBody getContainer()- 覆盖:
getContainer在类中com.deepoove.poi.render.RenderContext<String>
-
pushContainer
public void pushContainer(org.apache.poi.xwpf.usermodel.IBody body) 父容器入栈- 参数:
body- 父容器
-
popContainer
public void popContainer()父容器出栈 -
getClosestParagraph
public org.apache.poi.xwpf.usermodel.XWPFParagraph getClosestParagraph()获取最近的段落,如果当前最近位置的内容元素是表格,则创建一个与之平级的段落- 返回:
- 最近的段落
-
startHyperlink
开始渲染超链接- 参数:
uri- 链接地址
-
endHyperlink
public void endHyperlink()结束渲染超链接 -
newParagraph
public org.apache.poi.xwpf.usermodel.XWPFParagraph newParagraph(org.apache.poi.xwpf.usermodel.IBody container, org.apache.xmlbeans.XmlCursor cursor) 新建段落- 参数:
container- 容器cursor- xml指针- 返回:
- 段落
-
newRun
public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR newRun()新建CTR- 返回:
- CTR
-
getClosestTable
public org.apache.poi.xwpf.usermodel.XWPFTable getClosestTable()获取最近的表格,仅可在渲染表格及其内部元素的时候使用- 返回:
- 最近的表格
-
pushInlineStyle
public void pushInlineStyle(com.steadystate.css.dom.CSSStyleDeclarationImpl inlineStyle, boolean block) 行内样式入栈- 参数:
inlineStyle- 样式声明block- 是否为块状元素
-
popInlineStyle
public void popInlineStyle()行内样式出栈 -
currentElementStyle
public com.steadystate.css.dom.CSSStyleDeclarationImpl currentElementStyle()当前元素的样式声明,在HTML元素渲染开始时立即调用才可得到正确的声明,因为在解析的过程中可能会动态插入样式- 返回:
- 当前元素的样式声明
-
getPropertyValue
获取样式值,将被转换为小写- 参数:
property- 样式名称- 返回:
- 样式值,未声明时返回空字符串
-
getPropertyValue
获取样式值,将被转换为小写- 参数:
property- 样式名称inlineOnly- 是否仅获取行内元素样式- 返回:
- 样式值,未声明时返回空字符串
-
getPropertyValue
获取样式值- 参数:
property- 样式名称caseSensitive- 是否大小写无关,如果无关则将转换为小写,否则保留原始值inlineOnly- 是否仅获取行内元素样式- 返回:
- 样式值,未声明时返回空字符串
-
getDefaultFontSize
- 返回:
- Word中设置的默认字号
-
getInheritedFontSizeInHalfPoints
public int getInheritedFontSizeInHalfPoints()- 返回:
- 获取当前元素继承的字号,以“半点”为单位
-
getAvailableWidthInEMU
public int getAvailableWidthInEMU()- 返回:
- 父容器的可用宽度,以EMU为单位
-
computeLengthInEMU
考虑约束计算长度,以EMU为单位- 参数:
length- 长度声明maxLength- 最大长度声明naturalEMU- 原始长度parentEMU- 父容器长度- 返回:
- 以EMU为单位的长度值
-
computeLengthInEMU
考虑约束计算长度,以EMU为单位- 参数:
cssLength- 长度声明naturalEMU- 原始长度parentEMU- 父容器长度- 返回:
- 以EMU为单位的长度值
-
renderText
渲染文本- 参数:
text- 文本
-
renderPicture
public void renderPicture(InputStream pictureData, int pictureType, String filename, int width, int height, byte[] svgData) throws IOException, org.apache.poi.openxml4j.exceptions.InvalidFormatException 渲染图片- 参数:
pictureData- 图片数据流pictureType- 图片类型filename- 文件名width- 宽度height- 高度svgData- SVG数据- 抛出:
IOExceptionorg.apache.poi.openxml4j.exceptions.InvalidFormatException
-
lengthToEMU
将长度换算为EMU- 参数:
length- 长度- 返回:
- EMU
-
getNumberingContext
-
getPageWidth
-
getPageHeight
-
getMarginTop
-
getMarginRight
-
getMarginBottom
-
getMarginLeft
-
getAvailablePageWidth
public int getAvailablePageWidth() -
getAvailablePageHeight
public int getAvailablePageHeight() -
getMathRenderConfig
-
setMathRenderConfig
-
getCurrentRun
public org.apache.poi.xwpf.usermodel.XWPFRun getCurrentRun() -
getGlobalFont
-
getGlobalFontSize
-
isShowDefaultTableBorderInTableCell
public boolean isShowDefaultTableBorderInTableCell() -
setShowDefaultTableBorderInTableCell
public void setShowDefaultTableBorderInTableCell(boolean showDefaultTableBorderInTableCell) -
setGlobalFont
-
setGlobalFontSize
-
isBlocked
public boolean isBlocked() -
incrementBlockLevel
public void incrementBlockLevel() -
decrementBlockLevel
public void decrementBlockLevel() -
renderDocument
public void renderDocument(org.jsoup.nodes.Document document) -
renderNode
public void renderNode(org.jsoup.nodes.Node node) -
renderElement
public void renderElement(org.jsoup.nodes.Element element) -
renderAsBlock
public boolean renderAsBlock(org.jsoup.nodes.Element element) HTML元素是否按照块状进行渲染- 参数:
element- HTML元素- 返回:
- 是否按照块状进行渲染
-
getCssStyleDeclaration
public com.steadystate.css.dom.CSSStyleDeclarationImpl getCssStyleDeclaration(org.jsoup.nodes.Element element) -
pushCursor
public void pushCursor(org.apache.xmlbeans.XmlCursor targetCursor) 保存当前指针位置并移动到目标指针位置- 参数:
targetCursor- 目标指针
-
popCursor
public boolean popCursor()返回之前保存的指针位置- 返回:
- 是否返回成功
-
currentCursorObject
public org.apache.xmlbeans.XmlObject currentCursorObject()- 返回:
- 指针当前指向的对象
-
markDedupe
public void markDedupe(org.apache.poi.xwpf.usermodel.XWPFParagraph paragraph) 标记段落以防止块状元素嵌套产生多余的空段落- 参数:
paragraph- 段落
-
unmarkDedupe
public void unmarkDedupe()取消段落防重标记
-