Class StyleDefinitionsPart

All Implemented Interfaces:
XPathEnabled<Styles>

public final class StyleDefinitionsPart extends JaxbXmlPartXPathAware<Styles>
  • Field Details

  • Constructor Details

  • Method Details

    • init

      public void init()
    • setMceIgnorable

      protected void setMceIgnorable(McIgnorableNamespaceDeclarator namespacePrefixMapper)
      Description copied from class: JaxbXmlPart
      Where the mc:Ignorable attribute is present, ensure its contents matches the ignorable namespaces actually present.
      Overrides:
      setMceIgnorable in class JaxbXmlPart<Styles>
    • getMceIgnorable

      public String getMceIgnorable()
      Overrides:
      getMceIgnorable in class JaxbXmlPart<Styles>
    • setJaxbElement

      public void setJaxbElement(Styles jaxbElement)
      Description copied from class: JaxbXmlPartXPathAware
      You can't use this override to create/update a binder, since this would set the jaxbElement field to something different to the object being passed in (as a consequence of the process to create a binder). We don't want that, because calling code may then continue to manipulate the field, without effect.. See instead createBinderAndJaxbElement
      Overrides:
      setJaxbElement in class JaxbXmlPartXPathAware<Styles>
    • unmarshalDefaultStyles

      public Object unmarshalDefaultStyles() throws jakarta.xml.bind.JAXBException
      Unmarshal a default set of styles, useful when creating this part from scratch.
      Returns:
      the newly created root object of the java content tree
      Throws:
      jakarta.xml.bind.JAXBException - If any unexpected errors occur while unmarshalling
    • getKnownStyles

      public static Map<String,Style> getKnownStyles()
      Returns a map of styles defined in docx4j's KnownStyles.xml (not styles defined in your pkg)
      Returns:
    • getStyleById

      public Style getStyleById(String id)
      Parameters:
      id -
      Returns:
      Since:
      3.0.0
    • getDefaultCharacterStyle

      public Style getDefaultCharacterStyle()
    • getDefaultParagraphStyle

      public Style getDefaultParagraphStyle()
      if this returns null; invoke createVirtualStylesForDocDefaults() @since 3.2.0 then try again
      Returns:
    • getDefaultTableStyle

      public Style getDefaultTableStyle()
      Since:
      3.0
    • getCss

      public String getCss()
    • setCss

      public void setCss(String css)
    • getLinkedStyle

      public Style getLinkedStyle(String rStyleVal)
      For a run/character style return its linked paragraph style (if any), or vice versa.
      Parameters:
      rStyleVal -
      Returns:
    • protectRestrictFormatting

      public void protectRestrictFormatting(List<String> allowedStyleNames, boolean removedNotAllowedFormatting, Set<String> stylesInUse) throws Docx4JException
      Restrict allowed formatting to specified styles. You don't want to use this directly; use the method with the same name in WordprocessingMLPackage Formatting or styles that aren't allowed are not removed.
      Parameters:
      allowedStyleNames -
      Throws:
      Docx4JException
      Since:
      3.3.0
    • getNameForStyleID

      public String getNameForStyleID(String id)
      Given the ID of a style known in this part, return the corresponding style name.
      Parameters:
      id -
      Returns:
      Since:
      3.3.0
    • getIDForStyleName

      public String getIDForStyleName(String name)
      Given the name of a style known in this part, return the corresponding style ID.
      Parameters:
      name -
      Returns:
      Since:
      3.3.0
    • refreshNameIdBiMaps

      public void refreshNameIdBiMaps()
      Refresh the style name - ID bimaps, based on styles currently defined in this part.
      Since:
      3.3.0