ASPOSE home

com.aspose.words
Class Styles

java.lang.Object
    extended by com.aspose.words.Styles
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable

public class Styles
extends java.lang.Object

A collection of Style objects that represent both the built-in and user-defined styles in a document.

Property Getters/Setters Summary
intgetCount()
           Gets the number of styles in the collection.
DocumentgetDocument()
           Gets the owner document.
Styleget(int index)
           Gets a style by index.
Styleget(java.lang.String name)
           Gets a style by name or alias.
StylegetByStyleIdentifier(int sti)
           Gets a built-in style by its locale independent identifier.
 
Method Summary
Styleadd(int type, java.lang.String name)
           Creates a new user defined style and adds it the collection.
java.util.Iteratoriterator()
           Gets the enumerator object that will enumerate styles in the alphabetical order of their names.
 

Property Getters/Setters Detail

getDocument

public Document getDocument()
Gets the owner document.

getCount

public int getCount()
Gets the number of styles in the collection.

get

public Style get(java.lang.String name)
Gets a style by name or alias.

Case sensitive, returns null if the style with the given name is not found.

If this is an English name of a built in style that does not yet exist, automatically creates it.


getByStyleIdentifier

public Style getByStyleIdentifier(int sti)
Gets a built-in style by its locale independent identifier.

When accessing a style that does not yet exist, automatically creates it.

Parameters:
sti - A StyleIdentifier value. A StyleIdentifier value that specifies the built in style to retrieve.

get

public Style get(int index)
Gets a style by index.

Method Detail

iterator

public java.util.Iterator iterator()
Gets the enumerator object that will enumerate styles in the alphabetical order of their names.

add

public Style add(int type, java.lang.String name)
Creates a new user defined style and adds it the collection.

You can create character, paragraph or a list style.

When creating a list style, the style is created with default numbered list formatting (1 \ a \ i).

Throws an exception if a style with this name already exists.

Parameters:
type - A StyleType value that specifies the type of the style to create.
name - Case sensitive name of the style to create.

See Also:
          Wiki - the home page for the Aspose.Words Product Documentation that includes Programmer's Guide, Knowledge Base and other articles.
          Aspose.Words Support Forum - our preferred method of support.
          Aspose.Words Team - contact Aspose.Words Team.


ASPOSE home