public class XWPFStyles extends POIXMLDocumentPart
DEFAULT_XML_OPTIONS
Constructor and Description |
---|
XWPFStyles()
Construct XWPFStyles from scratch for a new document.
|
XWPFStyles(PackagePart part,
PackageRelationship rel)
Construct XWPFStyles from a package part
|
Modifier and Type | Method and Description |
---|---|
void |
addStyle(XWPFStyle style)
add a style to the document
|
protected void |
commit()
Save the content in the underlying package part.
|
XWPFLatentStyles |
getLatentStyles()
get latentstyles
|
XWPFStyle |
getStyle(String styleID)
get style by a styleID
|
XWPFStyle |
getStyleWithSameName(XWPFStyle style)
get the style with the same name
if this style is not existing, return null
|
List<XWPFStyle> |
getUsedStyleList(XWPFStyle style)
get the styles which are related to the parameter style and their relatives
this method can be used to copy all styles from one document to another document
|
protected void |
onDocumentRead()
Read document
|
void |
setDefaultFonts(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts fonts)
Sets the default font on ctStyles DocDefaults parameter
|
void |
setEastAsia(String strEastAsia)
Sets the default East Asia spelling language on ctStyles DocDefaults parameter
|
void |
setSpellingLanguage(String strSpellingLanguage)
Sets the default spelling language on ctStyles DocDefaults parameter
|
void |
setStyles(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles styles)
Sets the ctStyles
|
boolean |
styleExist(String styleID)
checks whether style with styleID exist
|
addRelation, clearMemoryPackagePart, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelationById, getRelationCounter, getRelationId, getRelations, getTargetPart, onDocumentCreate, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, toString
public XWPFStyles(PackagePart part, PackageRelationship rel) throws IOException, OpenXML4JException
part
- the package part holding the data of the styles,rel
- the package relationship of type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"IOException
OpenXML4JException
public XWPFStyles()
protected void onDocumentRead() throws IOException
onDocumentRead
in class POIXMLDocumentPart
IOException
protected void commit() throws IOException
POIXMLDocumentPart
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
out.close();
}
commit
in class POIXMLDocumentPart
IOException
public void setStyles(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles styles)
styles
- public boolean styleExist(String styleID)
styleID
- styleID of the Style in the style-Documentpublic void addStyle(XWPFStyle style)
style
- IOException
public XWPFStyle getStyle(String styleID)
styleID
- styleID of the searched stylepublic List<XWPFStyle> getUsedStyleList(XWPFStyle style)
style
- public void setSpellingLanguage(String strSpellingLanguage)
strSpellingLanguage
- public void setEastAsia(String strEastAsia)
strEastAsia
- public void setDefaultFonts(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts fonts)
fonts
- public XWPFLatentStyles getLatentStyles()
Copyright © 2020. All rights reserved.