public void CreateWord(WordprocessingDocument package, ModelMemoReport template, object obj = null) { MainDocumentPart mainDocumentPart = package.AddMainDocumentPart(); DocumentFormat.OpenXml.Wordprocessing.Document document = new DocumentFormat.OpenXml.Wordprocessing.Document(); PageSetting settingPage = new PageSetting(); DocumentsFull documentInvoke = new DocumentsFull(); if (template.SelectParameterDocument.NumberDocument != 4) { Fotters footers = new Fotters(); footers.FottersAddDocument(mainDocumentPart, template.Executor.NameUser, template.Executor.Phone); document.Append(settingPage.AddSetting(mainDocumentPart)); document.Append(documentInvoke.CreateDocMemoReport(template)); } else { document.Append(settingPage.ParametrPageHorizontEditMargin(new PageMargin() { Top = 300, Right = 794, Bottom = 200, Left = 794, Header = 300, Footer = 700U, Gutter = 0U })); document.Append(documentInvoke.CreateDocMemoApplication(template)); } mainDocumentPart.Document = document; }
public DocumentMigration() { SettingPage = new PageSetting(); Headers = new HeadersDocuments(); Single = new Single(); Fotters = new Fotters(); Body = new BodyDocument(); }
/// <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(); } }