43 lines
1009 B
C#
43 lines
1009 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using NotVisualComponent.Models;
|
|
using NotVisualComponent.Helpers;
|
|
|
|
namespace NotVisualComponent
|
|
{
|
|
public partial class ExcelTable : Component
|
|
{
|
|
public ExcelTable()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public ExcelTable(IContainer container)
|
|
{
|
|
container.Add(this);
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void CreateDoc(TableConfig config)
|
|
{
|
|
config.CheckFields();
|
|
IContext creator = new WorkWithExcel();
|
|
creator.CreateHeader(config.Header);
|
|
if (config.Data != null)
|
|
foreach (var datum in config.Data)
|
|
{
|
|
creator.CreateTable(datum);
|
|
}
|
|
|
|
creator.SaveDoc(config.FilePath);
|
|
}
|
|
}
|
|
}
|