Esempio n. 1
0
        /// <summary>
        /// Создать документ
        /// </summary>
        /// <param name="package">Пакет</param>
        /// <param name="template">Шаблон</param>
        /// <param name="obj">Объект</param>
        public void CreateWord(WordprocessingDocument package, QrCodeOffice template, object obj = null)
        {
            MainDocumentPart mainDocumentPart = package.AddMainDocumentPart();

            DocumentFormat.OpenXml.Wordprocessing.Document document = new DocumentFormat.OpenXml.Wordprocessing.Document();
            PageSetting   settingPage    = new PageSetting();
            DocumentsFull documentInvoce = new DocumentsFull();

            document.Append(settingPage.DocumentSettingVertical());
            document.Append(documentInvoce.StickerOffice(template, mainDocumentPart));
            mainDocumentPart.Document = document;
        }
Esempio n. 2
0
 /// <summary>
 /// Создание документов по Миграции
 /// </summary>
 /// <param name="fullPath">Полный путь к сохранению файла с именем</param>
 /// <param name="documentTemplate">Шаблон документа из БД</param>
 /// <param name="migration">Журнал миграции</param>
 /// <param name="model">Модель с параметрами</param>
 /// <param name="isTemplate">Шаблон ЮЛ или ФЛ</param>
 /// <param name="ifns">ИФНС номер инспекции</param>
 private void GenerateDoc(string fullPath, LibaryXMLAutoReports.FullTemplateSheme.Document documentTemplate, ReportMigration[] migration, MigrationParse model, int isTemplate, string ifns)
 {
     using (WordprocessingDocument package = WordprocessingDocument.Create(fullPath, WordprocessingDocumentType.Document))
     {
         MainDocumentPart mainDocumentPart = package.AddMainDocumentPart();
         DocumentFormat.OpenXml.Wordprocessing.Document doc = new DocumentFormat.OpenXml.Wordprocessing.Document();
         Fotters.FottersAddDocument(mainDocumentPart, documentTemplate.Templates.Stone.Stone4, documentTemplate.Templates.Stone.Stone5);
         doc.Append(SettingPage.AddSetting(mainDocumentPart));
         doc.Append(Headers.HeaderDocumentIfns(documentTemplate, mainDocumentPart, ifns, model.N280, model.Otdel));
         doc.Append(Body.TextDocumentFormatMigration(documentTemplate));
         doc.Append(Body.GenerateMigrationTable(migration, isTemplate));
         doc.Append(Single.AddSingle(documentTemplate));
         mainDocumentPart.Document = doc;
         package.MainDocumentPart.Document.Save();
         package.Close();
     }
 }
Esempio n. 3
0
        public void CreateWord(WordprocessingDocument package, Book template, object obj)
        {
            MainDocumentPart mainDocumentPart = package.AddMainDocumentPart();

            DocumentFormat.OpenXml.Wordprocessing.Document document = new DocumentFormat.OpenXml.Wordprocessing.Document();
            ImagePart image = mainDocumentPart.AddImagePart(ImagePartType.Jpeg);

            using (FileStream file = new FileStream(template.BareCodeBook.FullPathSave, FileMode.Open))
            {
                image.FeedData(file);
            }
            PageSetting   settingpage    = new PageSetting();
            DocumentsFull documentInvoce = new DocumentsFull();

            document.Append(settingpage.DocumentSettingVertical());
            document.Append(documentInvoce.BookAccounting(template, mainDocumentPart.GetIdOfPart(image)));
            mainDocumentPart.Document = document;
        }