WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class WSeqField

    Show / Hide Table of Contents

    Class WSeqField

    Represents the sequence field in the Word document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Entity
    WidgetBase
    ParagraphItem
    WTextRange
    WField
    WSeqField
    Implements
    IXDLSSerializable
    IOfficeRun
    IWField
    IWTextRange
    IParagraphItem
    IEntity
    Inherited Members
    WField.m_fieldType
    WField.m_bConvertedToText
    WField.m_paraItemType
    WField.m_formattingString
    WField.m_fieldValue
    WField.m_textFormat
    WField.ReadXmlAttributes(IXDLSAttributeReader)
    WField.WriteXmlAttributes(IXDLSAttributeWriter)
    WField.CreateLayoutInfo()
    WField.CloneImpl()
    WField.Update()
    WField.RemoveText(String, String)
    WField.SplitIfArguments(String, List<Int32>, String)
    WField.UpdateCondition(String, List<Int32>, String)
    WField.RemoveMergeFormat(String)
    WField.Unlink()
    WField.UpdateTextForTextBodyItem(Entity, Boolean)
    WField.UpdateTextForParagraphItem(Entity, Boolean)
    WField.ParseField(String)
    WField.ParseFieldFormat(String[])
    WField.GetClonedTable(Entity)
    WField.RemovePreviousResult()
    WField.GetTextRange(String)
    WField.TextFormat
    WField.FieldPattern
    WField.FieldValue
    WField.FieldType
    WField.FieldCode
    WField.Text
    WTextRange.ApplyCharacterFormat(WCharacterFormat)
    WTextRange.InitXDLSHolder()
    WTextRange.WriteXmlContent(IXDLSContentWriter)
    WTextRange.ReadXmlContent(IXDLSContentReader)
    WTextRange.CharacterFormat
    ParagraphItem.m_charFormat
    ParagraphItem.ApplyStyle(String)
    ParagraphItem.CloneRun()
    ParagraphItem.Dispose()
    ParagraphItem.OwnerParagraph
    ParagraphItem.IsInsertRevision
    ParagraphItem.IsDeleteRevision
    ParagraphItem.OwnerMathRunElement
    Entity.Clone()
    Entity.Owner
    Entity.NextSibling
    Entity.PreviousSibling
    Entity.IsComposite
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.XDLSHolder
    OwnerHolder.m_doc
    OwnerHolder.Document
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Base.dll
    Syntax
    public class WSeqField : WField, IXDLSSerializable, IOfficeRun, IStringWidget, ISplitLeafWidget, ITextMeasurable, IWField, IWTextRange, IParagraphItem, IEntity, ILeafWidget, IWidget
    Examples
    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document 
        WordDocument document = new WordDocument("Bookmarks.docx");
        //Add new paragraph to the section
        WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
        //Append sequence field to the paragraph
        WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
        //Set the bookmark name as caption and number format
        field.CaptionName = "Northwind";
        field.NumberFormat = CaptionNumberingFormat.Roman;
        //Save and close the document
        document.Save("Sample.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("Bookmarks.docx")
        'Add new paragraph to the section
        Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
        'Append sequence field to the paragraph
        Dim field As WSeqField = DirectCast(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
        'Set the bookmark name as caption and number format
        field.CaptionName = "Northwind"
        field.NumberFormat = CaptionNumberingFormat.Roman
        'Save and close the document
        document.Save("Sample.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    WSeqField(IWordDocument)

    Initializes a new instance of the WSeqField class with the specified IWordDocument instance.

    Declaration
    public WSeqField(IWordDocument doc)
    Parameters
    Type Name Description
    IWordDocument doc

    The IWordDocument instance.

    WSeqField(WField)

    Initializes a new instance of the WSeqField class with the specified WField instance.

    Declaration
    protected WSeqField(WField field)
    Parameters
    Type Name Description
    WField field

    The WField instance.

    Properties

    BookmarkName

    Gets or sets a bookmark name that refers to an item elsewhere in the document rather than in the current location.

    Declaration
    public string BookmarkName { get; set; }
    Property Value
    Type Description
    System.String

    The string that specifies the bookmark name.

    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the BookmarkName of the SeqField.
     field.BookmarkName = "Bookmark1";
    //Updates the document fields
    document.UpdateDocumentFields();
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    'Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    'Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    'Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    'Set the BookmarkName of the SeqField.
     field.BookmarkName = "Bookmark1"
    'Updates the document fields
    document.UpdateDocumentFields()
    'Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    CaptionName

    Gets or sets caption name.

    Declaration
    public string CaptionName { get; set; }
    Property Value
    Type Description
    System.String

    The string that specifies the caption name.

    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the CaptionName of the SeqField.
    field.CaptionName = "Test";        
    //Updates the document fields
    document.UpdateDocumentFields();        
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    'Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    'Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    'Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    'Set the CaptionName of the SeqField.
     field.CaptionName = "Test";    
    //Updates the document fields
    document.UpdateDocumentFields()
    'Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    EntityType

    Gets the type of the entity. Read-only

    Declaration
    public override EntityType EntityType { get; }
    Property Value
    Type Description
    EntityType

    The EntityType of the current item.

    Overrides
    WField.EntityType

    FormattingString

    Gets the formatting string of the sequence field. Read-only.

    Declaration
    public string FormattingString { get; }
    Property Value
    Type Description
    System.String

    The string that specifies the formatting text.

    HideResult

    Gets or sets whether to hides the field result unless a general-formatting-switch is also present. Default value is false.

    Declaration
    public bool HideResult { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the HideResult of the SeqField.
    field.HideResult = true;
    //Updates the document fields
    document.UpdateDocumentFields();
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    //Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    //Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    //Set the HideResult of the SeqField.
    field.HideResult = True
    //Updates the document fields
    document.UpdateDocumentFields()
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    InsertNextNumber

    Gets or sets whether to insert the next sequence number for the specified item. Default value is true.

    Declaration
    public bool InsertNextNumber { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the InsertNextNumber of the SeqField.
    field.InsertNextNumber = true;
    //Updates the document fields
    document.UpdateDocumentFields();
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    'Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    'Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    'Set the InsertNextNumber of the SeqField.
    field.InsertNextNumber = True
    'Updates the document fields
    document.UpdateDocumentFields()
    'Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    NumberFormat

    Gets or sets the type of caption numbering.

    Declaration
    public CaptionNumberingFormat NumberFormat { get; set; }
    Property Value
    Type Description
    CaptionNumberingFormat

    The CaptionNumberingFormat member that specifies the format for caption numbering.

    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the NumberFormat of the SeqField.
    field.NumberFormat = CaptionNumberingFormat.Number; 
    //Updates the document fields
    document.UpdateDocumentFields(); 
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    'Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    'Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    'Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    'Set the NumberFormat of the SeqField.
    field.NumberFormat = CaptionNumberingFormat.Number
    'Updates the document fields
    document.UpdateDocumentFields()
    'Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    RepeatNearestNumber

    Gets or sets whether to repeats the closest preceding sequence number. Default value is false.

    Declaration
    public bool RepeatNearestNumber { get; set; }
    Property Value
    Type Description
    System.Boolean
    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the RepeatNearestNumber of the SeqField.
    field.RepeatNearestNumber = true;
    //Updates the document fields
    document.UpdateDocumentFields();
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    'Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    'Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    'Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    'Set the RepeatNearestNumber of the SeqField.
    field.RepeatNearestNumber = True
    'Updates the document fields
    document.UpdateDocumentFields()
    'Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    ResetHeadingLevel

    Gets or sets an integer number representing a heading level to reset the sequence number to. Returns -1 if the number is absent.

    Declaration
    public int ResetHeadingLevel { get; set; }
    Property Value
    Type Description
    System.Int32
    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the ResetHeadingLevel of the SeqField.
    field.ResetHeadingLevel = 1;
    //Updates the document fields
    document.UpdateDocumentFields();
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    //Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    //Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    //Set the ResetHeadingLevel of the SeqField.
    field.ResetHeadingLevel = 1;
    //Updates the document fields
    document.UpdateDocumentFields()
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    ResetNumber

    Gets or sets an integer number to reset the sequence number to. Returns -1 if the number is absent.

    Declaration
    public int ResetNumber { get; set; }
    Property Value
    Type Description
    System.Int32
    Examples
    //Load an existing Word document into DocIO instance.
    WordDocument document = new WordDocument("Template.docx");
    //Add new paragraph to the section
    WParagraph paragraph = document.Sections[0].AddParagraph() as WParagraph;
    //Append sequence field to the paragraph
    WSeqField field = (WSeqField)paragraph.AppendField("Sequence field", FieldType.FieldSequence);
    //Set the ResetNumber of the SeqField.
    field.ResetNumber = 7;
    //Updates the document fields
    document.UpdateDocumentFields();
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx);
    document.Close();
    Load an existing Word document into DocIO instance.
    Dim document As WordDocument = New WordDocument("Template.docx")
    //Add new paragraph to the section
    Dim paragraph As WParagraph = TryCast(document.Sections(0).AddParagraph(), WParagraph)
    //Append sequence field to the paragraph
    Dim field As WSeqField = CType(paragraph.AppendField("Sequence field", FieldType.FieldSequence), WSeqField)
    //Set the ResetNumber of the SeqField.
    field.ResetNumber = 7
    //Updates the document fields
    document.UpdateDocumentFields()
    //Save and Close the Word document.
    document.Save("Sample.docx", FormatType.Docx)
    document.Close()

    Methods

    ConvertSwitchesToString()

    Converts the switches to string.

    Declaration
    protected override string ConvertSwitchesToString()
    Returns
    Type Description
    System.String

    The string that specifies the switches.

    Overrides
    WField.ConvertSwitchesToString()

    GetFieldValues(String)

    Get Field Values - Parse for Field name and field switches

    Declaration
    protected string[] GetFieldValues(string fieldvalue)
    Parameters
    Type Name Description
    System.String fieldvalue
    Returns
    Type Description
    System.String[]

    ParseFieldCode(String)

    Declaration
    protected override void ParseFieldCode(string fieldCode)
    Parameters
    Type Name Description
    System.String fieldCode
    Overrides
    WField.ParseFieldCode(String)

    UpdateFieldCode(String)

    updates field code

    Declaration
    protected override void UpdateFieldCode(string fieldCode)
    Parameters
    Type Name Description
    System.String fieldCode
    Overrides
    WField.UpdateFieldCode(String)

    Implements

    IXDLSSerializable
    IOfficeRun
    IWField
    IWTextRange
    IParagraphItem
    IEntity
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved