Zhelovanov_Dmitrii_COP/WinForm/NonVisualForm.cs

89 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Spreadsheet;
using KOP_Labs.Classes;
using Microsoft.VisualBasic.ApplicationServices;
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 NonVisualForm : Form
{
public NonVisualForm()
{
InitializeComponent();
}
MyHistogramm histogram;
private void buttonWordSave_Click(object sender, EventArgs e)
{
string filePath = "C:\\Users\\User\\Desktop\\универ\\3курс\\КОП\\Отчет.docx";
string title = "Заголовок";
string[,] row1 = {
{ "Стр1 Кол1", "Стр1 Кол2" }
};
string[,] row2 = {
{ "Стр2 Кол1", "Стр2 Кол2" }
};
string[,] row3 = {
{ "Стр3 Кол1", "Стр3 Кол3" }
};
MyTable table = new MyTable(filePath, title, new List<string[,]> { row1, row2, row3 });
wordTableComponent1.CreateDoc(table);
}
private void buttonSaveHist_Click(object sender, EventArgs e)
{
histogram = new("C:\\Users\\User\\Desktop\\универ\\3курс\\КОП\\Report.docx", "Третье задание", "Гистограмма", EnumLegends.Right, new List<DataHistogramm> {
new DataHistogramm("Доход", "Январь", 300), new DataHistogramm("Доход", "Апрель", 600),
new DataHistogramm("Доход", "Июль", 400), new DataHistogramm("Доход", "Октябрь", 200)
});
wordHistogramm1.CreateHistogramm(histogram);
}
List<Book> books;
Book book1 = new Book(1, "fgdf", "fdsds");
Book book2 = new Book(1, "aa", "fdads");
Book book3 = new Book(1, "fgdf", "ffsds");
Book book4 = new Book(1, "ffdsff", "asds");
Book book5 = new Book(1, "ffdsff", "asds");
Dictionary<int, ColumnParameters> colData;
private void buttonHead_Click(object sender, EventArgs e)
{
books = new()
{
book1, book2, book3, book4, book5
};
colData = new Dictionary<int, ColumnParameters>()
{
{ 0, new ColumnParameters("Марка автомобиля", "Id") },
{ 1, new ColumnParameters("Модель", "Name") },
{ 2, new ColumnParameters("Год выпуска", "Annotation") }
};
MyTableWithHead<Book> myTable;
//сгруппируй
myTable = new("C:\\Users\\User\\Desktop\\универ\\3курс\\КОП\\Report2.docx", "Второе задание", new List<double> { 48, 24 },
new List<double> { 2000, 2000, 1500, 1500 }, books, colData);
wordTableHeaderComponent1.CreateDoc(myTable);
}
}
}