Table of Contents

Method DefineStyle

Namespace
DocWright.Composition
Assembly
DocWright.Composition.dll

DefineStyle(string, string, Action<IStyleComposer>)

Defines a named style. A composition style is a Word style, so it survives SaveAsDocx(Stream, SaveOptions?) and behaves in Word exactly as it rendered in the PDF.

IDocumentComposer DefineStyle(string styleId, string name, Action<IStyleComposer> define)

Parameters

styleId string

The style id, for example "Heading1".

name string

The style's display name, as Word shows it.

define Action<IStyleComposer>

Defines the style's formatting.

Returns

IDocumentComposer

This composer, for chaining.

Exceptions

ArgumentNullException

A required argument is null.

ArgumentException

styleId is empty.

InvalidOperationException

A style with that id is already defined.