Skip to content

Commit f4c12db

Browse files
Update Program.cs
1 parent bbf9764 commit f4c12db

File tree

1 file changed

+4
-4
lines changed
  • Fields/Get-field-code/.NET/Get-field-code

1 file changed

+4
-4
lines changed

Fields/Get-field-code/.NET/Get-field-code/Program.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Syncfusion.DocIO;
1+
using Syncfusion.DocIO;
22
using Syncfusion.DocIO.DLS;
33
using System;
44
using System.IO;
@@ -15,11 +15,11 @@ static void Main(string[] args)
1515
// Load the template document.
1616
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
1717
{
18-
// Access the merge field in the first paragraph of the first section.
19-
WMergeField mergeField = document.Sections[0].Paragraphs[0].ChildEntities[2] as WMergeField;
18+
// Access the field in the first paragraph of the first section.
19+
WField field = document.Sections[0].Paragraphs[0].ChildEntities[2] as WField;
2020

2121
// Get and print the field code of the merge field.
22-
string fieldCode = mergeField.FieldCode;
22+
string fieldCode = field.FieldCode;
2323
Console.WriteLine(fieldCode);
2424
}
2525
}

0 commit comments

Comments
 (0)