done 2 lab
This commit is contained in:
parent
50583beb33
commit
7a7f136976
@ -7,4 +7,10 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aspose.Words" Version="24.8.0" />
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Office.Interop.Word" Version="15.0.4797.1004" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -0,0 +1,15 @@
|
||||
namespace Library15Gerimovich.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum DiagramLegendLayout
|
||||
{
|
||||
None,
|
||||
|
||||
Left,
|
||||
|
||||
Top,
|
||||
|
||||
Right,
|
||||
|
||||
Bottom
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum WordDiagramLegendLocation
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom,
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperEnums
|
||||
{
|
||||
public enum WordJustificationType
|
||||
{
|
||||
Center,
|
||||
Both
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class ColumnParameters
|
||||
{
|
||||
public string FirstRowHeader { get; set; } = string.Empty;
|
||||
|
||||
public string SecondRowHeader { get; set; } = string.Empty;
|
||||
|
||||
public string PropertyName { get; set; } = string.Empty;
|
||||
|
||||
public double Width { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class SeriesParameters
|
||||
{
|
||||
public string SeriesName { get; set; } = string.Empty;
|
||||
|
||||
public List<double> ValuesY { get; set; } = new();
|
||||
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
|
||||
//namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
//{
|
||||
// public class WordDiagramInfo
|
||||
// {
|
||||
// public string FileName { get; set; } = string.Empty;
|
||||
|
||||
// public string DocumentTitle { get; set; } = string.Empty;
|
||||
|
||||
// public string DiagramTitle { get; set; } = string.Empty;
|
||||
|
||||
// public DiagramLegendLayout LegendLayout { get; set; }
|
||||
|
||||
// public List<string> CategoriesX { get; set; } = new();
|
||||
|
||||
// public List<SeriesParameters> SeriesParameters { get; set; } = new();
|
||||
// }
|
||||
//}
|
||||
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordDiagramInfo : WordInfo
|
||||
{
|
||||
public string ChartTitle { get; set; } = string.Empty;
|
||||
public WordDiagramLegendLocation LegendLocation { get; set; } = WordDiagramLegendLocation.Right;
|
||||
public WordDiagramSeries Series { get; set; } = new();
|
||||
|
||||
public void CheckFields()
|
||||
{
|
||||
if (string.IsNullOrEmpty(FileName))
|
||||
throw new ArgumentNullException(nameof(FileName), "File path and name cannot be null or empty.");
|
||||
if (string.IsNullOrEmpty(Title))
|
||||
throw new ArgumentNullException(nameof(Title), "Title cannot be null or empty.");
|
||||
if (Series == null)
|
||||
throw new ArgumentNullException(nameof(Series), "Data cannot be null or empty.");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordDiagramSeries
|
||||
{
|
||||
public string SeriesName { get; set; } = string.Empty;
|
||||
public Dictionary<string, double> Data = new();
|
||||
}
|
||||
}
|
14
Library15Gerimovich/OfficePackage/HelperModels/WordInfo.cs
Normal file
14
Library15Gerimovich/OfficePackage/HelperModels/WordInfo.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public string Title { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordLongTextInfo
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public string[] Paragraphs { get; set; } = Array.Empty<string>();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordParagraph
|
||||
{
|
||||
public List<(string, WordTextProperties)> Texts { get; set; } = new();
|
||||
public WordTextProperties? TextProperties { get; set; }
|
||||
public string Text { get; set; } = string.Empty;
|
||||
public string Style { get; set; } = string.Empty;
|
||||
public WordJustificationType JustificationType { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using Library15Gerimovich.OfficePackage.HelperModels;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordSimpleTable : WordInfo
|
||||
{
|
||||
public List<string[,]> Table { get; set; } = new List<string[,]>();
|
||||
|
||||
public void CheckFields()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(FileName) || string.IsNullOrWhiteSpace(Title) || Table == null || Table.Count == 0)
|
||||
{
|
||||
throw new ArgumentException("Все поля должны быть заполнены.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTableInfo<T>
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public List<ColumnParameters> ColumnParameters { get; set; } = new();
|
||||
|
||||
public List<T> Items { get; set; } = new();
|
||||
|
||||
public List<(int, int)> MergedColumns { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTableWithData<T> : WordTableWithHeader
|
||||
{
|
||||
public List<T> Data { get; set; }
|
||||
public void CheckFields()
|
||||
{
|
||||
if (Data == null || Data.Count == 0)
|
||||
throw new ArgumentNullException("No data");
|
||||
if (ColumnsRowsWidth is null || ColumnsRowsWidth.Count == 0)
|
||||
throw new ArgumentNullException("Rows width invalid");
|
||||
if (Headers is null || Headers.Count == 0)
|
||||
throw new ArgumentNullException("Header data invalid");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTableWithHeader : WordInfo
|
||||
{
|
||||
public (int Columns, int Rows) ColumnsRowsDataCount { get; set; }
|
||||
public List<(int Column, int Row)>? ColumnsRowsWidth { get; init; }
|
||||
public List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>? Headers { get; init; }
|
||||
public string NullReplace { get; set; } = "null";
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.HelperModels
|
||||
{
|
||||
public class WordTextProperties
|
||||
{
|
||||
public string Size { get; set; } = string.Empty;
|
||||
public bool Bold { get; set; }
|
||||
public WordJustificationType JustificationType { get; set; }
|
||||
}
|
||||
}
|
231
Library15Gerimovich/OfficePackage/Implement/SaveToWord.cs
Normal file
231
Library15Gerimovich/OfficePackage/Implement/SaveToWord.cs
Normal file
@ -0,0 +1,231 @@
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
using Library15Gerimovich.OfficePackage.HelperModels;
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Aspose.Words.Drawing.Charts;
|
||||
using Aspose.Words;
|
||||
using Aspose.Words.Drawing;
|
||||
using Body = DocumentFormat.OpenXml.Wordprocessing.Body;
|
||||
using Paragraph = DocumentFormat.OpenXml.Wordprocessing.Paragraph;
|
||||
using Run = DocumentFormat.OpenXml.Wordprocessing.Run;
|
||||
using Document = DocumentFormat.OpenXml.Wordprocessing.Document;
|
||||
|
||||
namespace Library15Gerimovich.OfficePackage.Implement
|
||||
{
|
||||
public class SaveToWord
|
||||
{
|
||||
private Document _document;
|
||||
private WordprocessingDocument? _wordDocument;
|
||||
private Body? _docBody;
|
||||
/// <summary>
|
||||
/// Получение типа выравнивания
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
private static JustificationValues GetJustificationValues(WordJustificationType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
WordJustificationType.Both => JustificationValues.Both,
|
||||
WordJustificationType.Center => JustificationValues.Center,
|
||||
_ => JustificationValues.Left,
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// Настройки страницы
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static SectionProperties CreateSectionProperties()
|
||||
{
|
||||
var properties = new SectionProperties();
|
||||
var pageSize = new DocumentFormat.OpenXml.Wordprocessing.PageSize
|
||||
{
|
||||
Orient = PageOrientationValues.Portrait
|
||||
};
|
||||
properties.AppendChild(pageSize);
|
||||
return properties;
|
||||
}
|
||||
/// <summary>
|
||||
/// Задание форматирования для абзаца
|
||||
/// </summary>
|
||||
/// <param name="paragraphProperties"></param>
|
||||
/// <returns></returns>
|
||||
private static ParagraphProperties? CreateParagraphProperties(WordTextProperties? paragraphProperties)
|
||||
{
|
||||
if (paragraphProperties == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var properties = new ParagraphProperties();
|
||||
properties.AppendChild(new Justification()
|
||||
{
|
||||
Val = GetJustificationValues(paragraphProperties.JustificationType)
|
||||
});
|
||||
properties.AppendChild(new SpacingBetweenLines
|
||||
{
|
||||
LineRule = LineSpacingRuleValues.Auto
|
||||
});
|
||||
properties.AppendChild(new Indentation());
|
||||
var paragraphMarkRunProperties = new ParagraphMarkRunProperties();
|
||||
if (!string.IsNullOrEmpty(paragraphProperties.Size))
|
||||
{
|
||||
paragraphMarkRunProperties.AppendChild(new FontSize
|
||||
{
|
||||
Val = paragraphProperties.Size
|
||||
});
|
||||
}
|
||||
properties.AppendChild(paragraphMarkRunProperties);
|
||||
return properties;
|
||||
}
|
||||
public void CreateWord(WordInfo info)
|
||||
{
|
||||
_wordDocument = WordprocessingDocument.Create(info.FileName, WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainPart = _wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = new Document();
|
||||
_docBody = mainPart.Document.AppendChild(new Body());
|
||||
}
|
||||
public void CreateParagraph(WordParagraph paragraph)
|
||||
{
|
||||
if (_docBody == null || paragraph == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var docParagraph = new Paragraph();
|
||||
|
||||
docParagraph.AppendChild(CreateParagraphProperties(paragraph.TextProperties));
|
||||
foreach (var run in paragraph.Texts)
|
||||
{
|
||||
var docRun = new Run();
|
||||
var properties = new RunProperties();
|
||||
properties.AppendChild(new FontSize { Val = run.Item2.Size });
|
||||
if (run.Item2.Bold)
|
||||
{
|
||||
properties.AppendChild(new Bold());
|
||||
}
|
||||
docRun.AppendChild(properties);
|
||||
docRun.AppendChild(new Text { Text = run.Item1, Space = SpaceProcessingModeValues.Preserve });
|
||||
docParagraph.AppendChild(docRun);
|
||||
}
|
||||
_docBody.AppendChild(docParagraph);
|
||||
}
|
||||
public void SaveWord(WordInfo info)
|
||||
{
|
||||
if (_docBody == null || _wordDocument == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_docBody.AppendChild(CreateSectionProperties());
|
||||
_wordDocument.MainDocumentPart!.Document.Save();
|
||||
_wordDocument.Dispose();
|
||||
|
||||
}
|
||||
public void CreateTable(string[,] table)
|
||||
{
|
||||
if (_docBody == null || table == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Table docTable = new Table();
|
||||
TableProperties tableProps = new TableProperties(
|
||||
new TableBorders(
|
||||
new TopBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 11
|
||||
},
|
||||
new BottomBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 11
|
||||
},
|
||||
new LeftBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 11
|
||||
},
|
||||
new RightBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideHorizontalBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 11
|
||||
},
|
||||
new InsideVerticalBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 11
|
||||
}
|
||||
));
|
||||
docTable.AppendChild(tableProps);
|
||||
TableGrid tableGrid = new TableGrid();
|
||||
int height = table.GetLength(0);
|
||||
int width = table.GetLength(1);
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
tableGrid.AppendChild(new GridColumn());
|
||||
}
|
||||
TableRow tableRow = new TableRow();
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
tableRow = new TableRow();
|
||||
for (int j = 0; j < width; j++)
|
||||
{
|
||||
var element = table[i, j];
|
||||
tableRow.AppendChild(CreateTableCell(element));
|
||||
}
|
||||
docTable.AppendChild(tableRow);
|
||||
}
|
||||
_docBody.AppendChild(docTable);
|
||||
}
|
||||
private TableCell CreateTableCell(string element)
|
||||
{
|
||||
var tableParagraph = new Paragraph();
|
||||
var run = new Run();
|
||||
run.AppendChild(new Text { Text = element });
|
||||
tableParagraph.AppendChild(run);
|
||||
var tableCell = new TableCell();
|
||||
tableCell.AppendChild(tableParagraph);
|
||||
return tableCell;
|
||||
}
|
||||
|
||||
public void CreateDiagram(WordDiagramInfo parameters)
|
||||
{
|
||||
Aspose.Words.Document doc = new Aspose.Words.Document();
|
||||
DocumentBuilder builder = new DocumentBuilder(doc);
|
||||
if (doc == null)
|
||||
throw new ArgumentNullException(nameof(doc), "Document is not created.");
|
||||
builder.ParagraphFormat.Style.Font.Size = 16;
|
||||
builder.Writeln(parameters.Title);
|
||||
Shape shape = builder.InsertChart(ChartType.Column, 432, 252);
|
||||
Chart chart = shape.Chart;
|
||||
GetLegendPosition(parameters, chart);
|
||||
ChartSeriesCollection seriesColl = chart.Series;
|
||||
seriesColl.Clear();
|
||||
ChartSeries series = chart.Series.Add(parameters.Series.SeriesName, parameters.Series.Data.Select(x => x.Key).ToArray(), parameters.Series.Data.Select(x => x.Value).ToArray());
|
||||
doc.Save(parameters.FileName);
|
||||
}
|
||||
|
||||
private void GetLegendPosition(WordDiagramInfo parameters, Chart chart)
|
||||
{
|
||||
switch (parameters.LegendLocation)
|
||||
{
|
||||
case WordDiagramLegendLocation.Left:
|
||||
chart.Legend.Position = LegendPosition.Left;
|
||||
break;
|
||||
case WordDiagramLegendLocation.Right:
|
||||
chart.Legend.Position = LegendPosition.Right;
|
||||
break;
|
||||
case WordDiagramLegendLocation.Top:
|
||||
chart.Legend.Position = LegendPosition.Top;
|
||||
break;
|
||||
case WordDiagramLegendLocation.Bottom:
|
||||
chart.Legend.Position = LegendPosition.Bottom;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
Library15Gerimovich/WordContextTablesComponent.Designer.cs
generated
Normal file
36
Library15Gerimovich/WordContextTablesComponent.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace Library15Gerimovich
|
||||
{
|
||||
partial class WordContextTablesComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
53
Library15Gerimovich/WordContextTablesComponent.cs
Normal file
53
Library15Gerimovich/WordContextTablesComponent.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
using Library15Gerimovich.OfficePackage.HelperModels;
|
||||
using Library15Gerimovich.OfficePackage.Implement;
|
||||
|
||||
namespace Library15Gerimovich
|
||||
{
|
||||
// невизуальный компонент для создания документа WORD с таблицами (с контекстом)
|
||||
// Документ с таблицами.Формат документа - Word
|
||||
public partial class WordContextTablesComponent : Component
|
||||
{
|
||||
SaveToWord SaveToWord = new SaveToWord();
|
||||
|
||||
public WordContextTablesComponent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public WordContextTablesComponent(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CreateWord(WordSimpleTable info)
|
||||
{
|
||||
info.CheckFields();
|
||||
SaveToWord.CreateWord(info);
|
||||
SaveToWord.CreateParagraph(new WordParagraph
|
||||
{
|
||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||
TextProperties = new WordTextProperties
|
||||
{
|
||||
Size = "24",
|
||||
JustificationType = WordJustificationType.Center
|
||||
}
|
||||
});
|
||||
foreach (var table in info.Table)
|
||||
{
|
||||
SaveToWord.CreateTable(table);
|
||||
SaveToWord.CreateParagraph(new WordParagraph());
|
||||
}
|
||||
SaveToWord.SaveWord(info);
|
||||
}
|
||||
}
|
||||
}
|
36
Library15Gerimovich/WordDiagramComponent.Designer.cs
generated
Normal file
36
Library15Gerimovich/WordDiagramComponent.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace Library15Gerimovich
|
||||
{
|
||||
partial class WordDiagramComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
38
Library15Gerimovich/WordDiagramComponent.cs
Normal file
38
Library15Gerimovich/WordDiagramComponent.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using Library15Gerimovich.OfficePackage.HelperModels;
|
||||
using Library15Gerimovich.OfficePackage.Implement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Library15Gerimovich
|
||||
{
|
||||
// Не визуальный компонент создания документа с диаграммой
|
||||
// Документ с гистограммой.Формат документа - Word
|
||||
public partial class WordDiagramComponent : Component
|
||||
{
|
||||
SaveToWord SaveToWord = new SaveToWord();
|
||||
|
||||
public WordDiagramComponent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public WordDiagramComponent(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CreateDiagram(WordDiagramInfo info)
|
||||
{
|
||||
info.CheckFields();
|
||||
SaveToWord.CreateDiagram(info);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
Library15Gerimovich/WordTablesComponent.Designer.cs
generated
Normal file
36
Library15Gerimovich/WordTablesComponent.Designer.cs
generated
Normal file
@ -0,0 +1,36 @@
|
||||
namespace Library15Gerimovich
|
||||
{
|
||||
partial class WordTablesComponent
|
||||
{
|
||||
/// <summary>
|
||||
/// Обязательная переменная конструктора.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
200
Library15Gerimovich/WordTablesComponent.cs
Normal file
200
Library15Gerimovich/WordTablesComponent.cs
Normal file
@ -0,0 +1,200 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.EMMA;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Library15Gerimovich.OfficePackage.HelperEnums;
|
||||
using Library15Gerimovich.OfficePackage.HelperModels;
|
||||
using Library15Gerimovich.OfficePackage.Implement;
|
||||
|
||||
namespace Library15Gerimovich
|
||||
{
|
||||
public partial class WordTablesComponent : Component
|
||||
{
|
||||
private Document _document = null;
|
||||
|
||||
private Body _body = null;
|
||||
|
||||
private DocumentFormat.OpenXml.Wordprocessing.Table _table = null;
|
||||
|
||||
private Document Document
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_document == null)
|
||||
{
|
||||
_document = new Document();
|
||||
}
|
||||
|
||||
return _document;
|
||||
}
|
||||
}
|
||||
|
||||
private Body Body
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_body == null)
|
||||
{
|
||||
_body = Document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
return _body;
|
||||
}
|
||||
}
|
||||
|
||||
private DocumentFormat.OpenXml.Wordprocessing.Table Table
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_table == null)
|
||||
{
|
||||
_table = new DocumentFormat.OpenXml.Wordprocessing.Table();
|
||||
}
|
||||
|
||||
return _table;
|
||||
}
|
||||
}
|
||||
public WordTablesComponent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public WordTablesComponent(IContainer container)
|
||||
{
|
||||
container.Add(this);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void CreateTable<T>(WordTableWithData<T> config)
|
||||
{
|
||||
config.CheckFields();
|
||||
config.ColumnsRowsDataCount = (config.Data.Count + 2, config.ColumnsRowsWidth.Count);
|
||||
CreateHeader(config.Title);
|
||||
CreateTableWithHeader();
|
||||
CreateMultiHeader(config);
|
||||
var array = new string[config.Data.Count, config.Headers.Count];
|
||||
for (var j = 0; j < config.Data.Count; j++)
|
||||
{
|
||||
for (var i = 0; i < config.Headers.Count; i++)
|
||||
{
|
||||
(int, int, string, string) first = (0, 0, null, null)!;
|
||||
foreach (var x in config.Headers.Where(x => x.ColumnIndex == i))
|
||||
{
|
||||
first = x;
|
||||
break;
|
||||
}
|
||||
var (_, _, _, name) = first;
|
||||
if (name != null)
|
||||
{
|
||||
object? value = config.Data[j]?.GetType().GetProperty(name)!.GetValue(config.Data[j], null);
|
||||
array[j, i] = value == null
|
||||
? config.NullReplace
|
||||
: value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
LoadDataToTableWithMultiHeader(array);
|
||||
SaveDoc(config.FileName);
|
||||
}
|
||||
public void SaveDoc(string filepath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filepath))
|
||||
{
|
||||
throw new ArgumentNullException("Имя файла не задано");
|
||||
}
|
||||
|
||||
if (_document == null || _body == null)
|
||||
{
|
||||
throw new ArgumentNullException("Документ не сформирован, сохранять нечего");
|
||||
}
|
||||
|
||||
if (_table != null)
|
||||
{
|
||||
Body.Append(Table);
|
||||
}
|
||||
|
||||
using WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Create(filepath, WordprocessingDocumentType.Document);
|
||||
MainDocumentPart mainDocumentPart = wordprocessingDocument.AddMainDocumentPart();
|
||||
mainDocumentPart.Document = Document;
|
||||
}
|
||||
public void LoadDataToTableWithMultiHeader(string[,] data)
|
||||
{
|
||||
for (int i = 0; i < data.GetLength(0); i++)
|
||||
{
|
||||
TableRow tablerow = new TableRow();
|
||||
for (int j = 0; j < data.GetLength(1); j++)
|
||||
{
|
||||
TableCell tableCell = new TableCell();
|
||||
tableCell.Append(new Paragraph(new Run(new Text(data[i, j]))));
|
||||
tablerow.Append(tableCell);
|
||||
}
|
||||
Table.Append(tablerow);
|
||||
}
|
||||
}
|
||||
public void CreateMultiHeader<T>(WordTableWithData<T> config)
|
||||
{
|
||||
if (config.Headers == null || !config.Headers.Any())
|
||||
return;
|
||||
TableProperties tblProperties = new TableProperties(
|
||||
new TableWidth { Type = TableWidthUnitValues.Dxa, Width = "5000" });
|
||||
Table.AppendChild(tblProperties);
|
||||
TableRow headerRow = new TableRow();
|
||||
foreach (var header in config.Headers.Where(h => h.ColumnIndex >= 0))
|
||||
{
|
||||
TableCell cell = new TableCell(new Paragraph(new Run(new Text(header.Header))));
|
||||
TableCellProperties cellProperties = new TableCellProperties(
|
||||
new TableCellWidth { Type = TableWidthUnitValues.Dxa, Width = (header.ColumnIndex * 100).ToString() });
|
||||
cell.AppendChild(cellProperties);
|
||||
headerRow.AppendChild(cell);
|
||||
}
|
||||
|
||||
Table.AppendChild(headerRow);
|
||||
}
|
||||
|
||||
public void CreateTableWithHeader()
|
||||
{
|
||||
Table.AppendChild(new TableProperties(new TableBorders(new TopBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = (UInt32Value)12u
|
||||
}, new BottomBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = (UInt32Value)12u
|
||||
}, new LeftBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = (UInt32Value)12u
|
||||
}, new RightBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = (UInt32Value)12u
|
||||
}, new InsideHorizontalBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = (UInt32Value)12u
|
||||
}, new InsideVerticalBorder
|
||||
{
|
||||
Val = new EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = (UInt32Value)12u
|
||||
})));
|
||||
}
|
||||
|
||||
public void CreateHeader(string header)
|
||||
{
|
||||
Paragraph paragraph = Body.AppendChild(new Paragraph());
|
||||
Run run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new RunProperties(new Bold()));
|
||||
run.AppendChild(new Text(header));
|
||||
}
|
||||
}
|
||||
}
|
46
WinFormsAppTest/Form1.Designer.cs
generated
46
WinFormsAppTest/Form1.Designer.cs
generated
@ -28,12 +28,19 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.defaultList = new Library15Gerimovich.DefaultList();
|
||||
this.inputRealNumber = new Library15Gerimovich.InputRealNumber();
|
||||
this.outputTableResults = new Library15Gerimovich.OutputTableResults();
|
||||
this.CheckRealButton = new System.Windows.Forms.Button();
|
||||
this.ClearListButton = new System.Windows.Forms.Button();
|
||||
this.ClearDatagridButton = new System.Windows.Forms.Button();
|
||||
this.wordContextTablesComponent1 = new Library15Gerimovich.WordContextTablesComponent(this.components);
|
||||
this.wordDiagramComponent1 = new Library15Gerimovich.WordDiagramComponent(this.components);
|
||||
this.wordTablesComponent1 = new Library15Gerimovich.WordTablesComponent(this.components);
|
||||
this.buttonSimpleTable = new System.Windows.Forms.Button();
|
||||
this.buttonHeadersTable = new System.Windows.Forms.Button();
|
||||
this.buttonCreateDiagram = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// defaultList
|
||||
@ -91,11 +98,44 @@
|
||||
this.ClearDatagridButton.UseVisualStyleBackColor = true;
|
||||
this.ClearDatagridButton.Click += new System.EventHandler(this.ClearDatagridButton_Click);
|
||||
//
|
||||
// buttonSimpleTable
|
||||
//
|
||||
this.buttonSimpleTable.Location = new System.Drawing.Point(40, 289);
|
||||
this.buttonSimpleTable.Name = "buttonSimpleTable";
|
||||
this.buttonSimpleTable.Size = new System.Drawing.Size(75, 40);
|
||||
this.buttonSimpleTable.TabIndex = 7;
|
||||
this.buttonSimpleTable.Text = "Простя таблица";
|
||||
this.buttonSimpleTable.UseVisualStyleBackColor = true;
|
||||
this.buttonSimpleTable.Click += new System.EventHandler(this.buttonSimpleTable_Click);
|
||||
//
|
||||
// buttonHeadersTable
|
||||
//
|
||||
this.buttonHeadersTable.Location = new System.Drawing.Point(130, 289);
|
||||
this.buttonHeadersTable.Name = "buttonHeadersTable";
|
||||
this.buttonHeadersTable.Size = new System.Drawing.Size(75, 40);
|
||||
this.buttonHeadersTable.TabIndex = 8;
|
||||
this.buttonHeadersTable.Text = "сложная с шапками";
|
||||
this.buttonHeadersTable.UseVisualStyleBackColor = true;
|
||||
this.buttonHeadersTable.Click += new System.EventHandler(this.buttonHeadersTable_Click);
|
||||
//
|
||||
// buttonCreateDiagram
|
||||
//
|
||||
this.buttonCreateDiagram.Location = new System.Drawing.Point(211, 289);
|
||||
this.buttonCreateDiagram.Name = "buttonCreateDiagram";
|
||||
this.buttonCreateDiagram.Size = new System.Drawing.Size(75, 40);
|
||||
this.buttonCreateDiagram.TabIndex = 9;
|
||||
this.buttonCreateDiagram.Text = "диаграмма";
|
||||
this.buttonCreateDiagram.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateDiagram.Click += new System.EventHandler(this.buttonCreateDiagram_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(739, 355);
|
||||
this.Controls.Add(this.buttonCreateDiagram);
|
||||
this.Controls.Add(this.buttonHeadersTable);
|
||||
this.Controls.Add(this.buttonSimpleTable);
|
||||
this.Controls.Add(this.ClearDatagridButton);
|
||||
this.Controls.Add(this.ClearListButton);
|
||||
this.Controls.Add(this.CheckRealButton);
|
||||
@ -115,5 +155,11 @@
|
||||
private Button CheckRealButton;
|
||||
private Button ClearListButton;
|
||||
private Button ClearDatagridButton;
|
||||
private Library15Gerimovich.WordContextTablesComponent wordContextTablesComponent1;
|
||||
private Library15Gerimovich.WordDiagramComponent wordDiagramComponent1;
|
||||
private Library15Gerimovich.WordTablesComponent wordTablesComponent1;
|
||||
private Button buttonSimpleTable;
|
||||
private Button buttonHeadersTable;
|
||||
private Button buttonCreateDiagram;
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using Library15Gerimovich;
|
||||
using Library15Gerimovich.Exceptions;
|
||||
using Library15Gerimovich.OfficePackage.HelperModels;
|
||||
|
||||
namespace WinFormsAppTest
|
||||
{
|
||||
@ -14,24 +16,10 @@ namespace WinFormsAppTest
|
||||
InitializeOutputTableResults();
|
||||
}
|
||||
|
||||
//private void CreateImage()
|
||||
//{
|
||||
// Bitmap bmp = new(userControl11.Width - 10,
|
||||
// userControl11.Height - 10);
|
||||
// Graphics gr = Graphics.FromImage(bmp);
|
||||
// gr.DrawEllipse(new Pen(Color.Red), 10, 10, 20, 20);
|
||||
// userControl11.Avatar = bmp;
|
||||
//}
|
||||
//private void userControl11_AvatarChanged(object sender, EventArgs e)
|
||||
//{
|
||||
// var width = userControl11.Avatar.Width;
|
||||
// MessageBox.Show($"Change avatar, width={width}");
|
||||
//}
|
||||
|
||||
|
||||
private void InitializeDefaultList()
|
||||
{
|
||||
defaultList.SetItems("RITG, SimbirSOft, Mediasoft");
|
||||
defaultList.SetItems("RITG");
|
||||
defaultList.SetItems("Simbirsoft");
|
||||
}
|
||||
|
||||
private void InitializeInputRealNumber()
|
||||
@ -105,5 +93,109 @@ namespace WinFormsAppTest
|
||||
{
|
||||
outputTableResults.ClearGrid();
|
||||
}
|
||||
|
||||
private void buttonSimpleTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<string[,]> data = new List<string[,]>
|
||||
{
|
||||
new string[,]
|
||||
{
|
||||
{"123", "123", "123" },
|
||||
{"123", "123", "123" },
|
||||
{"123", "123", "123" },
|
||||
},
|
||||
new string[,]
|
||||
{
|
||||
{ "Ñòð 1 Êîë 1", "Ñòð 1 Êîë 2", "Ñòð 1 Êîë 3", "Ñòð 1 Êîë 4", "Ñòð 1 Êîë 5", "Ñòð 1 Êîë 6" },
|
||||
{ "Ñòð 2 Êîë 1", "Ñòð 2 Êîë 2", "Ñòð 2 Êîë 3", "Ñòð 2 Êîë 4", "Ñòð 2 Êîë 5", "Ñòð 2 Êîë 6" },
|
||||
{ "Ñòð 3 Êîë 1", "Ñòð 3 Êîë 2", "Ñòð 3 Êîë 3", "Ñòð 3 Êîë 4", "Ñòð 3 Êîë 5", "Ñòð 3 Êîë 6" },
|
||||
{ "Ñòð 4 Êîë 1", "Ñòð 4 Êîë 2", "Ñòð 4 Êîë 3", "Ñòð 4 Êîë 4", "Ñòð 4 Êîë 5", "Ñòð 4 Êîë 6" },
|
||||
}
|
||||
};
|
||||
var info = new WordSimpleTable
|
||||
{
|
||||
FileName = "C://Users//user//Desktop//WordSimpleTable.docx",
|
||||
Title = "Çàãîëîâîê",
|
||||
Table = data,
|
||||
};
|
||||
wordContextTablesComponent1.CreateWord(info);
|
||||
MessageBox.Show("Word óñïåøíî ñîçäàí!", "Óñïåõ", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
}
|
||||
readonly List<TestWordTable> PersonsWord = new()
|
||||
{
|
||||
new TestWordTable("1", "123", "123", 20, 2000),
|
||||
new TestWordTable("1", "123", "123", 20, 3000),
|
||||
new TestWordTable("1", "123", "123", 59, 1001),
|
||||
new TestWordTable("2", "123", "123", 25, 1234),
|
||||
new TestWordTable("2", "123", "123", 89, 1457),
|
||||
};
|
||||
private void buttonHeadersTable_Click(object sender, EventArgs e)
|
||||
{
|
||||
wordTablesComponent1.CreateTable(new WordTableWithData<TestWordTable>
|
||||
{
|
||||
FileName = "C://Users//user//Desktop//HeaderTable.docx",
|
||||
Title = "Çàãîëîâîê",
|
||||
ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (10, 5), (10, 0), (5, 0), (10, 5) },
|
||||
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
|
||||
{
|
||||
(0, 0, "Division", "Id"),
|
||||
(1, 0, "Surname", "Surname"),
|
||||
(2, 0, "Name", "Name"),
|
||||
(3, 0, "Age", "Age"),
|
||||
(4, 0, "Premia", "Premia"),
|
||||
},
|
||||
Data = PersonsWord,
|
||||
NullReplace = "null"
|
||||
});
|
||||
//wordTablesComponent1.CreateTable(new WordTableWithHeader<TestWordTable>
|
||||
//{
|
||||
// FileName = "C://Users//user//Desktop//HeaderTable.docx",
|
||||
// Title = "Çàãîëîâîê",
|
||||
// ColumnsRowsWidth = new List<(int Column, int Row)> { (5, 5), (10, 5), (10, 0), (5, 0), (10, 5) },
|
||||
// Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
|
||||
// {
|
||||
// (0, 0, "Division", "Id"),
|
||||
// (1, 0, "Surname", "Surname"),
|
||||
// (2, 0, "Name", "Name"),
|
||||
// (3, 0, "Age", "Age"),
|
||||
// (4, 0, "Premia", "Premia"),
|
||||
// },
|
||||
// Data = PersonsWord,
|
||||
// NullReplace = "null"
|
||||
//});
|
||||
MessageBox.Show("Word äîêóìåíò ñ òàáëèöåé ñîçäàí!", "Óñïåõ");
|
||||
}
|
||||
|
||||
private void buttonCreateDiagram_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
wordDiagramComponent1.CreateDiagram(
|
||||
new WordDiagramInfo
|
||||
{
|
||||
FileName = "C://Users//user//Desktop//Diagram.docx",
|
||||
Title = "Çàãîëîâîê",
|
||||
ChartTitle = "Ãèñòîãðàììà",
|
||||
LegendLocation = Library15Gerimovich.OfficePackage.HelperEnums.WordDiagramLegendLocation.Top,
|
||||
Series = new WordDiagramSeries
|
||||
{
|
||||
SeriesName = "Êîëè÷åñòâî îöåíîê",
|
||||
Data = new Dictionary<string, double>
|
||||
{
|
||||
{ "5", 7 },
|
||||
{ "4", 8 },
|
||||
{ "3", 5 },
|
||||
{ "2", 3 },
|
||||
}
|
||||
}
|
||||
});
|
||||
MessageBox.Show("Word äîêóìåíò ñ äèàãðàììîé ñîçäàí!", "Óñïåõ");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Îøèáêà: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -57,4 +57,13 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="wordContextTablesComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="wordDiagramComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>245, 17</value>
|
||||
</metadata>
|
||||
<metadata name="wordTablesComponent1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>442, 17</value>
|
||||
</metadata>
|
||||
</root>
|
31
WinFormsAppTest/TestWordTable.cs
Normal file
31
WinFormsAppTest/TestWordTable.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WinFormsAppTest
|
||||
{
|
||||
public class TestWordTable
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string Surname { get; set; } = string.Empty;
|
||||
|
||||
public int Age { get; set; }
|
||||
public double Premia { get; set; }
|
||||
public TestWordTable()
|
||||
{ }
|
||||
|
||||
public TestWordTable(string Id, string Name, string Surname, int Age, double Premia)
|
||||
{
|
||||
this.Id = Id;
|
||||
this.Name = Name;
|
||||
this.Surname = Surname;
|
||||
this.Age = Age;
|
||||
this.Premia = Premia;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user