Owl.Word.WordBuilder.CreateDocument C# (CSharp) Méthode

CreateDocument() public méthode

public CreateDocument ( string filePath ) : void
filePath string
Résultat void
        public void CreateDocument(string filePath)
        {
            var creator = new DocumentCreator();
            this._package = creator.CreatePackage(filePath);

            CreateCommonStyles();
        }

Usage Example

Exemple #1
0
        static void Main(string[] args)
        {
            #region [ Create parent document ]

            string documentParent = "parent.docx";

            if (File.Exists(documentParent))
                File.Delete(documentParent);

            using (WordBuilder builder = new WordBuilder()) {

                builder.CreateDocument(documentParent);

                builder.CreateTextParagraph(TextParagraphType.Title, "Owl");
                builder.CreateTextParagraph(TextParagraphType.Normal, "Owl is a custom framework to make easier the document's development using OpenXML. Enjoy it!");
                builder.CreateTextParagraph(TextParagraphType.Normal, string.Empty);
            }

            #endregion

            #region [ Create child document ]

            string documentChild = "child.docx";

            if (File.Exists(documentChild))
                File.Delete(documentChild);

            using (WordBuilder builder = new WordBuilder()) {

                builder.CreateDocument(documentChild);

                builder.CreateTextParagraph(TextParagraphType.Heading1, "Owl");
                builder.CreateTextParagraph(TextParagraphType.Normal, "Owl is a custom framework to make easier the document's development using OpenXML. Enjoy it!");
                builder.CreateTextParagraph(TextParagraphType.Normal, string.Empty);
            }

            #endregion

            using (WordBuilder builder = new WordBuilder()) {

                builder.OpenDocument(documentParent);

                builder.MergeDocument(documentChild);
            }

            ProcessStartInfo startInfo = new ProcessStartInfo(documentParent);
            Process.Start(startInfo);
        }
All Usage Examples Of Owl.Word.WordBuilder::CreateDocument