Update 20241229
This commit is contained in:
@@ -25,6 +25,7 @@ namespace DOCGEN.Generator
|
||||
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
public string apikey = "";
|
||||
public string resturi = "";
|
||||
public int Office_Fill_DocIO = 0;
|
||||
|
||||
public void Lic()
|
||||
{
|
||||
@@ -47,21 +48,24 @@ namespace DOCGEN.Generator
|
||||
this.resturi= RestUri;
|
||||
}
|
||||
|
||||
public DocGenerator_from_EDOKA(string connectionstring, string tempdir, string RestUri, string ApiKey)
|
||||
public DocGenerator_from_EDOKA(string connectionstring, string tempdir, string RestUri, string ApiKey, int Office_Fill_DocIO)
|
||||
{
|
||||
this.connectionstring = connectionstring;
|
||||
this.tempdir = tempdir;
|
||||
this.resturi = RestUri;
|
||||
this.apikey = ApiKey;
|
||||
this.Office_Fill_DocIO= Office_Fill_DocIO;
|
||||
}
|
||||
|
||||
public clsdok Generate_Doc_EDOKA(string dokumentid, ref clsDocData docdata, bool useoffice = false, int OfficeSleep=0 )
|
||||
public clsdok Generate_Doc_EDOKA(string dokumentid, ref clsDocData docdata, bool useoffice = false, int OfficeSleep=0)
|
||||
{
|
||||
DB db = new DB(connectionstring);
|
||||
DataTable dt = new DataTable();
|
||||
DataTable dt2 = new DataTable();
|
||||
string Apptype = "";
|
||||
string Extension = "";
|
||||
Logging.Logging.Debug("Generate_Doc_EDOKA", "Get_Vorlage", 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()));
|
||||
@@ -74,12 +78,21 @@ namespace DOCGEN.Generator
|
||||
SyncFWord sfword = new SyncFWord(resturi,apikey);
|
||||
generate_docdata(dokumentid, ref docdata);
|
||||
clsdok dok = new clsdok("", "", "");
|
||||
if (useoffice == false) {
|
||||
dok.dokument = sfword.Generate_Word(dt.Rows[0][0].ToString(), docdata);
|
||||
} else
|
||||
if (useoffice == false) {
|
||||
Logging.Logging.Debug("Generate_Word", "Start", dokumentid);
|
||||
dok.dokument = sfword.Generate_Word(dt.Rows[0][0].ToString(), docdata);
|
||||
Logging.Logging.Debug("Generate_Word", "Ende", dokumentid);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.Debug("Generate_Word_in_Office", "Init", dokumentid);
|
||||
OnDocOffice.clsWordEdit oo = new OnDocOffice.clsWordEdit("", "","");
|
||||
dok.dokument = oo.Generate_Word_in_Office(ref docdata, ref dok, dt.Rows[0][0].ToString(), connectionstring, tempdir, dokumentid, Apptype,Extension,OfficeSleep);
|
||||
Logging.Logging.Debug("Generate_Word_in_Office", "Start", dokumentid);
|
||||
|
||||
dok.dokument = oo.Generate_Word_in_Office(ref docdata, ref dok, dt.Rows[0][0].ToString(), connectionstring, tempdir, dokumentid, Apptype,Extension,OfficeSleep,Office_Fill_DocIO);
|
||||
Logging.Logging.Debug("Generate_Word_in_Office", "Ende", dokumentid);
|
||||
oo = null;
|
||||
}
|
||||
|
||||
dok.doktype = "D";
|
||||
@@ -88,12 +101,24 @@ namespace DOCGEN.Generator
|
||||
return dok;
|
||||
case "XLSM": case "XLSX": case "XLST": case "XLS": case "XLT":
|
||||
case "EXCEL":
|
||||
|
||||
SyncFExcel sfexcel = new SyncFExcel();
|
||||
generate_docdata(dokumentid, ref docdata);
|
||||
clsdok dokexcel = new clsdok("", "", "");
|
||||
dokexcel.dokument = sfexcel.Generate_Excel(dt.Rows[0][0].ToString(), docdata);
|
||||
dokexcel.doktype = "X";
|
||||
dokexcel.extension = dt2.Rows[0][1].ToString();
|
||||
if (useoffice == false)
|
||||
{
|
||||
dokexcel.dokument = sfexcel.Generate_Excel(dt.Rows[0][0].ToString(), docdata);
|
||||
dokexcel.doktype = "X";
|
||||
dokexcel.extension = dt2.Rows[0][1].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
OnDocOffice.clsExcelEdit eo = new OnDocOffice.clsExcelEdit("", "", "");
|
||||
dokexcel.dokument = eo.Generate_Excel_in_Office(ref docdata, ref dokexcel, dt.Rows[0][0].ToString(), connectionstring, tempdir, dokumentid, Apptype, Extension, OfficeSleep, Office_Fill_DocIO);
|
||||
dokexcel.doktype = "X";
|
||||
dokexcel.extension = dt2.Rows[0][1].ToString();
|
||||
eo = null;
|
||||
}
|
||||
return dokexcel;
|
||||
//break;
|
||||
case "PDF": case "ACROBAT": case "FORMULAR": case "DOKUMENT":
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace DOCGEN.Klassen
|
||||
{
|
||||
foreach (IWorksheet worksheet in workBook.Worksheets)
|
||||
{
|
||||
if (dv.FieldName== "TGEDKNameInhaber")
|
||||
if (dv.FieldName == "TGEDKNameInhaber")
|
||||
{
|
||||
var a = 0;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace DOCGEN.Klassen
|
||||
{
|
||||
worksheet.Range[dv.FieldName].Text = dv.Value.ToString();
|
||||
}
|
||||
catch { }
|
||||
catch { }
|
||||
|
||||
//foreach (IName name in worksheet.Names)
|
||||
//{
|
||||
@@ -76,8 +76,13 @@ namespace DOCGEN.Klassen
|
||||
// Debug.Print(name.Value);
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (docdata.Barcode == true)
|
||||
{
|
||||
Insert_Barcode(workBook, docdata);
|
||||
}
|
||||
|
||||
MemoryStream destms = new MemoryStream();
|
||||
workBook.SaveAs(destms);
|
||||
workBook.Close();
|
||||
@@ -119,5 +124,45 @@ namespace DOCGEN.Klassen
|
||||
ex.Dispose();
|
||||
|
||||
}
|
||||
}
|
||||
public void Insert_Barcode(IWorkbook workBook, clsDocData docData)
|
||||
{
|
||||
System.Drawing.Image barcodeimage;
|
||||
BarcodeLib.Barcode Barcode = new BarcodeLib.Barcode();
|
||||
switch (docData.barcode_type)
|
||||
{
|
||||
case "0":
|
||||
int rotation = 0;
|
||||
if (docData.barcode_horizontal == 0) { rotation = 270; }
|
||||
barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5, docData.Dokumentid.Substring(6, 16), docData.Dokumentid.Substring(6, 16) + docData.barcode_zusatz, docData.barcode_textposition, docData.Zusatz_Font, Convert.ToInt32(docData.Zusatz_FontSize), rotation);
|
||||
break;
|
||||
case "1":
|
||||
|
||||
//barcodeimage = Barcode.Get_Datamatrix(DataMatrix.net.DmtxScheme.DmtxSchemeAutoBest, docData.barcode_content, 4, 0, 0, "Left", docData.barcode_content, docData.barcode_font, docData.barcode_fontsize);
|
||||
|
||||
barcodeimage = Barcode.Get_Datamatrix(DataMatrix.net.DmtxScheme.DmtxSchemeAscii, docData.barcode_content, 6, 6, 0, "Right", docData.barcode_text + docData.barcode_zusatz, docData.barcode_font, docData.barcode_fontsize + 5);
|
||||
//barcodeimage.Save(@"x:\bctest.png");
|
||||
break;
|
||||
default:
|
||||
barcodeimage = Barcode.Get_LinerBarcode(Barcoded.Symbology.I2of5C, docData.Dokumentid.Substring(9, 13), docData.Dokumentid.Substring(6, 16) + docData.barcode_zusatz, docData.barcode_textposition, docData.barcode_font, Convert.ToInt32(docData.barcode_fontsize), 0);
|
||||
break;
|
||||
}
|
||||
foreach (IWorksheet worksheet in workBook.Worksheets)
|
||||
{
|
||||
foreach (IName name in workBook.Names)
|
||||
{
|
||||
if (name.Name.ToString().ToUpper().Substring(0, 7) == "TGEDKBC")
|
||||
{
|
||||
int i = name.Index;
|
||||
int row = worksheet.Range[name.Name].Row;
|
||||
int col = worksheet.Range[name.Name].Column;
|
||||
|
||||
IPictureShape picture = worksheet.Pictures.AddPicture(row, col, barcodeimage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// System.Drawing.Im
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,6 +153,7 @@ namespace DOCGEN.Klassen
|
||||
// return (Image)new Bitmap(imgToResize, size);
|
||||
|
||||
//}
|
||||
|
||||
public string Generate_Word(string base64, clsDocData docdata, string img_UL="", string img_UR="",string img_faktura="")
|
||||
{
|
||||
string formattype = "";
|
||||
@@ -168,11 +169,11 @@ namespace DOCGEN.Klassen
|
||||
|
||||
break;
|
||||
default:
|
||||
document.Settings.CompatibilityMode = CompatibilityMode.Word2010;
|
||||
document.Settings.CompatibilityMode = CompatibilityMode.Word2003;
|
||||
break;
|
||||
}
|
||||
if (compatibilityMode == CompatibilityMode.Word2010) { document.Settings.CompatibilityMode = CompatibilityMode.Word2010; }
|
||||
if (compatibilityMode > CompatibilityMode.Word2010) { document.Settings.CompatibilityMode = CompatibilityMode.Word2010; }
|
||||
//if (compatibilityMode == CompatibilityMode.Word2010) { document.Settings.CompatibilityMode = CompatibilityMode.Word2010; }
|
||||
//if (compatibilityMode > CompatibilityMode.Word2010) { document.Settings.CompatibilityMode = CompatibilityMode.Word2013; }
|
||||
formattype = document.ActualFormatType.ToString();
|
||||
var formattype_original = document.ActualFormatType;
|
||||
string ppimg = "";
|
||||
@@ -188,12 +189,31 @@ namespace DOCGEN.Klassen
|
||||
|
||||
if (docdata.Kopfzeile_generieren == true)
|
||||
{
|
||||
//BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
|
||||
//bookmarkNavigator.MoveToBookmark("TGEDKCompanyBBEB99");
|
||||
//IWParagraph paragraph = new WParagraph(document);
|
||||
//paragraph.AppendBreak(BreakType.LineBreak);
|
||||
try
|
||||
{
|
||||
BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(document);
|
||||
bookmarkNavigator.MoveToBookmark("TGEDKCompanyBBEB99");
|
||||
IWParagraph paragraph = new WParagraph(document);
|
||||
paragraph.AppendBreak(BreakType.LineBreak);
|
||||
|
||||
}
|
||||
catch {
|
||||
foreach (WSection section in document.Sections)
|
||||
{
|
||||
IWParagraph p;
|
||||
|
||||
p = section.HeadersFooters.FirstPageHeader.AddParagraph();
|
||||
foreach (clsDocValue dv in docdata.DocValues)
|
||||
{
|
||||
if (dv.TMBeginn.ToString() == "TGEDKCompanyBBEB99")
|
||||
{
|
||||
p.AppendText(dv.Value);
|
||||
}
|
||||
}
|
||||
p.AppendBookmarkStart("TGEDKCompanyBBEB99");
|
||||
p.AppendBreak(BreakType.LineBreak);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (img_faktura != "")
|
||||
{
|
||||
@@ -668,7 +688,7 @@ namespace DOCGEN.Klassen
|
||||
}
|
||||
WPicture picture2 = new WPicture(document);
|
||||
picture2 = picture;
|
||||
|
||||
|
||||
section.HeadersFooters.Footer.AddParagraph().ChildEntities.Add(picture);
|
||||
section.HeadersFooters.FirstPageFooter.AddParagraph().ChildEntities.Add(picture2);
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -66,6 +66,7 @@ X:\docdemo\EDOKA_2024\DOCGEN\bin\Debug\EDOKA_Barcode.dll
|
||||
X:\docdemo\EDOKA_2024\DOCGEN\bin\Debug\BarcodeStandard.dll
|
||||
X:\docdemo\EDOKA_2024\DOCGEN\bin\Debug\EDOKA_Barcode.pdb
|
||||
X:\docdemo\EDOKA_2024\DOCGEN\bin\Debug\EDOKA_Barcode.dll.config
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\Syncfusion.XlsIO.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\obj\Debug\DocGen.csproj.AssemblyReference.cache
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\obj\Debug\DocGen.csproj.CoreCompileInputs.cache
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\libSkiaSharp.dylib
|
||||
@@ -129,7 +130,6 @@ E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\Syncfusion.ExcelToPdfConverter
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\Syncfusion.OfficeChart.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\Syncfusion.Pdf.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\Syncfusion.Presentation.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\Syncfusion.XlsIO.Base.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\System.Buffers.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\System.Memory.xml
|
||||
E:\Software-Projekte\OnDoc\OnDoc\DOCGEN\bin\Debug\System.Numerics.Vectors.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user