|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.poi.POIXMLDocumentPart
org.apache.poi.xwpf.usermodel.XWPFStyles
public class XWPFStyles
Holds details of built-in, default and user styles, which
apply to tables / paragraphs / lists etc.
Text within one of those with custom stylings has the style
information stored in the XWPFRun
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.poi.POIXMLDocumentPart |
|---|
POIXMLDocumentPart.RelationPart |
| Constructor Summary | |
|---|---|
XWPFStyles()
Construct XWPFStyles from scratch for a new document. |
|
XWPFStyles(PackagePart part)
Construct XWPFStyles from a package part |
|
| Method Summary | |
|---|---|
void |
addStyle(XWPFStyle style)
add a style to the document |
protected void |
commit()
Save the content in the underlying package part. |
protected void |
ensureDocDefaults()
|
protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLanguage |
getCTLanguage()
|
XWPFDefaultParagraphStyle |
getDefaultParagraphStyle()
Get the default paragraph style which applies to the document |
XWPFDefaultRunStyle |
getDefaultRunStyle()
Get the default style which applies text runs in the document |
XWPFLatentStyles |
getLatentStyles()
Get the definition of all the Latent Styles |
int |
getNumberOfStyles()
|
XWPFStyle |
getStyle(java.lang.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 |
java.util.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 TODO Replace this with specific setters for each type, possibly on XWPFDefaultRunStyle |
void |
setEastAsia(java.lang.String strEastAsia)
Sets the default East Asia spelling language on ctStyles DocDefaults parameter |
void |
setSpellingLanguage(java.lang.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(java.lang.String styleID)
checks whether style with styleID exist |
| Methods inherited from class org.apache.poi.POIXMLDocumentPart |
|---|
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationParts, getRelations, getTargetPart, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public XWPFStyles(PackagePart part)
throws java.io.IOException,
OpenXML4JException
part - the package part holding the data of the styles,
java.io.IOException
OpenXML4JExceptionpublic XWPFStyles()
| Method Detail |
|---|
protected void onDocumentRead()
throws java.io.IOException
onDocumentRead in class POIXMLDocumentPartjava.io.IOException - a subclass may throw an IOException when a document is read
protected void commit()
throws java.io.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 POIXMLDocumentPartjava.io.IOException - a subclass may throw an IOException if the changes can't be committedprotected void ensureDocDefaults()
public void setStyles(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles styles)
styles - public boolean styleExist(java.lang.String styleID)
styleID - styleID of the Style in the style-Document
public void addStyle(XWPFStyle style)
style -
java.io.IOExceptionpublic XWPFStyle getStyle(java.lang.String styleID)
styleID - styleID of the searched style
public int getNumberOfStyles()
public java.util.List<XWPFStyle> getUsedStyleList(XWPFStyle style)
style -
protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLanguage getCTLanguage()
public void setSpellingLanguage(java.lang.String strSpellingLanguage)
strSpellingLanguage - public void setEastAsia(java.lang.String strEastAsia)
strEastAsia - public void setDefaultFonts(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts fonts)
public XWPFStyle getStyleWithSameName(XWPFStyle style)
public XWPFDefaultRunStyle getDefaultRunStyle()
public XWPFDefaultParagraphStyle getDefaultParagraphStyle()
public XWPFLatentStyles getLatentStyles()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||