/// <summary> /// Генерация абзатца по полю BodyGl1 /// </summary> /// <param name="tamplate">Шаблон</param> /// <returns></returns> public Body TextDocument(LibaryXMLAutoReports.FullTemplateSheme.Document tamplate) { Body body = new Body(); var paragraphGenerate = new RunGenerate(); body.Append(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Body.BodyGl1, "26", JustificationValues.Both, 0, "1000")); return(body); }
/// <summary> /// Создание Шапки документа ИФНС 51 Шаблон №1 без герба /// </summary> /// <param name="tamplate">Шаблон шапки</param> /// <param name="n279">Номер инспекции</param> /// <param name="n280">Наименование плательщика</param> /// <param name="senderOtd">В какой отдел направляется</param> /// <returns></returns> public Body DocumentsHeaders(LibaryXMLAutoReports.FullTemplateSheme.Document tamplate, string n279 = null, string n280 = null, string senderOtd = null) { Body body = new Body(); Table table = new Table(); var rows = new RowGenerate(); ObservableCollection <TableCell> cellcCollection = new ObservableCollection <TableCell>(); ObservableCollection <Paragraph> paragraphcCollection = new ObservableCollection <Paragraph>(); var paragraphGenerate = new RunGenerate(); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade1, "20", JustificationValues.Center, 1)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade2, "20", JustificationValues.Center)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade3, "20", JustificationValues.Center)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade4, "20", JustificationValues.Center, 1)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade5, "16", JustificationValues.Center, 1)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade6, "16", JustificationValues.Center, 1)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade7, "16", JustificationValues.Center, 0, "0", false, false, false)); if (tamplate.Templates.Headers.TextHeade8.Length > 40) { var t1 = tamplate.Templates.Headers.TextHeade8.Substring(0, 40); var t2 = tamplate.Templates.Headers.TextHeade8.Substring(40); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(t1, "16", JustificationValues.Center)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(t2, "16", JustificationValues.Center)); } else { paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade8, "16", JustificationValues.Center)); } paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade9, "16", JustificationValues.Center)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Headers.TextHeade10, "16", JustificationValues.Center)); cellcCollection.Add(CellGenerate.GenerateCell(ref paragraphcCollection, "100", TableWidthUnitValues.Auto, "0", "200", TableVerticalAlignmentValues.Top, null, 4)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart()); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(n280, "26", JustificationValues.Center, 1, "0", false, false, false)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart($"({n279})", "26", JustificationValues.Center, 0, "0", false, false, false)); if (senderOtd != null) { paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(senderOtd, "26", JustificationValues.Center)); } cellcCollection.Add(CellGenerate.GenerateCell(ref paragraphcCollection, "5500", TableWidthUnitValues.Dxa, "1500", "0", TableVerticalAlignmentValues.Center)); table.Append(rows.GenerateRow(ref cellcCollection)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(1), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, CellBorders.GenerateBorder())); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(1), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, CellBorders.GenerateBorder())); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart("№", "24", JustificationValues.Center), "0", TableWidthUnitValues.Nil)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Nil, "0", "1500", TableVerticalAlignmentValues.Top, CellBorders.GenerateBorder())); table.Append(rows.GenerateRow(ref cellcCollection)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart("На №", "24"), "0", TableWidthUnitValues.Auto)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, CellBorders.GenerateBorder(), 3)); table.Append(rows.GenerateRow(ref cellcCollection)); body.Append(table); body.Append(paragraphGenerate.LineBreker(3)); return(body); }
/// <summary> ///Создание колонтитула /// </summary> /// <param name="mainDocument">Документ</param> /// <param name="tamplate">Шаблон</param> public void FottersAddDocument(MainDocumentPart mainDocument, LibaryXMLAutoReports.FullTemplateSheme.Document tamplate) { var fotters = FotterGenerate.AddFotters(mainDocument); var paragraph = new RunGenerate(); Footer footer = new Footer(); var par1 = paragraph.RunParagraphGeneratorStandart(); par1.Append(FormulandFooters(tamplate.Templates.Stone.Stone4)); var par2 = paragraph.RunParagraphGeneratorStandart(); par2.Append(FormulandFooters(tamplate.Templates.Stone.Stone5)); footer.Append(par1); footer.Append(par2); fotters.Footer = footer; }
/// <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(); } }
/// <summary> /// Поле кто подписывает документ Руководство /// </summary> /// <param name="tamplate">Шаблон</param> /// <returns></returns> public Body AddSingle(LibaryXMLAutoReports.FullTemplateSheme.Document tamplate) { Body body = new Body(); Table table = new Table(); var rows = new RowGenerate(); ObservableCollection <TableCell> cellcCollection = new ObservableCollection <TableCell>(); ObservableCollection <Paragraph> paragraphcCollection = new ObservableCollection <Paragraph>(); var paragraphGenerate = new RunGenerate(); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Stone.Stone1, "26")); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Stone.Stone2, "26")); cellcCollection.Add(CellGenerate.GenerateCell(ref paragraphcCollection, CellGenerate.FormulWidthCell(8.8), TableWidthUnitValues.Dxa)); paragraphcCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(tamplate.Templates.Stone.Stone3, "26", JustificationValues.Right)); cellcCollection.Add(CellGenerate.GenerateCell(ref paragraphcCollection, CellGenerate.FormulWidthCell(9.2), TableWidthUnitValues.Dxa)); table.Append(rows.GenerateRow(ref cellcCollection)); body.Append(table); return(body); }
/// <summary> /// Шапка инспекции документа /// </summary> /// <returns></returns> /// <param name="template">Шаблон шапки</param> /// <param name="n279">Номер инспекции</param> /// <param name="n280">Наименование плательщика</param> /// <param name="senderOtd">В какой отдел направляется</param> public Body HeaderDocumentIfns(LibaryXMLAutoReports.FullTemplateSheme.Document template, MainDocumentPart mainDocumentPart, string n279 = null, string n280 = null, string senderOtd = null) { Body body = new Body(); AddDriwing driving = new AddDriwing(); Table table = new Table(); var rows = new RowGenerate(); ObservableCollection <TableCell> cellcCollection = new ObservableCollection <TableCell>(); ObservableCollection <Paragraph> paragraphCollection = new ObservableCollection <Paragraph>(); var paragraphGenerate = new RunGenerate(); ImagePart image = mainDocumentPart.AddImagePart(ImagePartType.Jpeg); using (Stream file = new MemoryStream(template.Templates.Headers.ImageForm)) { image.FeedData(file); } var emblem = paragraphGenerate.RunParagraphGeneratorStandart("", "20", JustificationValues.Center); emblem.Append(driving.AddImageToParagraph(mainDocumentPart.GetIdOfPart(image), 650000L, 650000L)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade1, "20", JustificationValues.Center)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade2, "20", JustificationValues.Center)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade3, "16", JustificationValues.Center)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade4, "16", JustificationValues.Center, 1)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade5, "16", JustificationValues.Center, 1)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade6, "16", JustificationValues.Center, 1)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade7, "16", JustificationValues.Center, 0, "0", false, false, false)); if (template.Templates.Headers.TextHeade9.Length > 40) { var t1 = template.Templates.Headers.TextHeade9.Substring(0, 40); var t2 = template.Templates.Headers.TextHeade9.Substring(40); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(t1, "16", JustificationValues.Center)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(t2, "16", JustificationValues.Center)); } else { paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade9, "16", JustificationValues.Center)); } paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade10, "16", JustificationValues.Center)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(template.Templates.Headers.TextHeade11, "16", JustificationValues.Center)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(1.5), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(0.9), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(0.7), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(4.2), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(1.9), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null, 0, 1)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), CellGenerate.FormulWidthCell(8.3), TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(0.002))); cellcCollection.Add(CellGenerate.GenerateCell(emblem, "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Top, null, 4)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Top, null, 0, 1)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Top, null)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(1.8))); cellcCollection.Add(CellGenerate.GenerateCell(ref paragraphCollection, "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 4)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart()); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(n280, "26", JustificationValues.Center, 1, "0", false, false, false)); paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart($"({n279})", "26", JustificationValues.Center, 0, "0", false, false, false)); if (senderOtd != null) { var splitDepartment = senderOtd.Split('/'); foreach (var department in splitDepartment) { paragraphCollection.Add(paragraphGenerate.RunParagraphGeneratorStandart(department, "22", JustificationValues.Center)); } } cellcCollection.Add(CellGenerate.GenerateCell(ref paragraphCollection, "0", TableWidthUnitValues.Dxa, "0", "0", TableVerticalAlignmentValues.Top, null, 0, 1, 1)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(4.5))); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, CellBorders.GenerateBorder(), 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart("№", "24", JustificationValues.Center), "0", TableWidthUnitValues.Auto)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, CellBorders.GenerateBorder())); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(0.7))); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(0.4))); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart("На №", "24", JustificationValues.Center), "0", TableWidthUnitValues.Auto)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, CellBorders.GenerateBorder(), 3)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(0.7))); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 3)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(0.4))); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 4)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); cellcCollection.Add(CellGenerate.GenerateCell(paragraphGenerate.RunParagraphGeneratorStandart(), "0", TableWidthUnitValues.Auto, "0", "0", TableVerticalAlignmentValues.Bottom, null, 0, 2)); table.Append(rows.GenerateRow(ref cellcCollection, true, rows.FormulHeightRow(1.8))); body.Append(table); return(body); }