-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExcel.cs
40 lines (36 loc) · 1 KB
/
Excel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data;
using ExcelGenerator;
using ExcelGenerator.SpreadSheet;
namespace Kursach
{
class Excel
{
public bool save(string[][] table, string path, string name = "Отчёт парсинга auto.ru")
{
try
{
Workbook workbook = new Workbook();
Worksheet worksheet = new Worksheet(name);
for (int i = 0; i < table.Length; i++)
{
Row row = new Row();
for(int j = 0; j < table[i].Length; j++)
row.Cells.Add(new Cell(table[i][j]));
worksheet.Rows.Add(row);
}
workbook.Worksheets.Add(worksheet);
workbook.save(path);
return true;
}
catch
{
return false;
}
}
}
}