Class WParagraphStyle
Represents a style of paragraph.
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Base.dll
Syntax
public class WParagraphStyle : Style, IXDLSSerializable, IWParagraphStyle, IStyle
Examples
private void Button1_Click(System.Object sender, System.EventArgs e)
{
//Create a new Word document
WordDocument document = new WordDocument();
//Add new section to the document
IWSection section = document.AddSection();
//Creates Paragraph styles.
WParagraphStyle style = document.AddParagraphStyle("Heading 1") as WParagraphStyle;
//Applies the base style.
style.ApplyBaseStyle("Normal");
//Applies character formats.
style.CharacterFormat.FontName = "Calibri Light";
style.CharacterFormat.FontSize = 16f;
style.CharacterFormat.TextColor = System.Drawing.Color.FromArgb(46, 116, 181);
//Applies paragraph formats.
style.ParagraphFormat.BeforeSpacing = 12;
style.ParagraphFormat.AfterSpacing = 0;
style.ParagraphFormat.Keep = true;
style.ParagraphFormat.KeepFollow = true;
style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1;
//Add new paragraph
WParagraph paragraph = section.AddParagraph() as WParagraph;
//Apply style
paragraph.ApplyStyle("Heading 1");
paragraph.AppendText("Applying paragraph style");
//Save and close the Word document
document.Save("Sample1.docx", FormatType.Docx);
document.Close();
}
Private Sub button_Click(sender As Object, e As EventArgs)
'Create a new Word document
Dim document As New WordDocument()
'Add new section to the document
Dim section As IWSection = document.AddSection()
'Creates Paragraph styles.
Dim style As WParagraphStyle = TryCast(document.AddParagraphStyle("Heading 1"), WParagraphStyle)
'Applies the base style.
style.ApplyBaseStyle("Normal")
'Applies character formats.
style.CharacterFormat.FontName = "Calibri Light"
style.CharacterFormat.FontSize = 16.0F
style.CharacterFormat.TextColor = System.Drawing.Color.FromArgb(46, 116, 181)
'Applies paragraph formats.
style.ParagraphFormat.BeforeSpacing = 12
style.ParagraphFormat.AfterSpacing = 0
style.ParagraphFormat.Keep = True
style.ParagraphFormat.KeepFollow = True
style.ParagraphFormat.OutlineLevel = OutlineLevel.Level1
'Add new paragraph
Dim paragraph As WParagraph = TryCast(section.AddParagraph(), WParagraph)
'Apply style
paragraph.ApplyStyle("Heading 1")
paragraph.AppendText("Applying paragraph style")
'Save and close the Word document
document.Save("Sample1.docx", FormatType.Docx)
document.Close()
End Sub
Constructors
WParagraphStyle(IWordDocument)
Initializes a new instance of the WParagraphStyle class with the specified IWordDocument instance.
Declaration
public WParagraphStyle(IWordDocument doc)
Parameters
Type | Name | Description |
---|---|---|
IWordDocument | doc | The IWordDocument instance. |
Fields
m_listFormat
Member that specifies the list format.
Declaration
protected WListFormat m_listFormat
Field Value
Type |
---|
WListFormat |
m_prFormat
Member that specifies the paragraph format.
Declaration
protected WParagraphFormat m_prFormat
Field Value
Type |
---|
WParagraphFormat |
Properties
BaseStyle
Gets the base style of the paragraph. Read-only.
Declaration
public WParagraphStyle BaseStyle { get; }
Property Value
Type | Description |
---|---|
WParagraphStyle | The WParagraphStyle instance that specifies the base style. |
ListFormat
Gets the format of the list for the paragraph. Read-only.
Declaration
public WListFormat ListFormat { get; }
Property Value
Type | Description |
---|---|
WListFormat | The WListFormat instance that specifies the list format. |
ParagraphFormat
Gets the formatting of paragraph. Read-only.
Declaration
public WParagraphFormat ParagraphFormat { get; }
Property Value
Type | Description |
---|---|
WParagraphFormat | The WParagraphFormat instance that specifies the paragraph format. |
StyleType
Gets the type of the style. Read-only.
Declaration
public override StyleType StyleType { get; }
Property Value
Type | Description |
---|---|
StyleType | The StyleType member that specifies the type of the style. |
Overrides
Methods
ApplyBaseStyle(String)
Applies the base style for the current paragraph style.
Declaration
public override void ApplyBaseStyle(string styleName)
Parameters
Type | Name | Description |
---|---|---|
System.String | styleName | The name of the style to be applied. |
Overrides
Clone()
Creates a duplicate copy of the style.
Declaration
public override IStyle Clone()
Returns
Type | Description |
---|---|
IStyle | The reference to the newly created object. |
Overrides
CloneImpl()
Creates a duplicate copy of the entity.
Declaration
protected override object CloneImpl()
Returns
Type | Description |
---|---|
System.Object | An System.Object reference to the newly created object. |
Overrides
InitXDLSHolder()
Registers child objects in XDSL holder.
Declaration
protected override void InitXDLSHolder()
Overrides
Explicit Interface Implementations
IWParagraphStyle.Close()
Declaration
void IWParagraphStyle.Close()