diff --git a/WinForm/AppView/AppView.csproj b/WinForm/AppView/AppView.csproj
index f590051..657ed43 100644
--- a/WinForm/AppView/AppView.csproj
+++ b/WinForm/AppView/AppView.csproj
@@ -18,7 +18,7 @@
-
+
\ No newline at end of file
diff --git a/WinForm/PdfFormsLibrary/DropDownList.Designer.cs b/WinForm/PdfFormsLibrary/DropDownList.Designer.cs
new file mode 100644
index 0000000..0ca55a2
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/DropDownList.Designer.cs
@@ -0,0 +1,71 @@
+namespace WinForm
+{
+ partial class DropDownList
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ comboBox = new ComboBox();
+ labelTitle = new Label();
+ SuspendLayout();
+ //
+ // comboBox
+ //
+ comboBox.FormattingEnabled = true;
+ comboBox.Location = new Point(13, 39);
+ comboBox.Name = "comboBox";
+ comboBox.Size = new Size(232, 23);
+ comboBox.TabIndex = 0;
+ comboBox.SelectedValueChanged += ComboBox_SelectedValueChanged;
+ //
+ // labelTitle
+ //
+ labelTitle.AutoSize = true;
+ labelTitle.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ labelTitle.Location = new Point(13, 11);
+ labelTitle.Name = "labelTitle";
+ labelTitle.Size = new Size(133, 15);
+ labelTitle.TabIndex = 1;
+ labelTitle.Text = "Выпадающий список";
+ //
+ // DropDownList
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(labelTitle);
+ Controls.Add(comboBox);
+ Name = "DropDownList";
+ Size = new Size(260, 80);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ComboBox comboBox;
+ private Label labelTitle;
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/DropDownList.cs b/WinForm/PdfFormsLibrary/DropDownList.cs
new file mode 100644
index 0000000..adb11c9
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/DropDownList.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace WinForm
+{
+ public partial class DropDownList : UserControl
+ {
+ public DropDownList()
+ {
+ InitializeComponent();
+ }
+
+ public void Clear()
+ {
+ comboBox.Items.Clear();
+ }
+
+ public string Selected
+ {
+ get
+ {
+ if (comboBox.Items.Count == 0)
+ {
+ return "";
+ }
+ if (comboBox.SelectedItem == null)
+ {
+ return "";
+ }
+ return comboBox.SelectedItem.ToString()!;
+ }
+ set
+ {
+ if (comboBox.Items.Contains(value))
+ {
+ comboBox.SelectedItem = value;
+ }
+
+ }
+ }
+
+ public ComboBox.ObjectCollection ComboBoxItems
+ {
+ get { return comboBox.Items; }
+ }
+
+ private EventHandler _explicitEvent;
+ public event EventHandler ExplicitEvent
+ {
+ add
+ {
+ _explicitEvent += value;
+ }
+ remove
+ {
+ _explicitEvent -= value;
+ }
+ }
+
+ private void ComboBox_SelectedValueChanged(object sender, EventArgs e)
+ {
+ _explicitEvent?.Invoke(sender, e);
+ }
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/DropDownList.resx b/WinForm/PdfFormsLibrary/DropDownList.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/DropDownList.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WinForm/PdfFormsLibrary/Helpers/DiagramLegendPosition.cs b/WinForm/PdfFormsLibrary/Helpers/DiagramLegendPosition.cs
new file mode 100644
index 0000000..9f4bdcd
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/Helpers/DiagramLegendPosition.cs
@@ -0,0 +1,57 @@
+using OxyPlot.Legends;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary.Helpers
+{
+ public class LegendSettingsAttribute : Attribute
+ {
+ public LegendPosition Position { get; }
+ public LegendPlacement Placement { get; }
+
+ public LegendSettingsAttribute(LegendPosition position, LegendPlacement placement)
+ {
+ Position = position;
+ Placement = placement;
+ }
+ }
+
+ public enum DiagramLegendPosition
+ {
+ [LegendSettings(LegendPosition.LeftTop, LegendPlacement.Outside)]
+ TopLeftOutside,
+ [LegendSettings(LegendPosition.TopCenter, LegendPlacement.Outside)]
+ TopCenterOutside,
+ [LegendSettings(LegendPosition.RightTop, LegendPlacement.Outside)]
+ TopRightOutside,
+ [LegendSettings(LegendPosition.LeftMiddle, LegendPlacement.Outside)]
+ MiddleLeftOutside,
+ [LegendSettings(LegendPosition.RightMiddle, LegendPlacement.Outside)]
+ MiddleRightOutside,
+ [LegendSettings(LegendPosition.BottomLeft, LegendPlacement.Outside)]
+ BottomLeftOutside,
+ [LegendSettings(LegendPosition.BottomCenter, LegendPlacement.Outside)]
+ BottomCenterOutside,
+ [LegendSettings(LegendPosition.BottomRight, LegendPlacement.Outside)]
+ BottomRightOutside,
+ [LegendSettings(LegendPosition.LeftTop, LegendPlacement.Inside)]
+ TopLeftInside,
+ [LegendSettings(LegendPosition.TopCenter, LegendPlacement.Inside)]
+ TopCenterInside,
+ [LegendSettings(LegendPosition.RightTop, LegendPlacement.Inside)]
+ TopRightInside,
+ [LegendSettings(LegendPosition.LeftMiddle, LegendPlacement.Inside)]
+ MiddleLeftInside,
+ [LegendSettings(LegendPosition.RightMiddle, LegendPlacement.Inside)]
+ MiddleRightInside,
+ [LegendSettings(LegendPosition.BottomLeft, LegendPlacement.Inside)]
+ BottomLeftInside,
+ [LegendSettings(LegendPosition.BottomCenter, LegendPlacement.Inside)]
+ BottomCenterInside,
+ [LegendSettings(LegendPosition.BottomRight, LegendPlacement.Inside)]
+ BottomRightInside,
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/Helpers/PdfWithDiagramData.cs b/WinForm/PdfFormsLibrary/Helpers/PdfWithDiagramData.cs
new file mode 100644
index 0000000..53ac3d7
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/Helpers/PdfWithDiagramData.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary.Helpers
+{
+ public class PdfWithDiagramData
+ {
+ public string FilePath { get; set; } = string.Empty;
+ public string DocumentTitle { get; set; } = string.Empty;
+ public string DiagramName { get; set; } = string.Empty;
+ public DiagramLegendPosition LegendPosition { get; set; } = DiagramLegendPosition.BottomCenterOutside;
+ public List Series { get; set; } = new();
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/Helpers/PdfWithDiagramSeries.cs b/WinForm/PdfFormsLibrary/Helpers/PdfWithDiagramSeries.cs
new file mode 100644
index 0000000..d296cee
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/Helpers/PdfWithDiagramSeries.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary.Helpers
+{
+ public class PdfWithDiagramSeries
+ {
+ public string Name { get; set; } = string.Empty;
+ public List<(double, double)> Data { get; set; } = new();
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/Helpers/PdfWithTableData.cs b/WinForm/PdfFormsLibrary/Helpers/PdfWithTableData.cs
new file mode 100644
index 0000000..a8e4917
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/Helpers/PdfWithTableData.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary.Helpers
+{
+ public class PdfWithTableData
+ {
+ public string FilePath { get; set; } = string.Empty;
+ public string DocumentTitle { get; set; } = string.Empty;
+ public List TableHeader { get; set; } = new();
+ public List TableData { get; set; } = new();
+ public List Props { get; set; } = new();
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/Helpers/PdfWithTableHeader.cs b/WinForm/PdfFormsLibrary/Helpers/PdfWithTableHeader.cs
new file mode 100644
index 0000000..d1240bb
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/Helpers/PdfWithTableHeader.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary.Helpers
+{
+ public class PdfWithTableHeader
+ {
+ public string? ColumnName { get; set; } = string.Empty;
+ public int ColumnWidth { get; set; } = 100;
+ public List SubColumns { get; set; } = new List();
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/Helpers/PdfWithTableSubHeader.cs b/WinForm/PdfFormsLibrary/Helpers/PdfWithTableSubHeader.cs
new file mode 100644
index 0000000..7e77ecd
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/Helpers/PdfWithTableSubHeader.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary.Helpers
+{
+ public class PdfWithTableSubHeader
+ {
+ public string? ColumnName { get; set; } = string.Empty;
+ public int ColumnWidth { get; set; } = 100;
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/ListBoxValues.Designer.cs b/WinForm/PdfFormsLibrary/ListBoxValues.Designer.cs
new file mode 100644
index 0000000..9c07d6b
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/ListBoxValues.Designer.cs
@@ -0,0 +1,71 @@
+namespace WinForm
+{
+ partial class ListBoxValues
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ listBox = new ListBox();
+ componentTitleLabel = new Label();
+ SuspendLayout();
+ //
+ // listBox
+ //
+ listBox.FormattingEnabled = true;
+ listBox.ItemHeight = 15;
+ listBox.Location = new Point(12, 39);
+ listBox.Name = "listBox";
+ listBox.Size = new Size(172, 154);
+ listBox.TabIndex = 0;
+ //
+ // componentTitleLabel
+ //
+ componentTitleLabel.AutoSize = true;
+ componentTitleLabel.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ componentTitleLabel.Location = new Point(12, 12);
+ componentTitleLabel.Name = "componentTitleLabel";
+ componentTitleLabel.Size = new Size(108, 15);
+ componentTitleLabel.TabIndex = 1;
+ componentTitleLabel.Text = "Список занчений";
+ //
+ // ListBoxValues
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(componentTitleLabel);
+ Controls.Add(listBox);
+ Name = "ListBoxValues";
+ Size = new Size(200, 206);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ListBox listBox;
+ private Label componentTitleLabel;
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/ListBoxValues.cs b/WinForm/PdfFormsLibrary/ListBoxValues.cs
new file mode 100644
index 0000000..a186a8c
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/ListBoxValues.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace WinForm
+{
+ public partial class ListBoxValues : UserControl
+ {
+ private string layoutString;
+ private string startSymbol;
+ private string endSymbol;
+
+ public ListBoxValues()
+ {
+ InitializeComponent();
+ }
+
+ public void SetLayoutInfo(string layout, string startS, string endS)
+ {
+ if (layout == null || startS == null || endS == null)
+ {
+ return;
+ }
+ layoutString = layout;
+ startSymbol = startS;
+ endSymbol = endS;
+ }
+
+ public int SelectedIndex
+ {
+ get
+ {
+ if (listBox.SelectedIndex == -1)
+ {
+ return -1;
+ }
+ return listBox.SelectedIndex;
+ }
+ set
+ {
+ if (listBox.SelectedItems.Count != 0)
+ {
+ listBox.SelectedIndex = value;
+ }
+ }
+ }
+
+ public T GetObjectFromStr() where T : class, new()
+ {
+ if (listBox.SelectedIndex == -1)
+ {
+ return null;
+ }
+ string row = listBox.SelectedItem.ToString()!;
+ T curObject = new T();
+ StringBuilder sb = new StringBuilder(row);
+ foreach (var property in typeof(T).GetProperties())
+ {
+ if (!property.CanWrite)
+ {
+ continue;
+ }
+
+ int borderOne = sb.ToString().IndexOf(startSymbol);
+ if (borderOne == -1)
+ {
+ break;
+ }
+
+ int borderTwo = sb.ToString().IndexOf(endSymbol, borderOne + 1);
+ if (borderTwo == -1)
+ {
+ break;
+ }
+
+ string propertyValue = sb.ToString(borderOne + 1, borderTwo - borderOne - 1);
+ sb.Remove(0, borderTwo + 1);
+ property.SetValue(curObject, Convert.ChangeType(propertyValue, property.PropertyType));
+ }
+ return curObject;
+ }
+
+ public void FillProperty(T dataObject, int rowIndex, string propertyName)
+ {
+ if (layoutString == null || startSymbol == null || endSymbol == null)
+ {
+ return;
+ }
+
+ while (listBox.Items.Count <= rowIndex)
+ {
+ listBox.Items.Add(layoutString);
+ }
+
+ string row = listBox.Items[rowIndex].ToString();
+ PropertyInfo propertyInfo = dataObject.GetType().GetProperty(propertyName);
+
+ if (propertyInfo != null)
+ {
+ object propertyValue = propertyInfo.GetValue(dataObject);
+ row = row.Replace($"{startSymbol}{propertyName}{endSymbol}", propertyValue.ToString());
+ listBox.Items[rowIndex] = row;
+ }
+ }
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/ListBoxValues.resx b/WinForm/PdfFormsLibrary/ListBoxValues.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/ListBoxValues.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WinForm/PdfFormsLibrary/NumberTextBox.Designer.cs b/WinForm/PdfFormsLibrary/NumberTextBox.Designer.cs
new file mode 100644
index 0000000..96dec40
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/NumberTextBox.Designer.cs
@@ -0,0 +1,72 @@
+namespace WinForm
+{
+ partial class NumberTextBox
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ componentTitleLabel = new Label();
+ textBox = new TextBox();
+ SuspendLayout();
+ //
+ // componentTitleLabel
+ //
+ componentTitleLabel.AutoSize = true;
+ componentTitleLabel.Font = new Font("Segoe UI", 9F, FontStyle.Bold, GraphicsUnit.Point);
+ componentTitleLabel.Location = new Point(13, 12);
+ componentTitleLabel.Name = "componentTitleLabel";
+ componentTitleLabel.Size = new Size(154, 15);
+ componentTitleLabel.TabIndex = 1;
+ componentTitleLabel.Text = "Введите номер телефона";
+ //
+ // textBox
+ //
+ textBox.Location = new Point(13, 41);
+ textBox.Name = "textBox";
+ textBox.Size = new Size(234, 23);
+ textBox.TabIndex = 2;
+ textBox.TextChanged += TextBox_TextChanged;
+ textBox.Enter += TextBox_Enter;
+ //
+ // NumberTextBox
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ Controls.Add(textBox);
+ Controls.Add(componentTitleLabel);
+ Name = "NumberTextBox";
+ Size = new Size(260, 80);
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private TextBox numberTextBox;
+ private Label componentTitleLabel;
+ private TextBox textBox;
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/NumberTextBox.cs b/WinForm/PdfFormsLibrary/NumberTextBox.cs
new file mode 100644
index 0000000..6d0d62b
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/NumberTextBox.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace WinForm
+{
+ public partial class NumberTextBox : UserControl
+ {
+ //Шаблон для textbox
+ private string? pattern;
+ private string example = "+7XXXXXXXXXX";
+
+ public NumberTextBox()
+ {
+ InitializeComponent();
+ }
+
+ //Публичное свойство для получения и заполнения шаблона
+ public string? Pattern
+ {
+ get { return pattern; }
+ set { pattern = value; }
+ }
+
+ public string? TextBoxValue
+ {
+ get
+ {
+ if (new Regex(Pattern).IsMatch(textBox.Text))
+ {
+ return textBox.Text;
+ }
+ return null;
+ }
+ set
+ {
+ if (new Regex(Pattern).IsMatch(value))
+ {
+ textBox.Text = value;
+ }
+
+ }
+ }
+
+ //Метод для заполнения примера
+ public void SetExample(string str)
+ {
+ if (new Regex(Pattern).IsMatch(str))
+ {
+ example = str;
+ }
+ }
+
+ private void TextBox_Enter(object sender, EventArgs e)
+ {
+ int VisibleTime = 3000;
+ ToolTip tt = new ToolTip();
+ tt.Show(example, textBox, 0, 25, VisibleTime);
+ }
+
+ private EventHandler _explicitEvent;
+ public event EventHandler ExplicitEvent
+ {
+ add
+ {
+ _explicitEvent += value;
+ }
+ remove
+ {
+ _explicitEvent -= value;
+ }
+ }
+
+ private void TextBox_TextChanged(object sender, EventArgs e)
+ {
+ _explicitEvent?.Invoke(sender, e);
+ }
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/NumberTextBox.resx b/WinForm/PdfFormsLibrary/NumberTextBox.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/NumberTextBox.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WinForm/PdfFormsLibrary/PdfFormsLibrary.csproj b/WinForm/PdfFormsLibrary/PdfFormsLibrary.csproj
new file mode 100644
index 0000000..8a056da
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfFormsLibrary.csproj
@@ -0,0 +1,16 @@
+
+
+
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
diff --git a/WinForm/PdfFormsLibrary/PdfGeneratorControl.Designer.cs b/WinForm/PdfFormsLibrary/PdfGeneratorControl.Designer.cs
new file mode 100644
index 0000000..40a89d0
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfGeneratorControl.Designer.cs
@@ -0,0 +1,36 @@
+namespace PdfFormsLibrary
+{
+ partial class PdfGeneratorControl
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/PdfGeneratorControl.cs b/WinForm/PdfFormsLibrary/PdfGeneratorControl.cs
new file mode 100644
index 0000000..f60b514
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfGeneratorControl.cs
@@ -0,0 +1,55 @@
+using MigraDoc.DocumentObjectModel;
+using MigraDoc.Rendering;
+using PdfSharp.Fonts;
+using PdfSharp.Pdf;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PdfFormsLibrary
+{
+ public partial class PdfGeneratorControl : Component
+ {
+ public PdfGeneratorControl()
+ {
+ InitializeComponent();
+ }
+
+ public PdfGeneratorControl(IContainer container)
+ {
+ container.Add(this);
+
+ InitializeComponent();
+ }
+
+ public void GeneratePdf(string filePath, string documentTitle, List textData)
+ {
+ if (string.IsNullOrEmpty(filePath) || string.IsNullOrEmpty(documentTitle) || textData == null)
+ {
+ return;
+ }
+
+ Document document = new Document();
+
+ Section section = document.AddSection();
+
+ Paragraph title = section.AddParagraph(documentTitle);
+ title.Format.Font.Bold = true;
+
+ foreach (var item in textData)
+ {
+ Paragraph paragraph = section.AddParagraph();
+ paragraph.AddText(item);
+ }
+
+ PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true, PdfFontEmbedding.Always);
+ pdfRenderer.Document = document;
+ pdfRenderer.RenderDocument();
+ pdfRenderer.PdfDocument.Save(filePath);
+ }
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/PdfGeneratorLinearDiagram.Designer.cs b/WinForm/PdfFormsLibrary/PdfGeneratorLinearDiagram.Designer.cs
new file mode 100644
index 0000000..afceef5
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfGeneratorLinearDiagram.Designer.cs
@@ -0,0 +1,36 @@
+namespace PdfFormsLibrary
+{
+ partial class PdfGeneratorLinearDiagram
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/PdfGeneratorLinearDiagram.cs b/WinForm/PdfFormsLibrary/PdfGeneratorLinearDiagram.cs
new file mode 100644
index 0000000..82cb690
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfGeneratorLinearDiagram.cs
@@ -0,0 +1,84 @@
+using MigraDoc.DocumentObjectModel;
+using MigraDoc.Rendering;
+using OxyPlot;
+using OxyPlot.Axes;
+using OxyPlot.Legends;
+using OxyPlot.Series;
+using OxyPlot.WindowsForms;
+using System.ComponentModel;
+using System.Reflection;
+using PdfFormsLibrary.Helpers;
+
+namespace PdfFormsLibrary
+{
+ public partial class PdfGeneratorLinearDiagram : Component
+ {
+ public PdfGeneratorLinearDiagram()
+ {
+ InitializeComponent();
+ }
+
+ public PdfGeneratorLinearDiagram(IContainer container)
+ {
+ container.Add(this);
+
+ InitializeComponent();
+ }
+
+ public void GeneratePdfDocumentWithChart(PdfWithDiagramData pdfDiagram)
+ {
+ if (string.IsNullOrEmpty(pdfDiagram.FilePath) || string.IsNullOrEmpty(pdfDiagram.DocumentTitle)
+ || string.IsNullOrEmpty(pdfDiagram.DiagramName) || pdfDiagram.Series == null)
+ {
+ return;
+ }
+
+ var plotModel = new PlotModel { Title = pdfDiagram.DiagramName };
+
+ var xAxis = new LinearAxis { Position = AxisPosition.Bottom };
+ var yAxis = new LinearAxis { Position = AxisPosition.Left };
+ plotModel.Axes.Add(xAxis);
+ plotModel.Axes.Add(yAxis);
+
+ foreach (var item in pdfDiagram.Series)
+ {
+ var singleSeries = new LineSeries { Title = item.Name };
+ foreach (var coordinates in item.Data)
+ {
+ singleSeries.Points.Add(new DataPoint(coordinates.Item1, coordinates.Item2));
+ }
+ plotModel.Series.Add(singleSeries);
+ }
+
+ var fieldInfo = typeof(DiagramLegendPosition).GetField(pdfDiagram.LegendPosition.ToString());
+ var attribute = fieldInfo?.GetCustomAttribute();
+
+ plotModel.Legends.Add(new Legend()
+ {
+ LegendTitle = "Легенда",
+ LegendPlacement = attribute.Placement,
+ LegendPosition = attribute.Position,
+ });
+ plotModel.IsLegendVisible = true;
+
+ var document = new Document();
+ document.Info.Title = pdfDiagram.DocumentTitle;
+
+ var section = document.AddSection();
+ section.PageSetup.TopMargin = "1cm";
+
+ var image = new PngExporter { Width = 600, Height = 400 }.ExportToBitmap(plotModel);
+ image.Save("temp.png");
+
+ var chartImage = section.AddImage("temp.png");
+ chartImage.LockAspectRatio = true;
+ chartImage.Width = "15cm";
+ chartImage.Height = "10cm";
+
+ var pdfRenderer = new PdfDocumentRenderer(true);
+ pdfRenderer.Document = document;
+ pdfRenderer.RenderDocument();
+ pdfRenderer.PdfDocument.Save(pdfDiagram.FilePath);
+ }
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/PdfTableGenerator.Designer.cs b/WinForm/PdfFormsLibrary/PdfTableGenerator.Designer.cs
new file mode 100644
index 0000000..5be0b76
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfTableGenerator.Designer.cs
@@ -0,0 +1,36 @@
+namespace PdfFormsLibrary
+{
+ partial class PdfTableGenerator
+ {
+ ///
+ /// Обязательная переменная конструктора.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Освободить все используемые ресурсы.
+ ///
+ /// истинно, если управляемый ресурс должен быть удален; иначе ложно.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Код, автоматически созданный конструктором компонентов
+
+ ///
+ /// Требуемый метод для поддержки конструктора — не изменяйте
+ /// содержимое этого метода с помощью редактора кода.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ }
+
+ #endregion
+ }
+}
diff --git a/WinForm/PdfFormsLibrary/PdfTableGenerator.cs b/WinForm/PdfFormsLibrary/PdfTableGenerator.cs
new file mode 100644
index 0000000..13d9dd1
--- /dev/null
+++ b/WinForm/PdfFormsLibrary/PdfTableGenerator.cs
@@ -0,0 +1,134 @@
+using PdfSharp.Pdf;
+using MigraDoc.DocumentObjectModel;
+using MigraDoc.DocumentObjectModel.Tables;
+using MigraDoc.Rendering;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PdfFormsLibrary.Helpers;
+
+namespace PdfFormsLibrary
+{
+ public partial class PdfTableGenerator : Component
+ {
+ private int fontSize = 14;
+
+ public PdfTableGenerator()
+ {
+ InitializeComponent();
+ }
+
+ public PdfTableGenerator(IContainer container)
+ {
+ container.Add(this);
+
+ InitializeComponent();
+ }
+
+ public void GeneratePdf(PdfWithTableData pdfTable)
+ {
+ if (pdfTable == null || string.IsNullOrEmpty(pdfTable.FilePath)
+ || string.IsNullOrEmpty(pdfTable.DocumentTitle) || pdfTable.TableHeader == null)
+ {
+ throw new ArgumentException("Недостаточно данных для создания PDF-документа.");
+ }
+ Document document = new Document();
+ Section section = document.AddSection();
+
+ Paragraph title = section.AddParagraph(pdfTable.DocumentTitle);
+ title.Format.Font.Bold = true;
+ title.Format.Alignment = ParagraphAlignment.Center;
+
+ Table table = section.AddTable();
+ table.Borders.Visible = true;
+
+ foreach (var column in pdfTable.TableHeader)
+ {
+ if (column.SubColumns.Count > 0)
+ {
+ foreach(var sub in column.SubColumns)
+ {
+ Column newsub = table.AddColumn();
+ newsub.Width = sub.ColumnWidth;
+ }
+ continue;
+ }
+
+ Column newcolumn = table.AddColumn();
+ newcolumn.Width = column.ColumnWidth;
+ }
+
+ CreateTableHeader(table, pdfTable.TableHeader);
+
+ CreateTableData(table, pdfTable);
+
+ PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);
+ pdfRenderer.Document = document;
+ pdfRenderer.RenderDocument();
+ pdfRenderer.PdfDocument.Save(pdfTable.FilePath);
+ }
+
+ public void CreateTableHeader(Table table, List headerInfo)
+ {
+ Row headerRow1 = table.AddRow();
+ Row headerRow2 = table.AddRow();
+
+ foreach (Row headerRow in new Row[] { headerRow1, headerRow2 })
+ {
+ headerRow.HeadingFormat = true;
+ headerRow.Format.Alignment = ParagraphAlignment.Center;
+ headerRow.Format.Font.Bold = true;
+ }
+
+ int i = 0;
+ foreach (var column in headerInfo)
+ {
+ int rowSpan = Math.Max(1, column.SubColumns.Count);
+
+ if (column.SubColumns.Count > 0)
+ {
+ headerRow1.Cells[i].MergeRight = rowSpan - 1;
+
+ for (int j = 0; j < column.SubColumns.Count; j++)
+ {
+ headerRow2.Cells[i + j].AddParagraph(column.SubColumns[j].ColumnName);
+ }
+ }
+ else
+ {
+ headerRow1.Cells[i].MergeDown = rowSpan;
+ }
+
+ headerRow1.Cells[i].AddParagraph(column.ColumnName);
+ i += rowSpan;
+ }
+ }
+
+ private void CreateTableData(Table table, PdfWithTableData data)
+ {
+ if (data == null || data.TableData == null)
+ return;
+
+ foreach (var rowData in data.TableData)
+ {
+ Row newrow = table.AddRow();
+ int i = 0;
+ foreach (var column in data.Props)
+ {
+ try
+ {
+ object cellValue = typeof(T).GetProperty(column).GetValue(rowData);
+ string cellText = cellValue?.ToString() ?? string.Empty;
+ newrow.Cells[i].AddParagraph(cellText);
+ ++i;
+ }
+ catch { }
+ }
+ }
+ }
+ }
+}
diff --git a/WinForm/WinForm.sln b/WinForm/WinForm.sln
index a2e3c86..5ae7f97 100644
--- a/WinForm/WinForm.sln
+++ b/WinForm/WinForm.sln
@@ -5,15 +5,17 @@ VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinForm", "WinForm\WinForm.csproj", "{79A863DB-93E6-44C2-AB0F-DE0D19BE72DC}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsLibrary", "WinFormsLibrary\WinFormsLibrary.csproj", "{B617E65D-B482-4120-BC74-66B760D66FEF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinFormsLibrary", "WinFormsLibrary\WinFormsLibrary.csproj", "{B617E65D-B482-4120-BC74-66B760D66FEF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataModels", "DataModels\DataModels.csproj", "{D468732D-BA49-4D2C-8854-DD4FDA8FDC1D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataModels", "DataModels\DataModels.csproj", "{D468732D-BA49-4D2C-8854-DD4FDA8FDC1D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{B90EEDCA-96C8-4E5C-9C5B-7F663023802D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contracts", "Contracts\Contracts.csproj", "{B90EEDCA-96C8-4E5C-9C5B-7F663023802D}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataBaseImplement", "DataBaseImplement\DataBaseImplement.csproj", "{E94AC3C7-A9BB-4262-9C87-5DF8E03B643B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataBaseImplement", "DataBaseImplement\DataBaseImplement.csproj", "{E94AC3C7-A9BB-4262-9C87-5DF8E03B643B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppView", "AppView\AppView.csproj", "{9BD73EC6-6B32-4CBB-8D04-9D4650562846}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppView", "AppView\AppView.csproj", "{9BD73EC6-6B32-4CBB-8D04-9D4650562846}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdfFormsLibrary", "PdfFormsLibrary\PdfFormsLibrary.csproj", "{2BFDA66F-E786-4C74-8D3A-054C6D1FDF7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -45,6 +47,10 @@ Global
{9BD73EC6-6B32-4CBB-8D04-9D4650562846}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BD73EC6-6B32-4CBB-8D04-9D4650562846}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BD73EC6-6B32-4CBB-8D04-9D4650562846}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2BFDA66F-E786-4C74-8D3A-054C6D1FDF7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2BFDA66F-E786-4C74-8D3A-054C6D1FDF7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2BFDA66F-E786-4C74-8D3A-054C6D1FDF7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2BFDA66F-E786-4C74-8D3A-054C6D1FDF7D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/WinForm/WinForm/FormNoGraphics.Designer.cs b/WinForm/WinForm/FormNoGraphics.Designer.cs
index 9b3415d..14a0ee0 100644
--- a/WinForm/WinForm/FormNoGraphics.Designer.cs
+++ b/WinForm/WinForm/FormNoGraphics.Designer.cs
@@ -29,7 +29,7 @@
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
- pdfGeneratorControl = new WinFormsLibrary.PdfGeneratorControl(components);
+ pdfGeneratorControl = new PdfFormsLibrary.PdfGeneratorControl(components);
groupBoxPdfText = new GroupBox();
buttonSaveDiagram = new Button();
buttonSaveTable = new Button();
@@ -38,8 +38,8 @@
labelBigText = new Label();
labelTitle = new Label();
textBoxTitle = new TextBox();
- pdfTableGenerator = new WinFormsLibrary.PdfTableGenerator(components);
- pdfGeneratorLinearDiagram = new WinFormsLibrary.PdfGeneratorLinearDiagram(components);
+ pdfTableGenerator = new PdfFormsLibrary.PdfTableGenerator(components);
+ pdfGeneratorLinearDiagram = new PdfFormsLibrary.PdfGeneratorLinearDiagram(components);
groupBoxPdfText.SuspendLayout();
SuspendLayout();
//
@@ -138,16 +138,16 @@
#endregion
- private WinFormsLibrary.PdfGeneratorControl pdfGeneratorControl;
+ private PdfFormsLibrary.PdfGeneratorControl pdfGeneratorControl;
private GroupBox groupBoxPdfText;
private Label labelTitle;
private TextBox textBoxTitle;
private Button buttonSaveFile;
private RichTextBox richTextBox;
private Label labelBigText;
- private WinFormsLibrary.PdfTableGenerator pdfTableGenerator;
+ private PdfFormsLibrary.PdfTableGenerator pdfTableGenerator;
private Button buttonSaveDiagram;
private Button buttonSaveTable;
- private WinFormsLibrary.PdfGeneratorLinearDiagram pdfGeneratorLinearDiagram;
+ private PdfFormsLibrary.PdfGeneratorLinearDiagram pdfGeneratorLinearDiagram;
}
}
\ No newline at end of file
diff --git a/WinForm/WinForm/FormNoGraphics.cs b/WinForm/WinForm/FormNoGraphics.cs
index 37bcd23..4d1973c 100644
--- a/WinForm/WinForm/FormNoGraphics.cs
+++ b/WinForm/WinForm/FormNoGraphics.cs
@@ -1,4 +1,4 @@
-using WinFormsLibrary.Helpers;
+using PdfFormsLibrary.Helpers;
namespace WinForm
{
diff --git a/WinForm/WinForm/WinForm.csproj b/WinForm/WinForm/WinForm.csproj
index 0654708..40addba 100644
--- a/WinForm/WinForm/WinForm.csproj
+++ b/WinForm/WinForm/WinForm.csproj
@@ -9,7 +9,7 @@
-
+
\ No newline at end of file