using System; using Docs.Word; namespace SampleManager { class FormFields_Create { internal static Document Main1() { // Create a new document and get NodeList of first section Document Doc = Document.CreateNew(); NodeList Nodes = Doc.Sections[0].Nodes; // Enable protection from editing for all sections with enabled protection Doc.Properties.DocStatus.ProtectionEnabled = true; // Enables protection for the first section of document Doc.Sections[0].Style.Protected = true; // Add checkbox form field which is checked by default Nodes.AddParagraph("Some checkbox option:"); Nodes.AddParagraph().AddFormField_CheckBox("CheckBox 1", true); // Add textbox form field with default text "Hello!" and maximum length of 15 Nodes.AddParagraph("Some textbox for text input:"); Nodes.AddParagraph().AddFormField_TextBox("TextBox 1", 15, "Hello!"); // Add dropdown list form field with items "Item1", "Item2", "Item3" Nodes.AddParagraph("Some dropdown listbox:"); Nodes.AddParagraph().AddFormField_DropList("DropList 1", "Item1", "Item2", "Item3"); return Doc; } } }