当前位置: 首页>>代码示例>>C#>>正文


C# DocumentBuilder.InsertTextInput方法代码示例

本文整理汇总了C#中DocumentBuilder.InsertTextInput方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentBuilder.InsertTextInput方法的具体用法?C# DocumentBuilder.InsertTextInput怎么用?C# DocumentBuilder.InsertTextInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DocumentBuilder的用法示例。


在下文中一共展示了DocumentBuilder.InsertTextInput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertTextInputFormField

        public static void InsertTextInputFormField(string dataDir)
        {
            // ExStart:DocumentBuilderInsertTextInputFormField
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.InsertTextInput("TextInput", TextFormFieldType.Regular, "", "Hello", 0);
            dataDir = dataDir + "DocumentBuilderInsertTextInputFormField_out.doc";
            doc.Save(dataDir);
            // ExEnd:DocumentBuilderInsertTextInputFormField
            Console.WriteLine("\nText input form field using DocumentBuilder inserted successfully into a document.\nFile saved at " + dataDir);
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:12,代码来源:DocumentBuilderInsertElements.cs

示例2: InsertAndRetrieveFormFields

        public void InsertAndRetrieveFormFields()
        {
            //ExStart
            //ExFor:DocumentBuilder.InsertTextInput
            //ExId:FormFieldsInsertAndRetrieve
            //ExSummary:Shows how to insert form fields, set options and gather them back in for use 
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Insert a text input field. The unique name of this field is "TextInput1", the other parameters define
            // what type of FormField it is, the format of the text, the field result and the maximum text length (0 = no limit)
            builder.InsertTextInput("TextInput1", TextFormFieldType.Regular, "", "", 0);
            //ExEnd
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:14,代码来源:ExFormFields.cs

示例3: DocumentBuilderInsertTextInputFormField

        public void DocumentBuilderInsertTextInputFormField()
        {
            //ExStart
            //ExFor:DocumentBuilder.InsertTextInput
            //ExId:DocumentBuilderInsertTextInputFormField
            //ExSummary:Shows how to insert a text input form field into a document.
            Aspose.Words.Document doc = new Aspose.Words.Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.InsertTextInput("TextInput", TextFormFieldType.Regular, "", "Hello", 0);
            //ExEnd
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:12,代码来源:ExDocumentBuilder.cs

示例4: CreateForm

        public void CreateForm()
        {
            //ExStart
            //ExFor:TextFormFieldType
            //ExFor:DocumentBuilder.InsertTextInput
            //ExFor:DocumentBuilder.InsertComboBox
            //ExFor:DocumentBuilder.InsertCheckBox
            //ExSummary:Builds a sample form to fill.
            DocumentBuilder builder = new DocumentBuilder();

            // Insert a text form field for input a name.
            builder.InsertTextInput("", TextFormFieldType.Regular, "", "Enter your name here", 30);

            // Insert two blank lines.
            builder.Writeln("");
            builder.Writeln("");

            string[] items = new string[]
                {
                    "-- Select your favorite footwear --",
                    "Sneakers",
                    "Oxfords",
                    "Flip-flops",
                    "Other",
                    "I prefer to be barefoot"
                };

            // Insert a combo box to select a footwear type.
            builder.InsertComboBox("", items, 0);

            // Insert 2 blank lines.
            builder.Writeln("");
            builder.Writeln("");

            // Insert a check box to ensure the form filler does look after his/her footwear.
            builder.InsertCheckBox("", true, 0);
            builder.Writeln("My boots are always polished and nice-looking.");

            builder.Document.Save(ExDir + "DocumentBuilder.CreateForm Out.doc");
            //ExEnd
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:41,代码来源:ExDocumentBuilder.cs

示例5: DeleteFormFieldAssociatedWithTheFormField

        public void DeleteFormFieldAssociatedWithTheFormField()
        {
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.StartBookmark("MyBookmark");
            builder.InsertTextInput("TextInput1", TextFormFieldType.Regular, "TestFormField", "SomeText", 0);
            builder.EndBookmark("MyBookmark");

            MemoryStream dstStream = new MemoryStream();
            doc.Save(dstStream, SaveFormat.Docx);

            BookmarkCollection bookmarkBeforeDeleteFormField = doc.Range.Bookmarks;
            Assert.AreEqual("MyBookmark", bookmarkBeforeDeleteFormField[0].Name);

            FormField formField = doc.Range.FormFields[0];
            formField.RemoveField();

            BookmarkCollection bookmarkAfterDeleteFormField = doc.Range.Bookmarks;
            Assert.AreEqual("MyBookmark", bookmarkAfterDeleteFormField[0].Name);
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:21,代码来源:ExFormFields.cs

示例6: CreateForm

        public void CreateForm()
        {
            //ExStart
            //ExFor:TextFormFieldType
            //ExFor:DocumentBuilder.InsertTextInput
            //ExFor:DocumentBuilder.InsertComboBox
            //ExSummary:Builds a sample form to fill.
            DocumentBuilder builder = new DocumentBuilder();

            // Insert a text form field for input a name.
            builder.InsertTextInput("", TextFormFieldType.Regular, "", "Enter your name here", 30);

            // Insert two blank lines.
            builder.Writeln("");
            builder.Writeln("");

            string[] items = new string[]
                {
                    "-- Select your favorite footwear --",
                    "Sneakers",
                    "Oxfords",
                    "Flip-flops",
                    "Other",
                    "I prefer to be barefoot"
                };

            // Insert a combo box to select a footwear type.
            builder.InsertComboBox("", items, 0);

            // Insert 2 blank lines.
            builder.Writeln("");
            builder.Writeln("");

            builder.Document.Save(MyDir + @"\Artifacts\DocumentBuilder.CreateForm.doc");
            //ExEnd
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:36,代码来源:ExDocumentBuilder.cs


注:本文中的DocumentBuilder.InsertTextInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。