Class StyleDefinitionsPart
java.lang.Object
org.docx4j.openpackaging.Base
org.docx4j.openpackaging.parts.Part
org.docx4j.openpackaging.parts.JaxbXmlPart<E>
org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware<Styles>
org.docx4j.openpackaging.parts.WordprocessingML.StyleDefinitionsPart
- All Implemented Interfaces:
XPathEnabled<Styles>
-
Field Summary
FieldsFields inherited from class org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware
binderFields inherited from class org.docx4j.openpackaging.parts.JaxbXmlPart
jaxbElement, jc, MAX_BYTES_Unmarshal_ErrorFields inherited from class org.docx4j.openpackaging.Base
contentType, partName, relationships -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetCss()if this returns null; invoke createVirtualStylesForDocDefaults() @since 3.2.0 then try againgetIDForStyleName(String name) Given the name of a style known in this part, return the corresponding style ID.Returns a map of styles defined in docx4j's KnownStyles.xml (not styles defined in your pkg)getLinkedStyle(String rStyleVal) For a run/character style return its linked paragraph style (if any), or vice versa.Given the ID of a style known in this part, return the corresponding style name.getStyleById(String id) voidinit()voidprotectRestrictFormatting(List<String> allowedStyleNames, boolean removedNotAllowedFormatting, Set<String> stylesInUse) Restrict allowed formatting to specified styles.voidRefresh the style name - ID bimaps, based on styles currently defined in this part.voidvoidsetJaxbElement(Styles jaxbElement) 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).protected voidsetMceIgnorable(McIgnorableNamespaceDeclarator namespacePrefixMapper) Where the mc:Ignorable attribute is present, ensure its contents matches the ignorable namespaces actually present.Unmarshal a default set of styles, useful when creating this part from scratch.Methods inherited from class org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware
createBinderAndJaxbElement, getBinder, getJAXBAssociationsForXPath, getJAXBAssociationsForXPath, getJAXBNodesViaXPath, getJAXBNodesViaXPath, unmarshal, unmarshalMethods inherited from class org.docx4j.openpackaging.parts.JaxbXmlPart
addMcChoiceNamespace, getConfiguredUnmarshaller, getContents, getJAXBContext, getJaxbElement, getMcChoiceNamespaces, getXML, inputStreamToXSR, isContentEqual, isUnmarshalled, marshal, marshal, marshal, marshal, pipe, pipe, pipe, preprocess, setContents, setJAXBContext, setJaxbElement, transform, transformToDom, variableReplaceMethods inherited from class org.docx4j.openpackaging.parts.Part
getContentLengthAsLoaded, getOwningRelationshipPart, getPackage, getRelationshipType, getSourceRelationship, getSourceRelationships, getVersion, remove, rename, setContentLengthAsLoaded, setOwningRelationshipPart, setPackage, setPartShortcut, setRelationshipType, setSourceRelationship, setVersionMethods inherited from class org.docx4j.openpackaging.Base
addTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, reset, setContentType, setPartName, setRelationships, setUserData
-
Field Details
-
rPrDefaultsString
- See Also:
-
pPrDefaultsString
- See Also:
-
docDefaultsString
- See Also:
-
-
Constructor Details
-
StyleDefinitionsPart
- Throws:
InvalidFormatException
-
StyleDefinitionsPart
- Throws:
InvalidFormatException
-
-
Method Details
-
init
public void init() -
setMceIgnorable
Description copied from class:JaxbXmlPartWhere the mc:Ignorable attribute is present, ensure its contents matches the ignorable namespaces actually present.- Overrides:
setMceIgnorablein classJaxbXmlPart<Styles>
-
getMceIgnorable
- Overrides:
getMceIgnorablein classJaxbXmlPart<Styles>
-
setJaxbElement
Description copied from class:JaxbXmlPartXPathAwareYou 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:
setJaxbElementin classJaxbXmlPartXPathAware<Styles>
-
unmarshalDefaultStyles
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
Returns a map of styles defined in docx4j's KnownStyles.xml (not styles defined in your pkg)- Returns:
-
getStyleById
- Parameters:
id-- Returns:
- Since:
- 3.0.0
-
getDefaultCharacterStyle
-
getDefaultParagraphStyle
if this returns null; invoke createVirtualStylesForDocDefaults() @since 3.2.0 then try again- Returns:
-
getDefaultTableStyle
- Since:
- 3.0
-
getCss
-
setCss
-
getLinkedStyle
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
Given the ID of a style known in this part, return the corresponding style name.- Parameters:
id-- Returns:
- Since:
- 3.3.0
-
getIDForStyleName
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
-