I have a Word document that contains fields and I want to remove the fields and keep the displayed text.I try the code below, but the fields is displayed in Chinese after the call Update()
and Unlink()
. How can I keep the English displayed after processing? I opened the original file with MS Office, and the fields auto-update is normal.
void Main()
{
var doc = new Aspose.Words.Document(@"C:\Users\543\Downloads\unlinkFields.doc");
foreach (var field in doc.Range.Fields)
{
field.Update();
field.Unlink();
}
doc.Save(@"C:\Users\543\Downloads\result.doc");
}
Version info:
Aspose.Words for Net 23.6
The demo file
unlinkFields.7z (45.9 KB)
The screenshot
20230617131145.png (67.7 KB)
OS Version Info
Windows 11 Home Chinese Edition
.NET Version Info
Net Framework 4.7