StyleCollectionItem Property (String)

Gets a style by name or alias.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public Style this[
	string name
] { get; }

Parameters

name
Type: SystemString

Property Value

Type: Style
Remarks

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.

Examples
Shows when to request page layout of the document to be recalculated.
Document doc = new Document(MyDir + "Rendering.docx");

// Saving a document to PDF or to image or printing for the first time will automatically
// layout document pages and this information will be cached inside the document
doc.Save(ArtifactsDir + "Rendering.UpdatePageLayout.1.pdf");

// Modify the document in any way
doc.Styles["Normal"].Font.Size = 6;
doc.Sections[0].PageSetup.Orientation = Aspose.Words.Orientation.Landscape;

// In the current version of Aspose.Words, modifying the document does not automatically rebuild 
// the cached page layout. If you want to save to PDF or render a modified document again,
// you need to manually request page layout to be updated
doc.UpdatePageLayout();

doc.Save(ArtifactsDir + "Rendering.UpdatePageLayout.2.pdf");
See Also