update 20250406

This commit is contained in:
Stefan Hutter
2025-04-06 07:39:53 +02:00
parent 632b97c292
commit 42c86d957c
155 changed files with 1725 additions and 607 deletions

View File

@@ -222,6 +222,7 @@ namespace DOCGEN
return ReturnValue;
}
public string docfiletype { get; set; } = "";
private bool Is_WordDocument(MemoryStream stream)
{
Syncfusion.DocIO.DLS.WordDocument WordDocument = new Syncfusion.DocIO.DLS.WordDocument();
@@ -230,6 +231,7 @@ namespace DOCGEN
WordDocument.Open(stream, FormatType.Automatic);
string type = "";
type = WordDocument.ActualFormatType.ToString();
docfiletype = type;
return true;
}
catch
@@ -243,6 +245,24 @@ namespace DOCGEN
}
}
public string check_office_application(string source)
{
MemoryStream ms = new MemoryStream(Convert.FromBase64String(source));
if (Is_WordDocument(ms))
{
ms.Close();
ms = null;
return "Word";
}
if (Is_ExcelDocument(ms))
{
ms.Close();
ms = null;
return "Excel";
}
return "";
}
private bool Is_ExcelDocument(MemoryStream stream)
{
ExcelEngine excelEngine = new ExcelEngine();
@@ -254,7 +274,7 @@ namespace DOCGEN
string type = "";
workbook = application.Workbooks.Open(stream);
type = workbook.Version.ToString();
docfiletype = type;
return true;
}
catch