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


C# DocumentBuilder.InsertCheckBox方法代码示例

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


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

示例1: InsertCheckBoxFormField

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

            builder.InsertCheckBox("CheckBox", true, true, 0);
            dataDir = dataDir + "DocumentBuilderInsertCheckBoxFormField_out.doc";
            doc.Save(dataDir);
            // ExEnd:DocumentBuilderInsertCheckBoxFormField
            Console.WriteLine("\nCheckbox form field using DocumentBuilder inserted successfully into a document.\nFile saved at " + dataDir);
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:12,代码来源:DocumentBuilderInsertElements.cs

示例2: DocumentBuilder

 /// <summary>
 /// This is called for each merge field in the document
 /// when Document.MailMerge.ExecuteWithRegions is called.
 /// </summary>
 void IFieldMergingCallback.FieldMerging(FieldMergingArgs e)
 {
     if (e.DocumentFieldName.Equals("CourseName"))
     {
         // Insert the checkbox for this merge field, using DocumentBuilder.
         DocumentBuilder builder = new DocumentBuilder(e.Document);
         builder.MoveToMergeField(e.FieldName);
         builder.InsertCheckBox(e.DocumentFieldName + this.mCheckBoxCount.ToString(), false, 0);
         builder.Write((string)e.FieldValue);
         this.mCheckBoxCount++;
     }
 }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:16,代码来源:ExMailMergeEvent.cs

示例3: 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

示例4: DocumentBuilderInsertCheckBoxFormField

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

            builder.InsertCheckBox("CheckBox", true, 0);
            //ExEnd
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:12,代码来源:ExDocumentBuilder.cs

示例5: InsertCheckBoxEx

        public void InsertCheckBoxEx()
        {
            //ExStart
            //ExFor:DocumentBuilder.InsertCheckBox(String, Boolean, Int32)
            //ExFor:DocumentBuilder.InsertCheckBox(String, Boolean, Boolean, Int32)
            //ExSummary:Shows how to insert a check box into a document.
            Aspose.Words.Document doc = new Aspose.Words.Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            // Insert a checkbox with no default value and let MS Word apply the default size.
            builder.Writeln("Check box 1");
            builder.InsertCheckBox("CheckBox1", false, 0);
            builder.Writeln();

            // Insert a checked checkbox with a specified value.
            builder.Writeln("Check box 2");
            builder.InsertCheckBox("CheckBox2", false, true, 50);

            doc.Save(MyDir + @"Document.InsertedCheckBoxes.doc");
            //ExEnd
        }
开发者ID:animaal,项目名称:Aspose_Words_NET,代码行数:21,代码来源:ExDocumentBuilder.cs

示例6: ExportFormFields

        public void ExportFormFields(bool exportFormFields)
        {
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.InsertCheckBox("CheckBox", false, 15);

            HtmlFixedSaveOptions htmlFixedSaveOptions = new HtmlFixedSaveOptions
            {
                SaveFormat = SaveFormat.HtmlFixed,
                ExportEmbeddedCss = true,
                ExportEmbeddedFonts = true,
                ExportEmbeddedImages = true,
                ExportEmbeddedSvg = true,
                ExportFormFields = exportFormFields
            };

            //For assert test result you need to open documents and check that checkbox are clickable in "ExportFormFiels.html" file and are not clickable in "WithoutExportFormFiels.html" file
            if (exportFormFields == true)
            {
                doc.Save(MyDir + "ExportFormFiels.html", htmlFixedSaveOptions);
            }
            else
            {
                doc.Save(MyDir + "WithoutExportFormFiels.html", htmlFixedSaveOptions);
            }
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:27,代码来源:ExHtmlFixedSaveOptions.cs

示例7: InsertCheckBox

        /// <summary>
        /// Insert CheckBox into a Word cell
        /// </summary>
        /// <param name="excelCheckbox">Excel CheckBox</param>
        /// <param name="parentCell">Parent Word cell</param>
        private void InsertCheckBox(Aspose.Cells.Drawing.CheckBox excelCheckbox, Aspose.Words.Tables.Cell parentCell)
        {
            //Create new temporary document
            Document doc = new Document();
            //Create instance of DocumentBuilder
            DocumentBuilder builder = new DocumentBuilder(doc);
            //Calculate size of CheckBox
            int size = (int)(ConvertUtil.PixelToPoint(excelCheckbox.Height));

            switch (excelCheckbox.CheckedValue)
            {
                case CheckValueType.Checked:
                    {
                        builder.InsertCheckBox(excelCheckbox.Name, true, size);
                        break;
                    }
                case CheckValueType.UnChecked:
                    {
                        builder.InsertCheckBox(excelCheckbox.Name, false, size);
                        break;
                    }
                default:
                    {
                        builder.InsertCheckBox(excelCheckbox.Name, false, size);
                        break;
                    }
            }
            //Write text of Excel CheckBox
            builder.Write(excelCheckbox.Text);

            //Import all content of temporary document into a destination cell
            foreach (Node node in builder.CurrentParagraph.ChildNodes)
            {
                parentCell.LastParagraph.AppendChild(parentCell.Document.ImportNode(node, true));
            }
        }
开发者ID:nancyeiceblue,项目名称:Aspose_Words_NET,代码行数:41,代码来源:ConverterXls2Doc.cs

示例8: InsertCheckBoxEmptyName

        public void InsertCheckBoxEmptyName()
        {
            Document doc = new Document();

            DocumentBuilder builder = new DocumentBuilder(doc);

            //Assert that empty string name working correctly
            builder.InsertCheckBox("", true, false, 1);
            builder.InsertCheckBox(string.Empty, false, 1);
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:10,代码来源:ExDocumentBuilder.cs

示例9: InsertCheckBox

        public void InsertCheckBox()
        {
            //ExStart
            //ExFor:DocumentBuilder.InsertCheckBox(string, bool, bool, int)
            //ExFor:DocumentBuilder.InsertCheckBox(string, bool, int)
            Document doc = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            //Insert checkboxes
            //With Default value
            builder.InsertCheckBox("CheckBox_DefaultAndCheckedValue", false, true, 0);

            //Without Default value
            builder.InsertCheckBox("CheckBox_OnlyCheckedValue", true, 100);
            //ExEnd

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

            //Get checkboxes from the document
            FormFieldCollection formFields = doc.Range.FormFields;

            //Check that is the right checkbox
            Assert.AreEqual("CheckBox_DefaultAndCheckedValue", formFields[0].Name);

            //Assert that parameters sets correctly
            Assert.AreEqual(true, formFields[0].Checked);
            Assert.AreEqual(false, formFields[0].Default);
            Assert.AreEqual(10, formFields[0].CheckBoxSize);

            //Check that is the right checkbox
            Assert.AreEqual("CheckBox_OnlyCheckedValue", formFields[1].Name);

            //Assert that parameters sets correctly
            Assert.AreEqual(false, formFields[1].Checked);
            Assert.AreEqual(false, formFields[1].Default);
            Assert.AreEqual(100, formFields[1].CheckBoxSize);
        }
开发者ID:aspose-words,项目名称:Aspose.Words-for-.NET,代码行数:38,代码来源:ExDocumentBuilder.cs


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