46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Syncfusion.XlsIO;
|
|
|
|
namespace DOCGEN.Klassen
|
|
{
|
|
public class SynFExcel
|
|
{
|
|
public bool create_nativ(string property, string value, string base64, string originalfile, string destfile)
|
|
{
|
|
FileStream ms = new FileStream(originalfile, FileMode.Open, FileAccess.Read);
|
|
FileStream os = new FileStream(destfile, FileMode.Create);
|
|
ExcelEngine ex = new ExcelEngine();
|
|
IApplication application = ex.Excel;
|
|
IWorkbook workbook = application.Workbooks.Open(ms);
|
|
|
|
try
|
|
{
|
|
workbook.CustomDocumentProperties[property].Text = value;
|
|
}
|
|
catch
|
|
{
|
|
workbook.CustomDocumentProperties.Remove(property);
|
|
workbook.CustomDocumentProperties[property].Text = value;
|
|
|
|
}
|
|
workbook.Replace("{Klassifizierung}", value);
|
|
//workbook.Names[workbook.CustomDocumentProperties[property].Name].RefersToRange.Text= workbook.CustomDocumentProperties[property].Text;
|
|
workbook.SaveAs(os);
|
|
workbook.Close();
|
|
workbook = null;
|
|
application = null;
|
|
ms.Close();
|
|
ms.Dispose();
|
|
os.Close();
|
|
os.Dispose();
|
|
return true;
|
|
|
|
}
|
|
}
|
|
}
|