diff --git a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordCellExtension.cs b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordCellExtension.cs index dae744f..ceb301a 100644 --- a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordCellExtension.cs +++ b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordCellExtension.cs @@ -1,10 +1,13 @@ -using DocumentFormat.OpenXml.Wordprocessing; +using DocumentFormat.OpenXml; +using DocumentFormat.OpenXml.Wordprocessing; using ToolsOffice.Interfaces.Word.Models; namespace ToolsOffice.Implements.WordOpenXML.Extensions { public static class WordCellExtension { + private static readonly int _coefToPoins = 567; + /// /// Добавление ячейки в строку /// @@ -37,6 +40,10 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions return; } var properties = new TableCellProperties(); + if (model.Width.HasValue) + { + properties.AppendChild(new TableCellWidth { Width = new StringValue((model.Width.Value * _coefToPoins).ToString()), Type = TableWidthUnitValues.Dxa }); + } if (model.IsNewMerge) { properties.AppendChild(new VerticalMerge() diff --git a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordDocumentExtension.cs b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordDocumentExtension.cs index 8721179..d6019fb 100644 --- a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordDocumentExtension.cs +++ b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordDocumentExtension.cs @@ -7,6 +7,7 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions { public static class WordDocumentExtension { + private static readonly int _coefToPoins = 567; /// /// Добавление общих настроек документа /// @@ -24,11 +25,11 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions var pageSize = new PageSize(); if (model.PageSizeHeight != null) { - pageSize.Height = new UInt32Value(Convert.ToUInt32(model.PageSizeHeight.Value)); + pageSize.Height = new UInt32Value(Convert.ToUInt32(model.PageSizeHeight.Value * _coefToPoins)); } if (model.PageSizeWidth != null) { - pageSize.Width = new UInt32Value(Convert.ToUInt32(model.PageSizeWidth.Value)); + pageSize.Width = new UInt32Value(Convert.ToUInt32(model.PageSizeWidth.Value * _coefToPoins)); } if (model.WordPageOrientation.HasValue) { @@ -39,19 +40,31 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions var pageMargin = new PageMargin(); if (model.PageMarginBottom.HasValue) { - pageMargin.Bottom = Convert.ToInt32(model.PageMarginBottom.Value); + pageMargin.Bottom = Convert.ToInt32(model.PageMarginBottom.Value * _coefToPoins); } if (model.PageMarginLeft != null) { - pageMargin.Left = new UInt32Value(Convert.ToUInt32(model.PageMarginLeft.Value)); + pageMargin.Left = new UInt32Value(Convert.ToUInt32(model.PageMarginLeft.Value * _coefToPoins)); } if (model.PageMarginRight != null) { - pageMargin.Right = new UInt32Value(Convert.ToUInt32(model.PageMarginRight.Value)); + pageMargin.Right = new UInt32Value(Convert.ToUInt32(model.PageMarginRight.Value * _coefToPoins)); } if (model.PageMarginTop.HasValue) { - pageMargin.Top = Convert.ToInt32(model.PageMarginTop.Value); + pageMargin.Top = Convert.ToInt32(model.PageMarginTop.Value * _coefToPoins); + } + if (model.PageMarginGutter.HasValue) + { + pageMargin.Gutter = new UInt32Value(Convert.ToUInt32(model.PageMarginGutter.Value * _coefToPoins)); + } + if (model.PageHeader.HasValue) + { + pageMargin.Header = new UInt32Value(Convert.ToUInt32(model.PageHeader.Value * _coefToPoins)); + } + if (model.PageFooter.HasValue) + { + pageMargin.Footer = new UInt32Value(Convert.ToUInt32(model.PageFooter.Value * _coefToPoins)); } properties.AppendChild(pageMargin); diff --git a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordParagraphExtension.cs b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordParagraphExtension.cs index 7ad02db..82e011c 100644 --- a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordParagraphExtension.cs +++ b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordParagraphExtension.cs @@ -2,6 +2,7 @@ using DocumentFormat.OpenXml.Wordprocessing; using System; using ToolsModule.ManagmentExtension; +using ToolsOffice.Interfaces; using ToolsOffice.Interfaces.Word.Models; namespace ToolsOffice.Implements.WordOpenXML.Extensions @@ -19,20 +20,7 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions { return; } - var paragraph = new Paragraph(); - paragraph.AddParagraphProperties(model); - if (model.Text.IsNotEmpty()) - { - paragraph.AddRun(model.Text); - } - else if (model.WordTexts != null) - { - foreach (var text in model.WordTexts) - { - paragraph.AddRun(text); - } - } - body.AppendChild(paragraph); + body.AppendChild(CreateParagraph(model)); } /// @@ -46,20 +34,7 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions { return; } - var paragraph = new Paragraph(); - paragraph.AddParagraphProperties(model); - if (model.Text.IsNotEmpty()) - { - paragraph.AddRun(model.Text); - } - else if (model.WordTexts != null) - { - foreach (var text in model.WordTexts) - { - paragraph.AddRun(text); - } - } - cell.AppendChild(paragraph); + cell.AppendChild(CreateParagraph(model)); } /// @@ -119,9 +94,20 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions properties.AppendChild(indentation); var paragraphMarkRunProperties = new ParagraphMarkRunProperties(); + if (model.FontName.HasValue) + { + var font = GetFontName(model.FontName.Value); + paragraphMarkRunProperties.AppendChild(new RunFonts + { + Ascii = new StringValue(font.Ascii), + HighAnsi = new StringValue(font.HighAnsi), + ComplexScript = new StringValue(font.ComplexScript) + }); + } if (model.FontSize.HasValue) { - paragraphMarkRunProperties.AppendChild(new FontSize { Val = new StringValue(model.FontSize.Value.ToString()) }); + paragraphMarkRunProperties.AppendChild(new FontSize { Val = new StringValue((model.FontSize.Value * 1.75).ToString()) }); + paragraphMarkRunProperties.AppendChild(new FontSizeComplexScript { Val = new StringValue((model.FontSize.Value * 1.75).ToString()) }); } if (model.IsBold) { @@ -139,5 +125,76 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions paragraph.AppendChild(properties); } + + /// + /// Создание абзаца + /// + /// + /// + private static Paragraph CreateParagraph(ModelWordParagraph model) + { + var paragraph = new Paragraph(); + paragraph.AddParagraphProperties(model); + if (model.Text.IsNotEmpty()) + { + var text = new ModelWordText { Text = model.Text }; + CheckRunProps(model, text); + paragraph.AddRun(text); + } + else if (model.WordTexts != null) + { + foreach (var text in model.WordTexts) + { + CheckRunProps(model, text); + paragraph.AddRun(text); + } + } + return paragraph; + } + + /// + /// Получение шрифта из FontNames + /// + /// + /// + private static (string Ascii, string HighAnsi, string ComplexScript) GetFontName(FontNames fn) => fn switch + { + FontNames.TimesNewRoman => ("Times New Roman", "Times New Roman", "Times New Roman"), + _ => default, + }; + + /// + /// Пеоедача параметров текста из параметров абзаца, если не заданы параметры текста + /// + /// + /// + private static void CheckRunProps(ModelWordParagraph paragraph, ModelWordText run) + { + if (run == null) + { + return; + } + + if (!run.FontSize.HasValue) + { + run.FontSize = paragraph.FontSize; + } + if (!run.FontName.HasValue) + { + run.FontName = paragraph.FontName; + } + if (!run.IsBold.HasValue) + { + run.IsBold = paragraph.IsBold; + } + if (!run.IsItalic.HasValue) + { + run.IsItalic = paragraph.IsItalic; + } + if (!run.IsUnderline.HasValue) + { + run.IsUnderline = paragraph.IsUnderline; + } + } } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRowExtension.cs b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRowExtension.cs index 989e531..241848e 100644 --- a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRowExtension.cs +++ b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRowExtension.cs @@ -7,6 +7,8 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions { public static class WordRowExtension { + private static readonly int _coefToPoins = 567; + /// /// Добавление строки в таблицу /// @@ -41,7 +43,7 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions if (model.Height.HasValue) { var properties = new TableRowProperties(); - properties.AppendChild(new TableRowHeight() { Val = new UInt32Value(Convert.ToUInt32(model.Height.Value)) }); + properties.AppendChild(new TableRowHeight() { Val = new UInt32Value(Convert.ToUInt32((model.Height * _coefToPoins).Value)) }); row.AppendChild(properties); } } diff --git a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRunExtension.cs b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRunExtension.cs index 04b6a88..b01b3dc 100644 --- a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRunExtension.cs +++ b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordRunExtension.cs @@ -1,6 +1,6 @@ using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.Wordprocessing; -using ToolsModule.ManagmentExtension; +using ToolsOffice.Interfaces; using ToolsOffice.Interfaces.Word.Models; namespace ToolsOffice.Implements.WordOpenXML.Extensions @@ -30,25 +30,7 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions } else { - docRun.AppendChild(new Text { Text = model.Text, Space = SpaceProcessingModeValues.Preserve }); - } - paragraph.AppendChild(docRun); - } - - /// - /// Добавление текста в абзац - /// - /// - /// - public static void AddRun(this Paragraph paragraph, string text) - { - if (text.IsEmpty()) - { - return; - } - var docRun = new Run(); - { - docRun.AppendChild(new Text { Text = text, Space = SpaceProcessingModeValues.Preserve }); + docRun.AppendChild(new Text { Text = model.Text }); } paragraph.AppendChild(docRun); } @@ -65,27 +47,49 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions return; } - if (model.FontSize.HasValue || model.IsBold || model.IsItalic || model.IsUnderline) + if (model.FontSize.HasValue || model.IsBold.HasValue || model.IsItalic.HasValue || model.IsUnderline.HasValue) { var properties = new RunProperties(); + if (model.FontName.HasValue) + { + var font = GetFontName(model.FontName.Value); + properties.AppendChild(new RunFonts + { + Ascii = new StringValue(font.Ascii), + HighAnsi = new StringValue(font.HighAnsi), + ComplexScript = new StringValue(font.ComplexScript) + }); + } if (model.FontSize.HasValue) { - properties.AppendChild(new FontSize { Val = new StringValue(model.FontSize.Value.ToString()) }); + properties.AppendChild(new FontSize { Val = new StringValue((model.FontSize.Value * 2).ToString()) }); + properties.AppendChild(new FontSizeComplexScript { Val = new StringValue((model.FontSize.Value * 2).ToString()) }); } - if (model.IsBold) + if (model.IsBold.HasValue && model.IsBold.Value) { properties.AppendChild(new Bold()); } - if (model.IsItalic) + if (model.IsItalic.HasValue && model.IsItalic.Value) { properties.AppendChild(new Italic()); } - if (model.IsUnderline) + if (model.IsUnderline.HasValue && model.IsUnderline.Value) { properties.AppendChild(new Underline()); } run.AppendChild(properties); } } + + /// + /// Получение шрифта из FontNames + /// + /// + /// + private static (string Ascii, string HighAnsi, string ComplexScript) GetFontName(FontNames fn) => fn switch + { + FontNames.TimesNewRoman => ("Times New Roman", "Times New Roman", "Times New Roman"), + _ => default, + }; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordTableExtension.cs b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordTableExtension.cs index e4e64a9..ac4a937 100644 --- a/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordTableExtension.cs +++ b/DepartmentPortal/Common/ToolsOffice/Implements/WordOpenXML/Extensions/WordTableExtension.cs @@ -9,6 +9,8 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions { public static class WordTableExtension { + private static readonly int _coefToPoins = 567; + /// /// Добавление таблицы в тело документа /// @@ -47,8 +49,8 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions for(int rowIndex = 0; rowIndex < headerRowsCount; ++rowIndex) { - var header = new ModelWordTableRow(); - if (model.RowsHeight.ContainsKey(rowIndex)) + var header = new ModelWordTableRow { Cells = new Queue() }; + if (model.RowsHeight?.ContainsKey(rowIndex) ?? false) { header.Height = model.RowsHeight[rowIndex]; } @@ -60,8 +62,8 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions } for (int i = 0; i < model.Data.Count; ++i) { - var row = new ModelWordTableRow(); - if (model.RowsHeight.ContainsKey(i + headerRowsCount)) + var row = new ModelWordTableRow { Cells = new Queue() }; + if (model.RowsHeight?.ContainsKey(i + headerRowsCount) ?? false) { row.Height = model.RowsHeight[i + headerRowsCount]; } @@ -87,38 +89,23 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions var properties = new TableProperties(); - var tableLook = new TableLook(); - if (model.LookFirstRow) + properties.AppendChild(new TableLook { - tableLook.FirstRow = new OnOffValue(model.LookFirstRow); - } - if (model.LookFirstColumn) - { - tableLook.FirstColumn = new OnOffValue(model.LookFirstColumn); - } - if (model.LookLastRow) - { - tableLook.LastRow = new OnOffValue(model.LookLastRow); - } - if (model.LookLastColumn) - { - tableLook.LastColumn = new OnOffValue(model.LookLastColumn); - } - if (model.LookNoHorizontalBand) - { - tableLook.NoHorizontalBand = new OnOffValue(model.LookNoHorizontalBand); - } - if (model.LookNoVerticalBand) - { - tableLook.NoVerticalBand = new OnOffValue(model.LookNoVerticalBand); - } - properties.AppendChild(tableLook); + FirstRow = new OnOffValue(model.LookFirstRow), + FirstColumn = new OnOffValue(model.LookFirstColumn), + LastRow = new OnOffValue(model.LookLastRow), + LastColumn = new OnOffValue(model.LookLastColumn), + NoHorizontalBand = new OnOffValue(model.LookNoHorizontalBand), + NoVerticalBand = new OnOffValue(model.LookNoVerticalBand) + }); var tableBorders = new TableBorders(); tableBorders.AddBorder(model, new TopBorder()); tableBorders.AddBorder(model, new BottomBorder()); tableBorders.AddBorder(model, new LeftBorder()); tableBorders.AddBorder(model, new RightBorder()); + tableBorders.AddBorder(model, new InsideHorizontalBorder()); + tableBorders.AddBorder(model, new InsideVerticalBorder()); properties.AppendChild(tableBorders); @@ -139,7 +126,7 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions var tableGrid = new TableGrid(); foreach (var grid in model.ColumnWidths) { - tableGrid.AppendChild(new GridColumn() { Width = new StringValue(grid.ToString()) }); + tableGrid.AppendChild(new GridColumn() { Width = new StringValue((grid.Value * _coefToPoins).ToString()) }); } table.AppendChild(tableGrid); } @@ -160,6 +147,10 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions { borderType.Val = (BorderValues)Enum.Parse(typeof(BorderValues), model.BorderType.Value.ToString()); } + if (model.BorderWidth.HasValue) + { + borderType.Size = new UInt32Value(Convert.ToUInt32(model.BorderWidth.Value)); + } tableBorders.AppendChild(borderType); } @@ -172,7 +163,10 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions /// private static ModelWordTableCell CreateHeaderCell(ModelWordTable model, int rowIndex, int columnIndex) { - var cell = new ModelWordTableCell(); + var cell = new ModelWordTableCell + { + Width = model.ColumnWidths.ContainsKey(columnIndex) ? model.ColumnWidths[columnIndex] : null + }; var elem = model.Headers.FirstOrDefault(x => x.ColumnIndex == columnIndex && x.RowIndex == rowIndex); if (elem != default) { @@ -187,6 +181,9 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions }; paragraph.WordTexts.Enqueue(new ModelWordText { + FontSize = 14, + FontName = Interfaces.FontNames.TimesNewRoman, + IsBold = true, Text = elem.Header }); cell.Texts.Enqueue(paragraph); @@ -220,11 +217,11 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions private static ModelWordTableCell CreateCell(ModelWordTable model, int rowIndex, int columnIndex) { var cell = new ModelWordTableCell(); - var union = model.CellUnion.FirstOrDefault(x => x.StartColumnIndex >= columnIndex && x.StartRowIndex >= rowIndex && + var union = model.CellUnion?.FirstOrDefault(x => x.StartColumnIndex >= columnIndex && x.StartRowIndex >= rowIndex && x.FinishColumnIndex <= columnIndex && x.FinishRowIndex <= rowIndex); - if (union != default) + if (union != null && union.Value != default) { - if (union.StartColumnIndex == columnIndex) + if (union.Value.StartColumnIndex == columnIndex) { cell.IsNewMerge = true; } @@ -245,6 +242,8 @@ namespace ToolsOffice.Implements.WordOpenXML.Extensions }; paragraph.WordTexts.Enqueue(new ModelWordText { + FontSize = 14, + FontName = Interfaces.FontNames.TimesNewRoman, Text = model.Data[rowIndex][columnIndex] }); cell.Texts.Enqueue(paragraph); diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/FontNames.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/FontNames.cs index 0b3f6c2..7d4f5cb 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/FontNames.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/FontNames.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ToolsOffice.Interfaces +namespace ToolsOffice.Interfaces { + /// + /// Возможные шрифты + /// public enum FontNames { TimesNewRoman = 0 } -} +} \ No newline at end of file diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordDocument.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordDocument.cs index 443b3f7..83a8126 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordDocument.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordDocument.cs @@ -20,12 +20,41 @@ /// public double? PageSizeWidth { get; set; } + /// + /// Отступ от нижнего края + /// public double? PageMarginBottom { get; set; } + /// + /// Отступ от верхнего края + /// public double? PageMarginTop { get; set; } + /// + /// Отступ от левого края + /// public double? PageMarginLeft { get; set; } + /// + /// Отступ от правого края + /// public double? PageMarginRight { get; set; } + + /// + /// Расстояние между полосами страницы + /// Если свойство MirrorMargins настроено на True, свойство Gutter добавляет дополнительное пространство на внутренние поля. + /// В противном случае дополнительное пространство добавляется в левую поля. + /// + public double? PageMarginGutter { get; set; } + + /// + /// Расстояние до верхнего колонтитула + /// + public double? PageHeader { get; set; } + + /// + /// Расстояние до нижнего колонтитула + /// + public double? PageFooter { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordParagraph.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordParagraph.cs index d0cf9a5..121df47 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordParagraph.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordParagraph.cs @@ -25,7 +25,7 @@ namespace ToolsOffice.Interfaces.Word.Models /// /// Название шрифта /// - public FontNames FontName { get; set; } + public FontNames? FontName { get; set; } /// /// Жирный diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTable.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTable.cs index 79ef7ac..18d889a 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTable.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTable.cs @@ -10,12 +10,12 @@ namespace ToolsOffice.Interfaces.Word.Models /// /// Информация по ширине колонок (номер колонки, ширина колонки), отсчет с 0 /// - public Dictionary ColumnWidths { get; set; } + public Dictionary ColumnWidths { get; set; } /// /// Информация по высоте строк (номер строки, высота строки), отсчет с 0 /// - public Dictionary RowsHeight { get; set; } + public Dictionary RowsHeight { get; set; } /// /// Информация по объединению ячеек @@ -33,40 +33,45 @@ namespace ToolsOffice.Interfaces.Word.Models public List Data { get; set; } /// - /// Иной вывод первой строки + /// Указывает, что следует применить условное форматирование первой строки /// - public bool LookFirstRow { get; set; } + public bool LookFirstRow { get; set; } = false; /// - /// Иной вывод первого столбца + /// Указывает, что следует применить условное форматирование к первому столбцу /// - public bool LookFirstColumn { get; set; } + public bool LookFirstColumn { get; set; } = false; /// - /// Иной вывод последней строки + /// Указывает, что следует применять условное форматирование последней строки /// - public bool LookLastRow { get; set; } + public bool LookLastRow { get; set; } = false; /// - /// Иной вывод последнего столбца + /// Указывает, что следует применять условное форматирование последнего столбца /// - public bool LookLastColumn { get; set; } + public bool LookLastColumn { get; set; } = false; /// - /// + /// Указывает, что условное форматирование горизонтальной полосы не должно применяться /// - public bool LookNoHorizontalBand { get; set; } + public bool LookNoHorizontalBand { get; set; } = false; /// - /// + /// Указывает, что условное форматирование вертикальной полосы не должно применяться /// - public bool LookNoVerticalBand { get; set; } + public bool LookNoVerticalBand { get; set; } = false; /// /// Тип рамки таблицы /// public TypeWordTableBorder? BorderType { get; set; } + /// + /// Толщина рамки таблицы + /// + public int? BorderWidth { get; set; } + /// /// Список строк для таблицы /// diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableCell.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableCell.cs index 55e3213..169681f 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableCell.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableCell.cs @@ -7,6 +7,11 @@ namespace ToolsOffice.Interfaces.Word.Models /// public class ModelWordTableCell { + /// + /// Ширина ячейки + /// + public double? Width { get; set; } + /// /// Новое объединение ячеек /// diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableRow.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableRow.cs index 1930474..dffa8b9 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableRow.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordTableRow.cs @@ -10,7 +10,7 @@ namespace ToolsOffice.Interfaces.Word.Models /// /// Высота строки /// - public int? Height { get; set; } + public double? Height { get; set; } /// /// Список ячеек строки diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordText.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordText.cs index edf1df4..d0ad6a2 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordText.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/Models/ModelWordText.cs @@ -25,19 +25,24 @@ /// public int? FontSize { get; set; } + /// + /// Название шрифта + /// + public FontNames? FontName { get; set; } + /// /// Жирный /// - public bool IsBold { get; set; } = false; + public bool? IsBold { get; set; } /// /// Курсив /// - public bool IsItalic { get; set; } = false; + public bool? IsItalic { get; set; } /// /// Подчеркивание /// - public bool IsUnderline { get; set; } = false; + public bool? IsUnderline { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/PageSizes.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/PageSizes.cs index bd4f745..54bfe7d 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/PageSizes.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/PageSizes.cs @@ -6,9 +6,9 @@ namespace ToolsOffice.Interfaces.Word public class PageSizes { private static readonly - Dictionary _sizes = new() + Dictionary _sizes = new() { - { "А4", (27.94, 21.59, 2, 2, 3, 1.5) } + { "А4", (29.7, 21, 1.5, 3, 2, 2, 0, 1.5, 1.5) } }; public static List Sizes => _sizes.Keys.ToList(); @@ -40,5 +40,11 @@ namespace ToolsOffice.Interfaces.Word public double? PageMarginLeft => _hasKey ? _sizes[_key].MarginLeft : null; public double? PageMarginRight => _hasKey ? _sizes[_key].MarginRigth : null; + + public double? PageMarginGutter => _hasKey ? _sizes[_key].MarginGutter : null; + + public double? PageHeader => _hasKey ? _sizes[_key].Header : null; + + public double? PageFooter => _hasKey ? _sizes[_key].Footer : null; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ToolsOffice/ToolsOffice.csproj b/DepartmentPortal/Common/ToolsOffice/ToolsOffice.csproj index 2bff211..a197ea4 100644 --- a/DepartmentPortal/Common/ToolsOffice/ToolsOffice.csproj +++ b/DepartmentPortal/Common/ToolsOffice/ToolsOffice.csproj @@ -1,15 +1,16 @@ - - net5.0 - + + net5.0 + true + - - - + + + - - - + + +