2 лаба готова полностью
This commit is contained in:
parent
7d7ed2e49a
commit
70ec02bfbd
@ -25,6 +25,10 @@ namespace Components.LogicalComponents
|
||||
}
|
||||
public bool createWithImages(ExcelImageInfo info)
|
||||
{
|
||||
if (string.IsNullOrEmpty(info.path) || string.IsNullOrEmpty(info.title) || info.imagePaths == null || info.imagePaths.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Не все поля заполнены.");
|
||||
}
|
||||
var excelApp = new Microsoft.Office.Interop.Excel.Application { SheetsInNewWorkbook = 1 };
|
||||
Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
|
||||
try
|
||||
|
1
COP/WinFormsTest/FormTest.Designer.cs
generated
1
COP/WinFormsTest/FormTest.Designer.cs
generated
@ -223,6 +223,7 @@
|
||||
// openFileDialog
|
||||
//
|
||||
this.openFileDialog.FileName = "openFileDialog";
|
||||
this.openFileDialog.Multiselect = true;
|
||||
//
|
||||
// FormTest
|
||||
//
|
||||
|
@ -1,5 +1,7 @@
|
||||
using Components.Exceptions;
|
||||
using Components.LogicalComponents;
|
||||
using Microsoft.Office.Core;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -142,7 +144,7 @@ namespace WinFormsTest
|
||||
var files = openFileDialog.FileNames;
|
||||
openFileDialog.Dispose();
|
||||
List<Bitmap> images = new List<Bitmap>();
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test.xlsx";
|
||||
string path = "C:\\Users\\Полина\\source\\repos\\COP\\COP\\WinFormsTest\\test.xlsx";
|
||||
if (excelImagesComponent.createWithImages(new ExcelImageInfo(path, "Header", files))) MessageBox.Show("Успех!");
|
||||
else MessageBox.Show("Ошибка, проверьте консоль");
|
||||
}
|
||||
@ -154,7 +156,7 @@ namespace WinFormsTest
|
||||
workers.Add(new OfficeWorker(1, "Иванов", "Иван", 20, "Отдел продаж", "Бухгалтер", 25, "+7(834)234-03-49"));
|
||||
workers.Add(new OfficeWorker(1, "Петров", "Петр", 25, "Отдел продаж", "Менеджер", 20, "+7(834)123-03-49"));
|
||||
workers.Add(new OfficeWorker(1, "Сидоров", "Сергей", 27, "Отдел кадров", "HR", 2, "+7(834)593-03-49", true));
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test2.xlsx";
|
||||
string path = "C:\\Users\\Полина\\source\\repos\\COP\\COP\\WinFormsTest\\test2.xlsx";
|
||||
List<(int, int)> merges = new List<(int, int)>();
|
||||
merges.Add((1, 3));
|
||||
merges.Add((4, 6));
|
||||
@ -177,7 +179,7 @@ namespace WinFormsTest
|
||||
departments.Add(new Department("Dep 1", 330));
|
||||
departments.Add(new Department("Dep 2", 500));
|
||||
departments.Add(new Department("Dep 3", 170));
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "test3.xlsx";
|
||||
string path = "C:\\Users\\Полина\\source\\repos\\COP\\COP\\WinFormsTest\\test3.xlsx";
|
||||
if (excelDiagramComponent.createWithDiagram(path, "test3", "Продажи", DiagramLegendEnum.TopRight, departments, "name", "sells")) MessageBox.Show("Успех");
|
||||
else MessageBox.Show("Fail :(");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user