Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.xwpf.usermodel
Class XWPFStyles

    java.lang.Object
      org.apache.poi.POIXMLDocumentPart
          org.apache.poi.xwpf.usermodel.XWPFStyles

    public class XWPFStyles

extends POIXMLDocumentPart

Author:
  Philipp Epp

Field Summary
`protected XWPFLatentStyles` | `latentStyles`
`protected java.util.List<XWPFStyle>` | `listStyle`

Fields inherited from class org.apache.poi.POIXMLDocumentPart
`DEFAULT_XML_OPTIONS`

Constructor Summary
`XWPFStyles(PackagePart part, PackageRelationship rel)` 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.
`XWPFLatentStyles` | `getLatentStyles()` get latentstyles
`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
`boolean` | `styleExist(java.lang.String styleID)` checks whether style with styleID exist

Methods inherited from class org.apache.poi.POIXMLDocumentPart
`addRelation, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelations, onDocumentCreate, onSave, read, rebase, removeRelation, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### latentStyles

    protected XWPFLatentStyles latentStyles

### listStyle

    protected java.util.List<XWPFStyle> listStyle

Constructor Detail

### XWPFStyles

    public XWPFStyles(PackagePart part,
                      PackageRelationship rel)
               throws java.io.IOException,
                      OpenXML4JException

  Construct XWPFStyles from a package part

  Parameters:
    `part` - the package part holding the data of the styles,
    `rel` - the package relationship of type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
  Throws:
    `java.io.IOException`
    `OpenXML4JException`

Method Detail

### onDocumentRead

    protected void onDocumentRead()
                           throws java.io.IOException

  Read document

  Overrides:
    `onDocumentRead` in class `POIXMLDocumentPart`
  Throws:
    `java.io.IOException`

### commit

    protected void commit()
                   throws java.io.IOException

  Description copied from class: `POIXMLDocumentPart`
  Save the content in the underlying package part. Default implementation is empty meaning that the package part is left unmodified. Sub-classes should override and add logic to marshal the "model" into Ooxml4J. For example, the code saving a generic XML entry may look as follows:

       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();
       }

  Overrides:
    `commit` in class `POIXMLDocumentPart`
  Throws:
    `java.io.IOException`

### styleExist

    public boolean styleExist(java.lang.String styleID)

  checks whether style with styleID exist

  Parameters:
    `styleID` - styleID of the Style in the style-Document
  Returns:
    true if style exist, false if style not exist

### addStyle

    public void addStyle(XWPFStyle style)

  add a style to the document

  Parameters:
    `style` -
  Throws:
    `java.io.IOException`

### getStyle

    public XWPFStyle getStyle(java.lang.String styleID)

  get style by a styleID

  Parameters:
    `styleID` - styleID of the searched style
  Returns:
    style

### getUsedStyleList

    public 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

  Parameters:
    `style` -
  Returns:
    a list of all styles which were used by this method

### getLatentStyles

    public XWPFLatentStyles getLatentStyles()

  get latentstyles

### getStyleWithSameName

    public XWPFStyle getStyleWithSameName(XWPFStyle style)

  get the style with the same name if this style is not existing, return null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2010 The Apache Software Foundation or its licensors, as applicable.