45 lines
861 B
C#
45 lines
861 B
C#
using ExcelComponents.Models;
|
|
using System.ComponentModel;
|
|
|
|
namespace ExcelComponents
|
|
{
|
|
public partial class BigTextExcel : Component
|
|
{
|
|
private readonly ExcelBuilder builder = new();
|
|
public BigTextExcel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public BigTextExcel(IContainer container)
|
|
{
|
|
container.Add(this);
|
|
|
|
InitializeComponent();
|
|
}
|
|
private static bool ConfigIsCorrect(BigTextConfig config)
|
|
{
|
|
if(config == null)
|
|
{
|
|
return false;
|
|
}
|
|
if(string.IsNullOrEmpty(config.FilePath) || File.Exists(config.FilePath))
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
public void BigTextGen(BigTextConfig config)
|
|
{
|
|
if(!ConfigIsCorrect(config))
|
|
{
|
|
return;
|
|
}
|
|
builder.CreateDocument();
|
|
builder.InsertText(1, 1, config.Title);
|
|
builder.InsertBigText(config.Text);
|
|
builder.SaveDocument(config.FilePath);
|
|
}
|
|
}
|
|
}
|