update 20250406
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user