public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithFields(); Document doc = new Document(dataDir + "TestFile.doc"); // Pass the appropriate parameters to convert PAGE fields encountered to static text only in the body of the first section. FieldsHelper.ConvertFieldsToStaticText(doc.FirstSection.Body, FieldType.FieldPage); // Save the document with fields transformed to disk. doc.Save(dataDir + "TestFileBody Out.doc"); Console.WriteLine("\nConverted fields to static text in the document body successfully.\nFile saved at " + dataDir + "TestFileBody Out.doc"); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithFields(); Document doc = new Document(dataDir + "TestFile.doc"); // Pass the appropriate parameters to convert all IF fields encountered in the document (including headers and footers) to static text. FieldsHelper.ConvertFieldsToStaticText(doc, FieldType.FieldIf); // Save the document with fields transformed to disk. doc.Save(dataDir + "TestFileDocument Out.doc"); Console.WriteLine("\nConverted fields to static text in the document successfully.\nFile saved at " + dataDir + "TestFileDocument Out.doc"); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithFields(); Document doc = new Document(dataDir + "TestFile.doc"); // Pass the appropriate parameters to convert all IF fields to static text that are encountered only in the last // paragraph of the document. FieldsHelper.ConvertFieldsToStaticText(doc.FirstSection.Body.LastParagraph, FieldType.FieldIf); // Save the document with fields transformed to disk. doc.Save(dataDir + "TestFileParagraph Out.doc"); Console.WriteLine("\nConverted fields to static text in the paragraph successfully.\nFile saved at " + dataDir + "TestFileParagraph Out.doc"); }