/// <summary>
 /// Class constructor
 /// </summary>
 /// <param name="document">Document to perform operations on</param>
 /// <param name="fullName">Full path name of document</param>
 public PTWordprocessingDocument(OpenXmlSDK.WordprocessingDocument document, string fullName)
     : base()
 {
     Document         = document;
     FullName         = fullName;
     InnerContent     = new WordprocessingDocumentManager(this);
     Comments         = new CommentAccessor(this);
     Changes          = new ChangeAccessor(this);
     Headers          = new HeaderAccessor(this);
     Footer           = new FooterAccessor(this);
     Setting          = new SettingAccessor(this);
     CustomXml        = new CustomXmlAccessor(this);
     Background       = new BackgroundAccessor(this);
     Style            = new StyleAccessor(this);
     Format           = new ContentFormatAccessor(this);
     Picture          = new PictureAccessor(this);
     Watermark        = new WatermarkAccesor(this);
     Theme            = new ThemeAccessor(this);
     TOC              = new TOCAccessor(this);
     TOF              = new TOFAccessor(this);
     TOA              = new TOAAccessor(this);
     Index            = new IndexAccessor(this);
     CoreProperties   = new CorePropertiesAccesor(this);
     CustomProperties = new CustomPropertiesAccesor(this);
 }
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="filePath">Path of document to load</param>
        /// <param name="createNew">Whether create a new document or load contents from existing one</param>
        public PTWordprocessingDocument(string filePath, bool createNew)
            : base()
        {
            try
            {
                if (createNew)
                {
                    Document = OpenXmlSDK.WordprocessingDocument.Create(filePath, DocumentFormat.OpenXml.WordprocessingDocumentType.Document);
                }
                else
                {
                    Document = OpenXmlSDK.WordprocessingDocument.Open(filePath, true);
                }
                FullName = filePath;

                InnerContent = new WordprocessingDocumentManager(this);
                Comments     = new CommentAccessor(this);
                Changes      = new ChangeAccessor(this);
                Headers      = new HeaderAccessor(this);
                Footer       = new FooterAccessor(this);
                Setting      = new SettingAccessor(this);
                CustomXml    = new CustomXmlAccessor(this);
                Background   = new BackgroundAccessor(this);
                Style        = new StyleAccessor(this);
                Format       = new ContentFormatAccessor(this);
                Picture      = new PictureAccessor(this);
                Watermark    = new WatermarkAccesor(this);
                Theme        = new ThemeAccessor(this);
                TOC          = new TOCAccessor(this);
                TOF          = new TOFAccessor(this);
                TOA          = new TOAAccessor(this);
                Index        = new IndexAccessor(this);
            }
            catch (OpenXmlSDK.OpenXmlPackageException ope)
            {
                throw new Exception("Bad formed OpenXml package", ope);
            }
            catch (FileFormatException ffe) {
                throw new Exception("File contains corrupted data", ffe);
            }
            catch (Exception)
            {
                throw;
            }
        }
 /// <summary>
 /// WordprocessingDocument (Constructor)
 /// </summary>
 public PTWordprocessingDocument()
     : base()
 {
     memoryStream = new MemoryStream();
     Document     = OpenXmlSDK.WordprocessingDocument.Create(memoryStream, DocumentFormat.OpenXml.WordprocessingDocumentType.Document);
     InnerContent = new WordprocessingDocumentManager(this);
     Comments     = new CommentAccessor(this);
     Changes      = new ChangeAccessor(this);
     Headers      = new HeaderAccessor(this);
     Footer       = new FooterAccessor(this);
     Setting      = new SettingAccessor(this);
     CustomXml    = new CustomXmlAccessor(this);
     Background   = new BackgroundAccessor(this);
     Style        = new StyleAccessor(this);
     Format       = new ContentFormatAccessor(this);
     Picture      = new PictureAccessor(this);
     Watermark    = new WatermarkAccesor(this);
     Theme        = new ThemeAccessor(this);
     TOC          = new TOCAccessor(this);
     TOF          = new TOFAccessor(this);
 }
 /// <summary>
 /// JoinDocuments
 /// </summary>
 public override OpenXmlDocument JoinDocuments(IEnumerable <OpenXmlDocument> documents, string outputFilePath)
 {
     return(WordprocessingDocumentManager.JoinDocuments(documents, outputFilePath));
 }