public class XHTMLImporterImpl extends Object implements org.docx4j.convert.in.xhtml.XHTMLImporter
Modifier and Type | Class and Description |
---|---|
static class |
XHTMLImporterImpl.TableProperties |
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
log |
protected org.docx4j.openpackaging.packages.WordprocessingMLPackage |
wordMLPackage |
Constructor and Description |
---|
XHTMLImporterImpl(org.docx4j.openpackaging.packages.WordprocessingMLPackage wordMLPackage) |
Modifier and Type | Method and Description |
---|---|
static void |
addFontMapping(String cssFontFamily,
org.docx4j.wml.RFonts rFonts)
Map a font family, for example "Century Gothic" in:
font-family:"Century Gothic", Helvetica, Arial, sans-serif;
to a w:rFonts object, for example:
|
static void |
addFontMapping(String cssFontFamily,
String font) |
List<Object> |
convert(File file,
String baseUrl)
Convert the well formed XHTML contained in file to a list of WML objects.
|
List<Object> |
convert(InputSource is,
String baseUrl)
Convert the well formed XHTML from the specified SAX InputSource
|
List<Object> |
convert(InputStream is,
String baseUrl) |
List<Object> |
convert(Node node,
String baseUrl) |
List<Object> |
convert(Reader reader,
String baseUrl) |
List<Object> |
convert(Source source,
String baseUrl) |
List<Object> |
convert(String content,
String baseUrl)
Convert the well formed XHTML contained in the string to a list of WML objects.
|
List<Object> |
convert(URL url)
Convert the well formed XHTML found at the specified URI to a list of WML objects.
|
protected int |
getAncestorIndentation(org.docx4j.org.xhtmlrenderer.layout.Styleable styleable) |
AtomicInteger |
getBookmarkIdLast() |
Map<String,org.w3c.dom.css.CSSValue> |
getCascadedProperties(org.docx4j.org.xhtmlrenderer.css.style.CalculatedStyle cs)
Property values (CSSPrimitiveValue) by name.
|
protected LinkedList<org.docx4j.wml.ContentAccessor> |
getContentContextStack() |
protected ListHelper |
getListHelper() |
protected int |
getLocalIndentation(org.docx4j.org.xhtmlrenderer.layout.Styleable styleable)
Inside a list item, get the contribution of any div.
|
protected org.docx4j.wml.PPr |
getPPr(org.docx4j.org.xhtmlrenderer.render.BlockBox blockBox,
Map<String,org.w3c.dom.css.CSSValue> cssMap) |
org.docx4j.org.xhtmlrenderer.docx.DocxRenderer |
getRenderer() |
Map<String,Integer> |
getSequenceCounters()
Get the current numbers of SEQ fields, used in image captions.
|
protected org.docx4j.wml.Style |
getStyleByIdOrName(String... parameters)
If one parameter is passed then search style by id (1st parameter),
if style by id is not found then search style by name (also 1st parameter).
|
protected org.docx4j.convert.in.xhtml.FormattingOption |
getTableFormatting() |
protected TableHelper |
getTableHelper() |
protected boolean |
isBidi(String pText) |
protected void |
populatePPr(org.docx4j.wml.PPr pPr,
org.docx4j.org.xhtmlrenderer.layout.Styleable blockBox,
Map<String,org.w3c.dom.css.CSSValue> cssMap) |
void |
setBookmarkIdNext(AtomicInteger val) |
void |
setBookmarkNamePrefix(String bookmarkNamePrefix)
The prefix (if any) to be added to bookmark names generated during this run.
|
static void |
setCssWhiteList(Set<String> cssWhiteList)
Deprecated.
|
void |
setDivHandler(DivHandler divHandler) |
void |
setHyperlinkStyle(String hyperlinkStyleID)
Configure, how the Importer styles hyperlinks
If hyperlinkStyleId is set to
null , hyperlinks are
styled using just the CSS. |
void |
setMaxWidth(int maxWidth,
String tableStyle) |
void |
setParagraphFormatting(org.docx4j.convert.in.xhtml.FormattingOption paragraphFormatting) |
void |
setRenderer(org.docx4j.org.xhtmlrenderer.docx.DocxRenderer renderer) |
void |
setRunFormatting(org.docx4j.convert.in.xhtml.FormattingOption runFormatting) |
void |
setSequenceCounters(Map<String,Integer> sequenceCounters)
Set the last used numbers of SEQ fields, used in image captions.
|
void |
setTableFormatting(org.docx4j.convert.in.xhtml.FormattingOption tableFormatting) |
void |
setXHTMLImageHandler(XHTMLImageHandler xHTMLImageHandler)
If you have your own implementation of the XHTMLImageHandler interface
which you'd like to use.
|
public static org.slf4j.Logger log
protected org.docx4j.openpackaging.packages.WordprocessingMLPackage wordMLPackage
public XHTMLImporterImpl(org.docx4j.openpackaging.packages.WordprocessingMLPackage wordMLPackage)
public void setHyperlinkStyle(String hyperlinkStyleID)
null
, hyperlinks are
styled using just the CSS. This is the default behavior.
If hyperlinkStyleId is set to "someWordHyperlinkStyleName"
,
that style is used. The default Word hyperlink style name is "Hyperlink".
It is currently your responsibility to define that style in your
styles definition part.setHyperlinkStyle
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
hyperlinkStyleID
- The style to use for hyperlinks (eg Hyperlink)public void setXHTMLImageHandler(XHTMLImageHandler xHTMLImageHandler)
public void setMaxWidth(int maxWidth, String tableStyle)
setMaxWidth
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
public void setDivHandler(DivHandler divHandler)
protected ListHelper getListHelper()
protected TableHelper getTableHelper()
public org.docx4j.org.xhtmlrenderer.docx.DocxRenderer getRenderer()
public void setRenderer(org.docx4j.org.xhtmlrenderer.docx.DocxRenderer renderer)
renderer
- the renderer to setpublic static void addFontMapping(String cssFontFamily, org.docx4j.wml.RFonts rFonts)
public void setRunFormatting(org.docx4j.convert.in.xhtml.FormattingOption runFormatting)
setRunFormatting
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
runFormatting
- the runFormatting to setpublic void setParagraphFormatting(org.docx4j.convert.in.xhtml.FormattingOption paragraphFormatting)
setParagraphFormatting
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
paragraphFormatting
- the paragraphFormatting to setpublic void setTableFormatting(org.docx4j.convert.in.xhtml.FormattingOption tableFormatting)
setTableFormatting
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
tableFormatting
- the tableFormatting to setprotected org.docx4j.convert.in.xhtml.FormattingOption getTableFormatting()
@Deprecated public static void setCssWhiteList(Set<String> cssWhiteList)
cssWhiteList
- the cssWhiteList to setpublic AtomicInteger getBookmarkIdLast()
getBookmarkIdLast
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
public void setBookmarkIdNext(AtomicInteger val)
public List<Object> convert(File file, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
file
- baseUrl
- wordMLPackage
- IOException
org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(InputSource is, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
is
- baseUrl
- wordMLPackage
- IOException
org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(InputStream is, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
is
- baseUrl
- wordMLPackage
- IOException
org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(Node node, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
node
- baseUrl
- wordMLPackage
- IOException
org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(Reader reader, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
reader
- baseUrl
- wordMLPackage
- IOException
org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(Source source, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
source
- baseUrl
- wordMLPackage
- IOException
org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(URL url) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
url
- wordMLPackage
- org.docx4j.openpackaging.exceptions.Docx4JException
public List<Object> convert(String content, String baseUrl) throws org.docx4j.openpackaging.exceptions.Docx4JException
convert
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
content
- baseUrl
- wordMLPackage
- org.docx4j.openpackaging.exceptions.Docx4JException
public Map<String,org.w3c.dom.css.CSSValue> getCascadedProperties(org.docx4j.org.xhtmlrenderer.css.style.CalculatedStyle cs)
cs
- cssWhiteList
- protected LinkedList<org.docx4j.wml.ContentAccessor> getContentContextStack()
public Map<String,Integer> getSequenceCounters()
getSequenceCounters
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
sequenceCounters
- public void setSequenceCounters(Map<String,Integer> sequenceCounters)
setSequenceCounters
in interface org.docx4j.convert.in.xhtml.XHTMLImporter
sequenceCounters
- protected org.docx4j.wml.PPr getPPr(org.docx4j.org.xhtmlrenderer.render.BlockBox blockBox, Map<String,org.w3c.dom.css.CSSValue> cssMap)
protected boolean isBidi(String pText)
protected void populatePPr(org.docx4j.wml.PPr pPr, org.docx4j.org.xhtmlrenderer.layout.Styleable blockBox, Map<String,org.w3c.dom.css.CSSValue> cssMap)
protected org.docx4j.wml.Style getStyleByIdOrName(String... parameters)
protected int getLocalIndentation(org.docx4j.org.xhtmlrenderer.layout.Styleable styleable)
protected int getAncestorIndentation(org.docx4j.org.xhtmlrenderer.layout.Styleable styleable)
public void setBookmarkNamePrefix(String bookmarkNamePrefix)
bookmarkNamePrefix
- Copyright © 2013-2019. All Rights Reserved.