From b73076b5b76d79164c03190a95602ef70f596475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BA=D0=B0=D1=82=D0=B5=D1=80=D0=B8=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=A0=D0=BE=D0=B3=D0=B0=D1=88=D0=BE=D0=B2=D0=B0?= Date: Sat, 14 Oct 2023 10:55:14 +0400 Subject: [PATCH] =?UTF-8?q?1=202=20=D0=98=203=20=D1=81=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COPWinForms/ComponentWord2.cs | 6 +++--- COPWinForms/TableWord.cs | 6 +++--- WinFormsTest/FormTestApp.cs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/COPWinForms/ComponentWord2.cs b/COPWinForms/ComponentWord2.cs index 93e364f..783f613 100644 --- a/COPWinForms/ComponentWord2.cs +++ b/COPWinForms/ComponentWord2.cs @@ -42,7 +42,7 @@ namespace COPWinForms InitializeComponent(); } - public void CreateTable(TableWord tableWord) + public void CreateTable(TableWord tableWord) where T : class { // Проверка наличия данных и определений столбцов if (tableWord.Data == null) @@ -79,7 +79,7 @@ namespace COPWinForms { builder.InsertCell(); - // builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(tableWord.WeightColumn[ColInd1]); + builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(columnDefinition.Width); builder.Write(columnDefinition.Header); ColInd1++; @@ -114,7 +114,7 @@ namespace COPWinForms { builder.InsertCell(); - // builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(tableWord.WeightColumn[ColInd]); + builder.CellFormat.PreferredWidth = PreferredWidth.FromPoints(columnDefinition2.Width); builder.Write(columnDefinition2.Header); ColInd++; diff --git a/COPWinForms/TableWord.cs b/COPWinForms/TableWord.cs index 692b5d5..3fcdb06 100644 --- a/COPWinForms/TableWord.cs +++ b/COPWinForms/TableWord.cs @@ -7,15 +7,15 @@ using static COPWinForms.ComponentWord2; namespace COPWinForms { - public class TableWord + public class TableWord where T : class { public string FilePath = string.Empty; public string DocumentTitle = string.Empty; public List ColumnDefinitions; public List ColumnDefinitions2; - public List Data; + public List Data; public List MergedColumns; - public TableWord(string filePath, string documentTitle, List columnDefinitions, List columnDefinitions2, List data, List mergedColumns) + public TableWord(string filePath, string documentTitle, List columnDefinitions, List columnDefinitions2, List data, List mergedColumns) { FilePath = filePath; DocumentTitle = documentTitle; diff --git a/WinFormsTest/FormTestApp.cs b/WinFormsTest/FormTestApp.cs index 61f4016..39cedee 100644 --- a/WinFormsTest/FormTestApp.cs +++ b/WinFormsTest/FormTestApp.cs @@ -170,7 +170,7 @@ namespace WinFormsTest new ColumnDefinition { Header = "Group", PropertyName = "Group", Width = 21 } }; - List data = new List + List data = new List { new Student { FIO = "John", Group = "Group1", Email = "email1@email" }, new Student { FIO = "Jane", Group = "Group2", Email = "email2@email" }, @@ -186,7 +186,7 @@ namespace WinFormsTest { try { - TableWord tableWord = new(dialog.FileName, " 2", columnDefinitions, columnDefinitions2, data, mergedColumns); + TableWord tableWord = new(dialog.FileName, " 2", columnDefinitions, columnDefinitions2, data, mergedColumns); componentWord21.CreateTable(tableWord); MessageBox.Show(" ", "", MessageBoxButtons.OK, MessageBoxIcon.Information); }