Skip to content

Commit

Permalink
Find-and-replace-merge-field-name
Browse files Browse the repository at this point in the history
  • Loading branch information
DharanyaSakthivel-SF4210 committed Feb 14, 2025
1 parent ecff2b0 commit 36abcf7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ static void Main(string[] args)
// Finds all merge fields in the document.
List<Entity> mergeFields = document.FindAllItemsByProperty(EntityType.MergeField, null, null);
// Replaces the merge field name "first_name" with "FirstName".
ReplaceMergeFieldName("first_name", "FirstName", mergeFields);
ReplaceMergeFieldName("Forename", "FirstName", mergeFields);
// Replaces the merge field name "last_name" with "LastName".
ReplaceMergeFieldName("last_name", "LastName", mergeFields);
ReplaceMergeFieldName("Surname", "LastName", mergeFields);
// Creates a file stream to save the modified document.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
Expand Down

0 comments on commit 36abcf7

Please sign in to comment.