KOP/TestingForm/FormMain.cs
2024-10-04 12:20:51 +04:00

49 lines
1.5 KiB
C#

namespace TestingForm
{
public partial class FormMain : Form
{
public FormMain()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog
{
Filter = "pdf|*.pdf",
};
if (dialog.ShowDialog() == DialogResult.OK)
{
List<string[][]> tables = new List<string[][]>();
string[][] table1 = new string[2][];
table1[0] = new string[] { "test", "test 2" };
table1[1] = new string[] { "test next", "test next 2" };
string[][] table2 = new string[3][];
table2[0] = new string[] { "ttt", "ttt 2", "ttt 3" };
table2[1] = new string[] { "ttt next", "ttt next 2" };
table2[2] = new string[] { "next" };
tables.Add(table1);
tables.Add(table2);
try
{
userControlTableDocument1.SaveToDocument(
"Çàãîëîâîê äîêóìåíòà",
dialog.FileName,
tables
);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Îøèáêà", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
MessageBox.Show("Óñïåøíî");
}
}
}