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


C# Forms.Document类代码示例

本文整理汇总了C#中System.Windows.Forms.Document的典型用法代码示例。如果您正苦于以下问题:C# Document类的具体用法?C# Document怎么用?C# Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Document类属于System.Windows.Forms命名空间,在下文中一共展示了Document类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: New

 protected override void New(Document doc)
 {
     eduBindingSource.AddNew();
     var editForm = new XtraDictionaryEditEduForm(this,
         (List<municipality>)this.municipalityBindingSource.List, (List<edu_kind>)this.eduKindBindingSource.List, (edu)eduBindingSource.Current);
     editForm.Show(this.ParentForm);
 }
开发者ID:superbatonchik,项目名称:EduFormManager,代码行数:7,代码来源:XtraDictionaryEduControl.cs

示例2: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //Create word document
            Document document = new Document();

            Section section = document.AddSection();
            section.PageSetup.PageSize = PageSize.A4;
            section.PageSetup.Margins.Top = 72f;
            section.PageSetup.Margins.Bottom = 72f;
            section.PageSetup.Margins.Left = 89.85f;
            section.PageSetup.Margins.Right = 89.85f;

            Paragraph paragraph = section.AddParagraph();
            paragraph.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Left;
            paragraph.AppendPicture(ToPDF.Properties.Resources.Word);

            String p1
                = "Microsoft Word is a word processor designed by Microsoft. "
                + "It was first released in 1983 under the name Multi-Tool Word for Xenix systems. "
                + "Subsequent versions were later written for several other platforms including "
                + "IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix PC (1985), "
                + "Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989). ";
            String p2
                = "Microsoft Office Word instead of merely Microsoft Word. "
                + "The 2010 version appears to be branded as Microsoft Word, "
                + "once again. The current versions are Microsoft Word 2010 for Windows and 2008 for Mac.";
            section.AddParagraph().AppendText(p1).CharacterFormat.FontSize = 14;
            section.AddParagraph().AppendText(p2).CharacterFormat.FontSize = 14;

            //Save doc file to pdf.
            document.SaveToFile("Sample.pdf", FileFormat.PDF);

            //Launching the pdf reader to open.
            FileViewer("Sample.pdf");
        }
开发者ID:spirecomponent,项目名称:Word-Library,代码行数:35,代码来源:Form1.cs

示例3: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //Create word document
            Document document = new Document();

            Section section = document.AddSection();

            //page setup
            SetPage(section);

            //insert header and footer
            InsertHeaderAndFooter(section);

            //add cover
            InsertCover(section);

            //insert a break code
            section = document.AddSection();
            section.BreakCode = SectionBreakType.NewPage;

            //add content
            InsertContent(section);

            //Save doc file.
            document.SaveToFile("Sample.doc", FileFormat.Doc);

            //Launching the MS Word file.
            WordDocViewer("Sample.doc");
        }
开发者ID:spirecomponent,项目名称:Word-Library,代码行数:29,代码来源:Form1.cs

示例4: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //Open a blank word document as template
            Document document = new Document(@"..\..\..\..\..\..\Data\Blank.doc");

            //Get the first secition
            Section section = document.Sections[0];

            //Create a new paragraph or get the first paragraph
            Paragraph paragraph
                = section.Paragraphs.Count > 0 ? section.Paragraphs[0] : section.AddParagraph();

            //Append Text
            paragraph.AppendText("Builtin Style:");

            foreach (BuiltinStyle builtinStyle in Enum.GetValues(typeof(BuiltinStyle)))
            {
                paragraph = section.AddParagraph();
                //Append Text
                paragraph.AppendText(builtinStyle.ToString());
                //Apply Style
                paragraph.ApplyStyle(builtinStyle);
            }

            //Save doc file.
            document.SaveToFile("Sample.doc",FileFormat.Doc);

            //Launching the MS Word file.
            WordDocViewer("Sample.doc");


        }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:32,代码来源:Form1.cs

示例5: InsertTemplate

        private void InsertTemplate(Document document, string toInsert)
        {
            var textDocument = document.Object() as TextDocument;

            textDocument.StartPoint.CreateEditPoint();
            textDocument.Selection.Insert(toInsert);
        }
开发者ID:K-Pavlov,项目名称:TemplatorAddIn,代码行数:7,代码来源:TemplateForm.cs

示例6: beginCommand

        public static void beginCommand(Document doc, string strDomain, bool bForAllSystems = false, bool bFitlerUnCalculationSystems = false)
        {
            PressureLossReportHelper helper = PressureLossReportHelper.instance;
             UIDocument uiDocument = new UIDocument(doc);
             if (bFitlerUnCalculationSystems)
             {
            ElementSet calculationOnElems = new ElementSet();
            int nTotalCount = getCalculationElemSet(doc, strDomain, calculationOnElems, uiDocument.Selection.Elements);

            if (calculationOnElems.Size == 0)
            {//No item can be calculated
               popupWarning(ReportResource.allItemsCaculationOff, TaskDialogCommonButtons.Close, TaskDialogResult.Close);
               return;
            }
            else if (calculationOnElems.Size < nTotalCount)
            {//Part of them can be calculated
               if (popupWarning(ReportResource.partOfItemsCaculationOff, TaskDialogCommonButtons.No | TaskDialogCommonButtons.Yes, TaskDialogResult.Yes) == TaskDialogResult.No)
                  return;
            }

            helper.initialize(doc, calculationOnElems, strDomain);
            invokeCommand(doc, helper, bForAllSystems);
             }
             else
             {
            helper.initialize(doc, uiDocument.Selection.Elements, strDomain);
            invokeCommand(doc, helper, bForAllSystems);
             }
        }
开发者ID:jeremytammik,项目名称:UserMepCalculation,代码行数:29,代码来源:PressureLossReportEntry.cs

示例7: Save

 protected override void Save(Document doc)
 {
     if (this.CanSave(doc))
     {
         this.munitEditControl.Save();
     }
 }
开发者ID:superbatonchik,项目名称:EduFormManager,代码行数:7,代码来源:XtraDictionaryMunitControl.cs

示例8: GetChildren

    /// <summary>
    /// Recursively retrieve entire linked document 
    /// hierarchy and return the resulting TreeNode
    /// structure.
    /// </summary>
    void GetChildren( 
      Document mainDoc, 
      ICollection<ElementId> ids, 
      TreeNode parentNode )
    {
      int level = parentNode.Level;

      foreach( ElementId id in ids )
      {
        // Get the child information.

        RevitLinkType type = mainDoc.GetElement( id ) 
          as RevitLinkType;

        string label = LinkLabel( type, level );

        TreeNode subNode = new TreeNode( label );

        Debug.Print( "{0}{1}", Indent( 2 * level ), 
          label );

        parentNode.Nodes.Add( subNode );

        // Go to the next level.

        GetChildren( mainDoc, type.GetChildIds(), 
          subNode );
      }
    }
开发者ID:jeremytammik,项目名称:ListLinkType,代码行数:34,代码来源:Command.cs

示例9: getTestSpecificationDocTOC

        public Dictionary<string, List<TermContainer>> getTestSpecificationDocTOC(Document doc, ApplicationClass app)
        {
            generateTOC(doc, app);
            Range tocRange = doc.TablesOfContents[1].Range;
            string[] tocContents = delimiterTOC(tocRange.Text);

            Dictionary<string, List<TermContainer>> dict = new Dictionary<string, List<TermContainer>>();
            string chapter = "";

            foreach (string s in tocContents)
            {
                if (isLevel1(s))
                {
                    chapter = s;
                    dict.Add(s, new List<TermContainer>());
                }
                else
                {
                    if (isLevel2(s))
                    {
                        TermContainer term = new TermContainer("", s, null);
                        dict[chapter].Add(term);
                    }
                }

            }
            return dict;
        }
开发者ID:v02zk,项目名称:Mycoding,代码行数:28,代码来源:HandleDocument.cs

示例10: GetRegions

        public async Task< IEnumerable<ICodeRegion>> GetRegions(Document document)
        {
            _documentText = getDocumentText(document);
            if (_documentText == null) return null;
            return GetRegions(_documentText);

        }
开发者ID:stickleprojects,项目名称:ClassOutline,代码行数:7,代码来源:RegionParser.cs

示例11: AddDocument

 public static void AddDocument(Document doc)
 {
     _documents.Enqueue(doc);
     Debug.WriteLine($"Number of Documents: {_documents.Count}");
     if (_hhook == IntPtr.Zero)
         SetEventHook();
 }
开发者ID:smilinger,项目名称:MyVaultBrowser,代码行数:7,代码来源:StandardAddInServer.cs

示例12: Execute

        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Autodesk.Revit.UI.UIApplication application = commandData.Application;
            m_docment = application.ActiveUIDocument.Document;
            try
            {
                // user should select one slab firstly.
                if(application.ActiveUIDocument.Selection.Elements.Size == 0)
                {
                    MessageBox.Show("Please select one slab firstly.", "Revit", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return Autodesk.Revit.UI.Result.Cancelled;
                }

                // get the selected slab and show its span direction
                ElementSet elementSet = application.ActiveUIDocument.Selection.Elements;
                ElementSetIterator elemIter = elementSet.ForwardIterator();
                elemIter.Reset();
                while (elemIter.MoveNext())
                {
                    Floor floor = elemIter.Current as Floor;
                    if (floor != null)
                    {
                        GetSpanDirectionAndSymobls(floor);
                    }
                }
            }
            catch(Exception ex)
            {
                message = ex.ToString();
                return Autodesk.Revit.UI.Result.Failed;
            }
            return Autodesk.Revit.UI.Result.Succeeded;
        }
开发者ID:AMEE,项目名称:revit,代码行数:49,代码来源:Command.cs

示例13: btnOK_Click

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtSaveDir.Text) &&
                !string.IsNullOrEmpty(this.txtProjectName.Text))
            {
                string selectDir = this.txtSaveDir.Text.Trim();
                string projectName = this.txtProjectName.Text.Trim();

                string path = System.IO.Path.Combine(selectDir, this.txtProjectName.Text.Trim());
                System.IO.Directory.CreateDirectory(path);

                DBGlobalService.ProjectFile = System.IO.Path.Combine(path, projectName+".xml");

                //doc.SetSchemaLocation(GlobalService.ConfigXsd);
                if (!System.IO.File.Exists(DBGlobalService.ProjectFile))
                {
                    var stream = System.IO.File.Create(DBGlobalService.ProjectFile);
                    stream.Close();
                }
                var doc = new Document();
                DBGlobalService.CurrentProjectDoc = doc;
                //doc.Load(GlobalService.ProjectFile);
                var prj = doc.CreateNode<ProjectType>();
                doc.Root = prj;
                DBGlobalService.CurrentProject = prj;
                DBGlobalService.CurrentProject.Name = projectName ;

                doc.Save(DBGlobalService.ProjectFile);

                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
        }
开发者ID:koksaver,项目名称:CodeHelper,代码行数:33,代码来源:CreatePorjectFrm.cs

示例14: DocumentViewModel

 public DocumentViewModel(Document document, IDocumentService documentService)
 {
     this.service = documentService;
     this.Model = document;
     this.mode = DocumentMode.Edit;
     this.IsBusy = false;
 }
开发者ID:binaryfr3ak,项目名称:Documentania,代码行数:7,代码来源:DocumentViewModel.cs

示例15: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            //Create word document
            Document document = new Document();

            Section section = document.AddSection();

            //page setup
            SetPage(section);

            //insert header and footer
            InsertHeaderAndFooter(section);

            //add content
            InsertContent(section);

            //encrypt document with password specified by textBox1
            document.Encrypt(this.textBox1.Text);

            //Save doc file.
            document.SaveToFile("Sample.doc",FileFormat.Doc);

            //Launching the MS Word file.
            WordDocViewer("Sample.doc");


        }
开发者ID:e-iceblue,项目名称:Spire.Office-for-.NET,代码行数:27,代码来源:Form1.cs


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