Style

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Cloneable

public class Style implements Cloneable

Represents a single built-in or user-defined style.

To learn more, visit the Working with Styles and Themes documentation article.

Methods

Method Description
clearParaAttrs()
clearRunAttrs()
equals(Style style) Compares with the specified style.
equals(Object arg0)
fetchInheritedParaAttr(int key)
fetchInheritedRunAttr(int key)
fetchParaAttr(int key)
getAliases() Gets all aliases of this style.
getBaseStyleName() Gets/sets the name of the style this style is based on.
getBuiltIn() True if this style is one of the built-in styles in MS Word.
getClass()
getDirectParaAttr(int key)
getDirectParaAttr(int key, int revisionsView)
getDirectRunAttr(int key)
getDirectRunAttr(int key, int revisionsView)
getDocument() Gets the owner document.
getFont() Gets the character formatting of the style.
getLinkedStyleName() Gets the name of the Style linked to this one.
getList() Gets the list that defines formatting of this list style.
getListFormat() Provides access to the list formatting properties of a paragraph style.
getName() Gets the name of the style.
getNextParagraphStyleName() Gets/sets the name of the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style.
getParagraphFormat() Gets the paragraph formatting of the style.
getStyleIdentifier() Gets the locale independent style identifier for a built-in style.
getStyles() Gets the collection of styles this style belongs to.
getType() Gets the style type (paragraph or character).
hashCode()
isHeading() True when the style is one of the built-in Heading styles.
isQuickStyle() Specifies whether this style is shown in the Quick Style gallery inside MS Word UI.
isQuickStyle(boolean value) Specifies whether this style is shown in the Quick Style gallery inside MS Word UI.
notify()
notifyAll()
remove() Removes the specified style from the document.
removeParaAttr(int key)
removeRunAttr(int key)
setBaseStyleName(String value) Gets/sets the name of the style this style is based on.
setName(String value) Sets the name of the style.
setNextParagraphStyleName(String value) Gets/sets the name of the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style.
setParaAttr(int key, Object value)
setRunAttr(int key, Object value)
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

clearParaAttrs()

public void clearParaAttrs()

clearRunAttrs()

public void clearRunAttrs()

equals(Style style)

public boolean equals(Style style)

Compares with the specified style. Styles Istds are compared for built-in styles only. Styles defaults are not included in comparison. Base style, linked style and next paragraph style are recursively compared.

Parameters:

Parameter Type Description
style Style

Returns: boolean

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

fetchInheritedParaAttr(int key)

public Object fetchInheritedParaAttr(int key)

Parameters:

Parameter Type Description
key int

Returns: java.lang.Object

fetchInheritedRunAttr(int key)

public Object fetchInheritedRunAttr(int key)

Parameters:

Parameter Type Description
key int

Returns: java.lang.Object

fetchParaAttr(int key)

public Object fetchParaAttr(int key)

Parameters:

Parameter Type Description
key int

Returns: java.lang.Object

getAliases()

public String[] getAliases()

Gets all aliases of this style. If style has no aliases then empty array of string is returned.

Returns: java.lang.String[] - All aliases of this style.

getBaseStyleName()

public String getBaseStyleName()

Gets/sets the name of the style this style is based on. This will be an empty string if the style is not based on any other style and it can be set to an empty string.

Returns: java.lang.String - The corresponding java.lang.String value.

getBuiltIn()

public boolean getBuiltIn()

True if this style is one of the built-in styles in MS Word.

Returns: boolean - The corresponding boolean value.

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getDirectParaAttr(int key)

public Object getDirectParaAttr(int key)

Parameters:

Parameter Type Description
key int

Returns: java.lang.Object

getDirectParaAttr(int key, int revisionsView)

public Object getDirectParaAttr(int key, int revisionsView)

Parameters:

Parameter Type Description
key int
revisionsView int

Returns: java.lang.Object

getDirectRunAttr(int key)

public Object getDirectRunAttr(int key)

Parameters:

Parameter Type Description
key int

Returns: java.lang.Object

getDirectRunAttr(int key, int revisionsView)

public Object getDirectRunAttr(int key, int revisionsView)

Parameters:

Parameter Type Description
key int
revisionsView int

Returns: java.lang.Object

getDocument()

public DocumentBase getDocument()

Gets the owner document.

Returns: DocumentBase - The owner document.

getFont()

public Font getFont()

Gets the character formatting of the style.

For list styles this property returns null .

Returns: Font - The character formatting of the style.

getLinkedStyleName()

public String getLinkedStyleName()

Gets the name of the Style linked to this one. Returns empty string if no styles are linked.

Returns: java.lang.String - The name of the Style linked to this one.

getList()

public List getList()

Gets the list that defines formatting of this list style.

This property is only valid for list styles. For other style types this property returns null .

Returns: List - The list that defines formatting of this list style.

getListFormat()

public ListFormat getListFormat()

Provides access to the list formatting properties of a paragraph style.

This property is only valid for paragraph styles. For other style types this property returns null .

Returns: ListFormat - The corresponding ListFormat value.

getName()

public String getName()

Gets the name of the style.

Can not be empty string.

If there already is a style with such name in the collection, then this style will override it. All affected nodes will reference new style.

Returns: java.lang.String - The name of the style.

getNextParagraphStyleName()

public String getNextParagraphStyleName()

Gets/sets the name of the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style. This property is not used by Aspose.Words. The next paragraph style will only be applied automatically when you edit the document in MS Word.

Returns: java.lang.String - The corresponding java.lang.String value.

getParagraphFormat()

public ParagraphFormat getParagraphFormat()

Gets the paragraph formatting of the style.

For character and list styles this property returns null .

Returns: ParagraphFormat - The paragraph formatting of the style.

getStyleIdentifier()

public int getStyleIdentifier()

Gets the locale independent style identifier for a built-in style.

For user defined (custom) styles, this property returns StyleIdentifier.USER.

Returns: int - The locale independent style identifier for a built-in style. The returned value is one of StyleIdentifier constants.

getStyles()

public StyleCollection getStyles()

Gets the collection of styles this style belongs to.

Returns: StyleCollection - The collection of styles this style belongs to.

getType()

public int getType()

Gets the style type (paragraph or character).

Returns: int - The style type (paragraph or character). The returned value is one of StyleType constants.

hashCode()

public native int hashCode()

Returns: int

isHeading()

public boolean isHeading()

True when the style is one of the built-in Heading styles.

Returns: boolean - The corresponding boolean value.

isQuickStyle()

public boolean isQuickStyle()

Specifies whether this style is shown in the Quick Style gallery inside MS Word UI.

Returns: boolean - The corresponding boolean value.

isQuickStyle(boolean value)

public void isQuickStyle(boolean value)

Specifies whether this style is shown in the Quick Style gallery inside MS Word UI.

Parameters:

Parameter Type Description
value boolean The corresponding boolean value.

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

remove()

public void remove()

Removes the specified style from the document. Style removal has following effects on the document model:

  • All references to the style are removed from corresponding paragraphs, runs and tables.
  • If base style is removed its formatting is moved to child styles.
  • If style to be deleted has a linked style, then both of these are deleted.

removeParaAttr(int key)

public void removeParaAttr(int key)

Parameters:

Parameter Type Description
key int

removeRunAttr(int key)

public void removeRunAttr(int key)

Parameters:

Parameter Type Description
key int

setBaseStyleName(String value)

public void setBaseStyleName(String value)

Gets/sets the name of the style this style is based on. This will be an empty string if the style is not based on any other style and it can be set to an empty string.

Parameters:

Parameter Type Description
value java.lang.String The corresponding java.lang.String value.

setName(String value)

public void setName(String value)

Sets the name of the style.

Can not be empty string.

If there already is a style with such name in the collection, then this style will override it. All affected nodes will reference new style.

Parameters:

Parameter Type Description
value java.lang.String The name of the style.

setNextParagraphStyleName(String value)

public void setNextParagraphStyleName(String value)

Gets/sets the name of the style to be applied automatically to a new paragraph inserted after a paragraph formatted with the specified style. This property is not used by Aspose.Words. The next paragraph style will only be applied automatically when you edit the document in MS Word.

Parameters:

Parameter Type Description
value java.lang.String The corresponding java.lang.String value.

setParaAttr(int key, Object value)

public void setParaAttr(int key, Object value)

Parameters:

Parameter Type Description
key int
value java.lang.Object

setRunAttr(int key, Object value)

public void setRunAttr(int key, Object value)

Parameters:

Parameter Type Description
key int
value java.lang.Object

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int