WSeqField Class
Represents the sequence field in the Word document.
Inheritance
Inherited Members
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)
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
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 |
---|
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 |
---|
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 |
---|
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 |
---|
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 |
---|
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
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 |
---|
System.String[] |
ParseFieldCode(String)
Declaration
protected override void ParseFieldCode(string fieldCode)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldCode |
Overrides
UpdateFieldCode(String)
updates field code
Declaration
protected override void UpdateFieldCode(string fieldCode)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldCode |