134 lines
4.3 KiB
C#
134 lines
4.3 KiB
C#
using Cop.Borovkov.Var3.Components;
|
|
using Newtonsoft.Json.Serialization;
|
|
using PIHelperSh.PdfCreator.Enums;
|
|
using TestCustomComponents.Models;
|
|
|
|
namespace TestCustomComponents.Forms
|
|
{
|
|
public partial class Form2 : Form
|
|
{
|
|
public Form2()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
customPdfTable1.SaveToPdf(new()
|
|
{
|
|
FilePath = @"E:\test\test.pdf",
|
|
Title = "Текст заголовка",
|
|
Tables = [new[,]
|
|
{
|
|
{ "00", "01", "02" },
|
|
{ "10", "11", "12" },
|
|
{ "20", "21", "22" },
|
|
}],
|
|
});
|
|
|
|
customPdfTable1.SaveToPdf(new()
|
|
{
|
|
FilePath = @"E:\test\test.pdf",
|
|
Title = "Текст заголовка",
|
|
Tables = [new[,]
|
|
{
|
|
{ "000", "001", "002" },
|
|
{ "010", "011", "012" },
|
|
{ "020", "021", "022" },
|
|
}, new[,]
|
|
{
|
|
{ "100", "101", "102" },
|
|
{ "110", "111", "112" },
|
|
{ "120", "121", "122" },
|
|
}],
|
|
});
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
customPdfTableWithGrouping1.SaveToPdf<TestModel>(new()
|
|
{
|
|
FilePath = @"E:\test\test.pdf",
|
|
Title = "Текст заголовка",
|
|
Columns = [
|
|
new() {
|
|
Header = "1",
|
|
PropertyName = nameof(TestModel.Height),
|
|
},
|
|
new() {
|
|
Header = "2",
|
|
PropertyName = nameof(TestModel.Name),
|
|
},
|
|
new() {
|
|
Header = "3",
|
|
PropertyName = nameof(TestModel.Id),
|
|
},
|
|
new() {
|
|
Header = "4",
|
|
PropertyName = nameof(TestModel.Age),
|
|
}
|
|
],
|
|
Rows = [
|
|
new() {
|
|
Value = new TestModel() {
|
|
Id = 1,
|
|
Name = "Vasya",
|
|
Age = 5,
|
|
Height = "low",
|
|
},
|
|
Height = 100f,
|
|
},
|
|
new() {
|
|
Value = new TestModel() {
|
|
Id = 2,
|
|
Name = "Masya",
|
|
Age = 8,
|
|
Height = "hi",
|
|
},
|
|
Height = 100f,
|
|
},
|
|
new() {
|
|
Value = new TestModel() {
|
|
Id = 3,
|
|
Name = "Kasya",
|
|
Age = 3,
|
|
Height = "low",
|
|
},
|
|
Height = 10f,
|
|
},
|
|
new() {
|
|
Value = new TestModel() {
|
|
Id = 4,
|
|
Name = "Asya",
|
|
Age = 100,
|
|
Height = "hi",
|
|
},
|
|
Height = 50f,
|
|
},
|
|
],
|
|
HeaderHeight = 100f,
|
|
});
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
customPdfHistogram1.SaveToPdf(new()
|
|
{
|
|
FilePath = @"E:\test\test.pdf",
|
|
DocumentTitle = "Текст заголовка",
|
|
HistogramTitle = "Заголовок диограммы",
|
|
Values = [
|
|
new(){
|
|
Name = "Линия1",
|
|
Values = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89],
|
|
},
|
|
new(){
|
|
Name = "Линия1",
|
|
Values = [1, 100, 10, 80, 30, 60, 50],
|
|
}
|
|
],
|
|
});
|
|
}
|
|
}
|
|
}
|