Interface DocxContext<T>
-
- All Superinterfaces:
DocxContextFrameProvider<T>
- All Known Subinterfaces:
DocxRendererContext
- All Known Implementing Classes:
DocxContextImpl
public interface DocxContext<T> extends DocxContextFrameProvider<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addBlankLine(int size, java.lang.String styleId)
void
addBlankLine(long size, java.lang.String styleId)
void
addBlankLine(java.math.BigInteger size, java.lang.String styleId)
void
addBlankLines(int count)
org.docx4j.wml.RPr
addBold()
void
addBreak(org.docx4j.wml.STBrType breakType)
default org.docx4j.wml.FldChar
addFldChar(org.docx4j.wml.STFldCharType charType)
org.docx4j.wml.FldChar
addFldChar(org.docx4j.wml.STFldCharType charType, boolean createR)
Create and add wrapped Text element to R element as RInstrTextdefault org.docx4j.wml.FldChar
addFldCharCreateR(org.docx4j.wml.STFldCharType charType)
org.docx4j.wml.CTFtnEdn
addFootnote(java.math.BigInteger footnoteID)
Add footnote and return itdefault org.docx4j.wml.Text
addInstrText(java.lang.String value)
default org.docx4j.wml.Text
addInstrText(java.lang.String value, boolean noProofRPr)
org.docx4j.wml.Text
addInstrText(java.lang.String value, boolean noProofRPr, boolean createR)
Create and add wrapped Text element to R element as RInstrText set value and optionally space preserve if value starts or ends in a spacedefault org.docx4j.wml.Text
addInstrTextCreateR(java.lang.String value)
default org.docx4j.wml.Text
addInstrTextCreateR(java.lang.String value, boolean noProofRPr)
void
addLineBreak()
Add a line break to current Rvoid
addPageBreak()
default org.docx4j.wml.Text
addText(java.lang.String value)
default org.docx4j.wml.Text
addText(java.lang.String value, boolean noProofRPr)
org.docx4j.wml.Text
addText(java.lang.String value, boolean noProofRPr, boolean createR)
Create and add wrapped Text element to R element set value and optionally space preserve if value starts or ends in a spacedefault org.docx4j.wml.Text
addTextCreateR(java.lang.String value)
default org.docx4j.wml.Text
addTextCreateR(java.lang.String value, boolean noProofRPr)
default org.docx4j.wml.Text
addWrappedText()
Deprecated.useaddText(String)
insteadvoid
contextFramed(java.lang.Runnable runnable)
Run within a context, after run the format providers and containers will be restored.org.docx4j.wml.CTMarkupRange
createBookmarkEnd(org.docx4j.wml.CTBookmark bookmarkStart, boolean isBlockBookmark)
Insert bookmark end into current P for given bookmarkorg.docx4j.wml.P.Hyperlink
createBookmarkHyperlink(java.lang.String bookmarkName, java.lang.String linkText)
Get a hyperlink to a bookmark in the documentorg.docx4j.wml.CTBookmark
createBookmarkStart(java.lang.String bookmarkName, boolean isBlockBookmark)
Insert bookmark start into current Porg.docx4j.wml.Color
createColor()
org.docx4j.wml.HpsMeasure
createHpsMeasure(long val)
org.docx4j.wml.P
createP()
Get a new P element for the current blockorg.docx4j.wml.P
createP(java.lang.String style)
org.docx4j.wml.PPrBase.PStyle
createPStyle(java.lang.String style)
org.docx4j.wml.R
createR()
Create R element, with an RPr and add it to current P elementMutableAttributes
extendRenderingNodeAttributes(AttributablePart part, Attributes attributes)
Extend the attributes by extensions for the node being currently rendered.MutableAttributes
extendRenderingNodeAttributes(Node node, AttributablePart part, Attributes attributes)
Extend the attributes by extensions for the node being currently rendered.BlockFormatProvider<T>
getBlockFormatProvider()
Get current format providerBlockFormatProvider<T>
getBlockFormatProvider(T node)
java.util.concurrent.atomic.AtomicInteger
getBookmarkIdAtomic()
get the atomic integer used to generate bookmark idsorg.docx4j.wml.BooleanDefaultTrue
getBooleanDefaultTrue(boolean value)
org.docx4j.openpackaging.parts.Part
getContainerPart()
java.util.List<java.lang.Object>
getContent()
org.docx4j.wml.CTShd
getCTShd()
Get CTShd from current R or create rPr if none and CTShd if noneorg.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart
getDocxDocument()
org.docx4j.wml.ObjectFactory
getFactory()
Get the wml object factoryorg.docx4j.openpackaging.parts.WordprocessingML.FootnotesPart
getFootnotesPart()
Get or create FootnotesPart for the documentDocxHelper
getHelper()
org.docx4j.relationships.Relationship
getHyperlinkRelationship(java.lang.String url)
Get an external hyperlink relationship for the given urlint
getNextBookmarkId()
Increment the last id and return the idNode
getNodeFromId(java.lang.String nodeId)
Get Node from idjava.lang.String
getNodeId(Node node)
Get id for a nodeorg.docx4j.wml.P
getP()
Get the last P element for the current blockorg.docx4j.openpackaging.packages.WordprocessingMLPackage
getPackage()
org.docx4j.wml.R
getR()
Get last R element of current P or create a new oneDocxRendererOptions
getRenderingOptions()
org.docx4j.wml.RPr
getRPr()
RunFormatProvider<T>
getRunFormatProvider()
RunFormatProvider<T>
getRunFormatProvider(T node)
org.docx4j.wml.Style
getStyle(java.lang.String styleName)
Get a paragraph style of given namejava.lang.String
getValidBookmarkName(java.lang.String id)
Get a valid bookmark for given idvoid
renderFencedCodeLines(java.lang.CharSequence... lines)
void
renderFencedCodeLines(java.util.List<? extends java.lang.CharSequence> lines)
void
setBlockFormatProvider(BlockFormatProvider<T> formatProvider)
void
setContentContainer(ContentContainer container)
void
setParaContainer(ParaContainer container)
void
setRunContainer(RunContainer container)
void
setRunFormatProvider(RunFormatProvider<T> formatProvider)
default org.docx4j.wml.Text
text(java.lang.String text)
Deprecated.-
Methods inherited from interface com.vladsch.flexmark.docx.converter.util.DocxContextFrameProvider
getContextFrame
-
-
-
-
Method Detail
-
getHelper
DocxHelper getHelper()
-
setBlockFormatProvider
void setBlockFormatProvider(BlockFormatProvider<T> formatProvider)
-
setRunFormatProvider
void setRunFormatProvider(RunFormatProvider<T> formatProvider)
-
setContentContainer
void setContentContainer(ContentContainer container)
-
setParaContainer
void setParaContainer(ParaContainer container)
-
setRunContainer
void setRunContainer(RunContainer container)
-
getBlockFormatProvider
BlockFormatProvider<T> getBlockFormatProvider(T node)
-
getRunFormatProvider
RunFormatProvider<T> getRunFormatProvider(T node)
-
getRenderingOptions
DocxRendererOptions getRenderingOptions()
-
getBlockFormatProvider
BlockFormatProvider<T> getBlockFormatProvider()
Get current format provider- Returns:
- format provider
-
getRunFormatProvider
RunFormatProvider<T> getRunFormatProvider()
-
addBlankLine
void addBlankLine(int size, java.lang.String styleId)
-
addBlankLine
void addBlankLine(long size, java.lang.String styleId)
-
addBlankLine
void addBlankLine(java.math.BigInteger size, java.lang.String styleId)
-
addBlankLines
void addBlankLines(int count)
-
getPackage
org.docx4j.openpackaging.packages.WordprocessingMLPackage getPackage()
- Returns:
- the Wordprocessing package
-
extendRenderingNodeAttributes
MutableAttributes extendRenderingNodeAttributes(AttributablePart part, Attributes attributes)
Extend the attributes by extensions for the node being currently rendered.- Parameters:
part
- the tag of the node being rendered, some nodes render multiple tags with attributesattributes
- the attributes that were calculated by the renderer or null, these may be modified. To preserve originals pass a copy.- Returns:
- the extended attributes with added/updated/removed entries
-
extendRenderingNodeAttributes
MutableAttributes extendRenderingNodeAttributes(Node node, AttributablePart part, Attributes attributes)
Extend the attributes by extensions for the node being currently rendered.- Parameters:
node
- node for which to get attributespart
- the tag of the node being rendered, some nodes render multiple tags with attributesattributes
- the attributes that were calculated by the renderer or null, these may be modified. To preserve originals pass a copy.- Returns:
- the extended attributes with added/updated/removed entries
-
getDocxDocument
org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart getDocxDocument()
- Returns:
- the main document
-
getFactory
org.docx4j.wml.ObjectFactory getFactory()
Get the wml object factory- Returns:
- object factory
-
createPStyle
org.docx4j.wml.PPrBase.PStyle createPStyle(java.lang.String style)
-
createP
org.docx4j.wml.P createP()
Get a new P element for the current block- Returns:
- current P element or null if none is open
-
createP
org.docx4j.wml.P createP(java.lang.String style)
-
getP
org.docx4j.wml.P getP()
Get the last P element for the current block- Returns:
- current P element or null if none is open
-
createR
org.docx4j.wml.R createR()
Create R element, with an RPr and add it to current P element- Returns:
- R element
-
getR
org.docx4j.wml.R getR()
Get last R element of current P or create a new one- Returns:
- R element
-
createBookmarkStart
org.docx4j.wml.CTBookmark createBookmarkStart(java.lang.String bookmarkName, boolean isBlockBookmark)
Insert bookmark start into current P- Parameters:
bookmarkName
- name of the bookmark (optional), if not given the it will be BM_{id}isBlockBookmark
- true if block bookmark- Returns:
- CTBookmark
-
createBookmarkEnd
org.docx4j.wml.CTMarkupRange createBookmarkEnd(org.docx4j.wml.CTBookmark bookmarkStart, boolean isBlockBookmark)
Insert bookmark end into current P for given bookmark- Parameters:
bookmarkStart
- starting bookmark to closeisBlockBookmark
- true if block bookmark- Returns:
- CTMarkupRange
-
createBookmarkHyperlink
org.docx4j.wml.P.Hyperlink createBookmarkHyperlink(java.lang.String bookmarkName, java.lang.String linkText)
Get a hyperlink to a bookmark in the document- Parameters:
bookmarkName
- name of the bookmark to link tolinkText
- text of the link- Returns:
- hyperlink
-
getNextBookmarkId
int getNextBookmarkId()
Increment the last id and return the id- Returns:
- next bookmark id
-
getBookmarkIdAtomic
java.util.concurrent.atomic.AtomicInteger getBookmarkIdAtomic()
get the atomic integer used to generate bookmark ids- Returns:
- the id atomic integer
-
addWrappedText
@Deprecated default org.docx4j.wml.Text addWrappedText()
Deprecated.useaddText(String)
insteadCreate and add wrapped Text element to R element- Returns:
- Text element
-
addText
org.docx4j.wml.Text addText(java.lang.String value, boolean noProofRPr, boolean createR)
Create and add wrapped Text element to R element set value and optionally space preserve if value starts or ends in a space- Parameters:
value
- value to setnoProofRPr
- if true will add rPr with noProof tag to RcreateR
- if true then create a new R, otherwise add to existing one- Returns:
- Text element
-
addTextCreateR
default org.docx4j.wml.Text addTextCreateR(java.lang.String value, boolean noProofRPr)
-
addTextCreateR
default org.docx4j.wml.Text addTextCreateR(java.lang.String value)
-
addText
default org.docx4j.wml.Text addText(java.lang.String value, boolean noProofRPr)
-
addText
default org.docx4j.wml.Text addText(java.lang.String value)
-
addInstrText
org.docx4j.wml.Text addInstrText(java.lang.String value, boolean noProofRPr, boolean createR)
Create and add wrapped Text element to R element as RInstrText set value and optionally space preserve if value starts or ends in a space- Parameters:
value
- instrText ValuenoProofRPr
- if true will add rPr with noProof #BooleanDefaultTruecreateR
- if true then create a new R, otherwise add to existing one- Returns:
- Text element
-
addInstrTextCreateR
default org.docx4j.wml.Text addInstrTextCreateR(java.lang.String value, boolean noProofRPr)
-
addInstrTextCreateR
default org.docx4j.wml.Text addInstrTextCreateR(java.lang.String value)
-
addInstrText
default org.docx4j.wml.Text addInstrText(java.lang.String value, boolean noProofRPr)
-
addInstrText
default org.docx4j.wml.Text addInstrText(java.lang.String value)
-
addFldChar
org.docx4j.wml.FldChar addFldChar(org.docx4j.wml.STFldCharType charType, boolean createR)
Create and add wrapped Text element to R element as RInstrText- Parameters:
charType
- char type to setcreateR
- if true then create a new R, otherwise add to existing one- Returns:
- FldChar element
-
addFldCharCreateR
default org.docx4j.wml.FldChar addFldCharCreateR(org.docx4j.wml.STFldCharType charType)
-
addFldChar
default org.docx4j.wml.FldChar addFldChar(org.docx4j.wml.STFldCharType charType)
-
addPageBreak
void addPageBreak()
-
addBreak
void addBreak(org.docx4j.wml.STBrType breakType)
-
getContent
java.util.List<java.lang.Object> getContent()
-
addBold
org.docx4j.wml.RPr addBold()
-
getRPr
org.docx4j.wml.RPr getRPr()
-
getBooleanDefaultTrue
org.docx4j.wml.BooleanDefaultTrue getBooleanDefaultTrue(boolean value)
-
getCTShd
org.docx4j.wml.CTShd getCTShd()
Get CTShd from current R or create rPr if none and CTShd if none- Returns:
- CTShd
-
createColor
org.docx4j.wml.Color createColor()
-
createHpsMeasure
org.docx4j.wml.HpsMeasure createHpsMeasure(long val)
-
text
@Deprecated default org.docx4j.wml.Text text(java.lang.String text)
Deprecated.Add text to current P, create R and add wrapped text- Parameters:
text
- text to add- Returns:
- text element
-
getStyle
org.docx4j.wml.Style getStyle(java.lang.String styleName)
Get a paragraph style of given name- Parameters:
styleName
- name of the style- Returns:
- style
-
getHyperlinkRelationship
org.docx4j.relationships.Relationship getHyperlinkRelationship(java.lang.String url)
Get an external hyperlink relationship for the given url- Parameters:
url
- url- Returns:
- relationship
-
getContainerPart
org.docx4j.openpackaging.parts.Part getContainerPart()
-
addLineBreak
void addLineBreak()
Add a line break to current R
-
contextFramed
void contextFramed(java.lang.Runnable runnable)
Run within a context, after run the format providers and containers will be restored.Use when you need to create a container or format provider but only for a part of the node rendering process.
- Parameters:
runnable
- code to run
-
renderFencedCodeLines
void renderFencedCodeLines(java.lang.CharSequence... lines)
-
renderFencedCodeLines
void renderFencedCodeLines(java.util.List<? extends java.lang.CharSequence> lines)
-
getFootnotesPart
org.docx4j.openpackaging.parts.WordprocessingML.FootnotesPart getFootnotesPart() throws org.docx4j.openpackaging.exceptions.Docx4JException
Get or create FootnotesPart for the document- Returns:
- footnotes part
- Throws:
org.docx4j.openpackaging.exceptions.Docx4JException
- if cannot create part
-
addFootnote
org.docx4j.wml.CTFtnEdn addFootnote(java.math.BigInteger footnoteID) throws org.docx4j.openpackaging.exceptions.Docx4JException
Add footnote and return it- Parameters:
footnoteID
- re-use footnote id or 0 if new footnote- Returns:
- footnote element
- Throws:
org.docx4j.openpackaging.exceptions.Docx4JException
- thrown if cannot get or create footnotes part of the document
-
getNodeId
java.lang.String getNodeId(Node node)
Get id for a node- Parameters:
node
- node- Returns:
- id string or null if none
-
getValidBookmarkName
java.lang.String getValidBookmarkName(java.lang.String id)
Get a valid bookmark for given id- Parameters:
id
- node id- Returns:
- mapped to valid bookmark name
-
getNodeFromId
Node getNodeFromId(java.lang.String nodeId)
Get Node from id- Parameters:
nodeId
- id string- Returns:
- node or null if no node with given id attribute is defined
-
-