update 20241125
This commit is contained in:
@@ -49,7 +49,7 @@ namespace DOCGEN.Generator
|
||||
DataTable dt = new DataTable();
|
||||
DataTable dt2 = new DataTable();
|
||||
string Apptype = "";
|
||||
dt = db.Get_Vorlage_By_DokumentID(dokumentid);
|
||||
dt = db.Get_Vorlage_By_DokumentID(dokumentid,useoffice);
|
||||
db.dsdaten.Tables.Clear();
|
||||
dt2 = db.Get_ApplicationType_from_Vorlage(Convert.ToInt32(dt.Rows[0]["nr"].ToString()));
|
||||
Apptype = dt2.Rows[0][0].ToString();
|
||||
|
||||
24
DOCGEN/Klassen/Excel_Reader.cs
Normal file
24
DOCGEN/Klassen/Excel_Reader.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DOCGEN.Klassen
|
||||
{
|
||||
public class Excel_Reader
|
||||
{
|
||||
public void get_valus_from_excel(ref System.Data.DataTable dt, string excel)
|
||||
{
|
||||
SyncFExcel se = new SyncFExcel();
|
||||
se.get_values(ref dt, excel);
|
||||
foreach (System.Data.DataRow dr in dt.Rows)
|
||||
{
|
||||
DOCGEN.Klassen.Excel_Reader er = new DOCGEN.Klassen.Excel_Reader();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Buffers.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -96,5 +97,27 @@ namespace DOCGEN.Klassen
|
||||
return Convert.ToBase64String(imageArray);
|
||||
|
||||
}
|
||||
|
||||
public void get_values(ref System.Data.DataTable dt, string excelfile)
|
||||
{
|
||||
ExcelEngine ex = new ExcelEngine();
|
||||
IApplication app = ex.Excel;
|
||||
MemoryStream ms = new MemoryStream(Helper.EncodeExtensions.DecodeBase642ByteArray(excelfile));
|
||||
IWorkbook workBook = app.Workbooks.Open(ms, ExcelOpenType.Automatic);
|
||||
foreach (System.Data.DataRow dr in dt.Rows)
|
||||
{
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
row = Convert.ToInt32(dr["rowindex"]);
|
||||
col = Convert.ToInt32(dr["columnindex"]);
|
||||
|
||||
string value = workBook.Worksheets[Convert.ToInt32(dr["sheets"])].Range[row, col].Value.ToString();
|
||||
dr["value"] = value;
|
||||
}
|
||||
workBook.Close();
|
||||
workBook = null;
|
||||
ex.Dispose();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user