update 20250319
This commit is contained in:
@@ -139,6 +139,7 @@ if (docdata.Bezeichnung.Contains("QDF"))
|
||||
//if (dok.extension.ToUpper()=="DOTM") { dok.extension = "docm"; }
|
||||
return dok;
|
||||
case "XLSM": case "XLSX": case "XLST": case "XLS": case "XLT":
|
||||
case "XLTM":
|
||||
case "EXCEL":
|
||||
|
||||
SyncFExcel sfexcel = new SyncFExcel();
|
||||
@@ -146,7 +147,7 @@ if (docdata.Bezeichnung.Contains("QDF"))
|
||||
clsdok dokexcel = new clsdok("", "", "", "");
|
||||
if (useoffice == false)
|
||||
{
|
||||
dokexcel.dokument = sfexcel.Generate_Excel(dt.Rows[0][0].ToString(), docdata);
|
||||
dokexcel.dokument = sfexcel.Generate_Excel(dt.Rows[0][0].ToString(), docdata, Apptype.ToUpper());
|
||||
dokexcel.doktype = "X";
|
||||
dokexcel.extension = dt2.Rows[0][1].ToString();
|
||||
}
|
||||
|
||||
@@ -47,15 +47,13 @@ namespace DOCGEN.Klassen
|
||||
|
||||
}
|
||||
|
||||
public string Generate_Excel(string base64, clsDocData docdata)
|
||||
public string Generate_Excel(string base64, clsDocData docdata, string apptype)
|
||||
{
|
||||
ExcelEngine ex = new ExcelEngine();
|
||||
IApplication app = ex.Excel;
|
||||
MemoryStream ms = new MemoryStream(Helper.EncodeExtensions.DecodeBase642ByteArray(base64));
|
||||
IWorkbook workBook = app.Workbooks.Open(ms, ExcelOpenType.Automatic);
|
||||
|
||||
string formattype = "";
|
||||
|
||||
|
||||
foreach (clsDocValue dv in docdata.DocValues)
|
||||
{
|
||||
foreach (IWorksheet worksheet in workBook.Worksheets)
|
||||
@@ -86,7 +84,14 @@ namespace DOCGEN.Klassen
|
||||
}
|
||||
|
||||
MemoryStream destms = new MemoryStream();
|
||||
workBook.SaveAs(destms);
|
||||
if (apptype == "XLTM")
|
||||
{
|
||||
workBook.SaveAs(destms, ExcelSaveType.SaveAsMacroTemplate);
|
||||
} else
|
||||
{
|
||||
workBook.SaveAs(destms);
|
||||
}
|
||||
|
||||
workBook.Close();
|
||||
workBook = null;
|
||||
ex.Dispose();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user