From ce7fc39ed4902d5be2a01e78dcb6aac14ea5fc72 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Sun, 25 Dec 2022 11:39:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=BE=20word?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interfaces/Word/WordPageSizeType.cs | 12 +++++++ .../Interfaces/Word/WordPageSizes.cs | 34 ++++++++++++++++--- .../StudentGroupBusinessLogic.cs | 6 ++-- 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizeType.cs diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizeType.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizeType.cs new file mode 100644 index 0000000..b8eba4e --- /dev/null +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizeType.cs @@ -0,0 +1,12 @@ +namespace ToolsOffice.Interfaces.Word +{ + /// + /// Типы страниц + /// + public enum WordPageSizeType + { + A4_Portrait, + + A4_Landscape + } +} diff --git a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizes.cs b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizes.cs index 71f4279..775aa98 100644 --- a/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizes.cs +++ b/DepartmentPortal/Common/ToolsOffice/Interfaces/Word/WordPageSizes.cs @@ -9,18 +9,19 @@ namespace ToolsOffice.Interfaces.Word public class WordPageSizes { private static readonly - Dictionary _sizes = new() + Dictionary _sizes = new() { - { "А4", (29.7, 21, 1.5, 3, 2, 2, 0, 1.5, 1.5) } + { WordPageSizeType.A4_Portrait, (29.7, 21, 1.5, 3, 2, 2, 0, 1.5, 1.5) }, + { WordPageSizeType.A4_Landscape, (21, 29.7, 1.5, 3, 2, 2, 0, 1.5, 1.5) } }; - public static List Sizes => _sizes.Keys.ToList(); + public static List Sizes => _sizes.Keys.ToList(); private readonly bool _hasKey; - private readonly string _key; + private readonly WordPageSizeType _key; - public WordPageSizes(string key) + public WordPageSizes(WordPageSizeType key) { _hasKey = _sizes.ContainsKey(key); _key = key; @@ -36,18 +37,41 @@ namespace ToolsOffice.Interfaces.Word /// public double? PageSizeWidth => _hasKey ? _sizes[_key].Width : null; + /// + /// Отступ от нижнего края + /// public double? PageMarginBottom => _hasKey ? _sizes[_key].MarginBottom : null; + /// + /// Отступ от верхнего края + /// public double? PageMarginTop => _hasKey ? _sizes[_key].MarginTop : null; + /// + /// Отступ от левого края + /// public double? PageMarginLeft => _hasKey ? _sizes[_key].MarginLeft : null; + /// + /// Отступ от правого края + /// public double? PageMarginRight => _hasKey ? _sizes[_key].MarginRigth : null; + /// + /// Расстояние между полосами страницы + /// Если свойство MirrorMargins настроено на True, свойство Gutter добавляет дополнительное пространство на внутренние поля. + /// В противном случае дополнительное пространство добавляется в левую поля. + /// 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/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs index a994c5e..28375cd 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentGroupBusinessLogic.cs @@ -149,14 +149,14 @@ namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic rowIndex++; } - var pageSize = new WordPageSizes("А4"); + var pageSize = new WordPageSizes(WordPageSizeType.A4_Landscape); var docModel = new ModelWordDocumentWithHeaderAndTable { Document = new ModelWordDocument { WordPageOrientation = TypeWordPageOrientation.Landscape, - PageSizeHeight = pageSize.PageSizeWidth, - PageSizeWidth = pageSize.PageSizeHeight, + PageSizeHeight = pageSize.PageSizeHeight, + PageSizeWidth = pageSize.PageSizeWidth, PageMarginBottom = pageSize.PageMarginBottom, PageMarginTop = pageSize.PageMarginTop, PageMarginLeft = pageSize.PageMarginLeft,