You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
5.6 KiB
148 lines
5.6 KiB
using DOCGEN.Klassen;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using edoka_dms;
|
|
using Syncfusion.XlsIO.Parser.Biff_Records;
|
|
using Syncfusion.DocIO.DLS;
|
|
using System.Data.SqlClient;
|
|
using System.Data;
|
|
using System.Runtime.CompilerServices;
|
|
using Model;
|
|
using Database;
|
|
using NLog.Config;
|
|
using System.Runtime.Serialization;
|
|
using System.Xml.Linq;
|
|
using NLog.LayoutRenderers;
|
|
using System.Configuration;
|
|
using Syncfusion.DocIO;
|
|
using Syncfusion.Pdf;
|
|
using System.IO;
|
|
|
|
namespace DOCGEN
|
|
{
|
|
|
|
public class DocGen
|
|
{
|
|
public edoka_dms.clsConnectionProvider conn_edoka = new edoka_dms.clsConnectionProvider();
|
|
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
|
|
public string DokumentID = "";
|
|
public string connectionstring = "";
|
|
public clsDocData DocData = new clsDocData();
|
|
DB db = new DB();
|
|
public string apikey = "";
|
|
public string resturi = "";
|
|
|
|
public void Lic()
|
|
{
|
|
// 25. string lickey = "Ngo9BigBOggjHTQxAR8/V1NCaF5cXmZCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXdecXRdQ2heUU13XUI="
|
|
//string lickey = "Ngo9BigBOggjHTQxAR8/V1NCaF5cXmZCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXZeeXRQR2NZUEZ2WkE=";
|
|
string lickey = "Ngo9BigBOggjHTQxAR8/V1NCaF1cXGJCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXZeeXRQR2ZfVEV2VkA=";
|
|
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(lickey);
|
|
}
|
|
public DocGen() {
|
|
Lic();
|
|
}
|
|
public DocGen(string Connectionstring)
|
|
{
|
|
this.connectionstring = Connectionstring;
|
|
this.DocData = DocData;
|
|
db.connectionstring = this.connectionstring;
|
|
Lic();
|
|
}
|
|
|
|
public DocGen(string Connectionstring, string RestURI, string ApiKey)
|
|
{
|
|
this.connectionstring = Connectionstring;
|
|
this.DocData = DocData;
|
|
db.connectionstring = this.connectionstring;
|
|
Lic();
|
|
this.resturi = RestURI;
|
|
this.apikey = ApiKey;
|
|
}
|
|
public string GenDocID(clsDocData docdata)
|
|
{
|
|
this.DocData = docdata;
|
|
if (DocData.UseEDOKA_Values.ToUpper() == "TRUE")
|
|
{
|
|
DokumentID=db.Create_EDOKA_Doc(this.DocData);
|
|
Logging.DocLog.Info("Dokument erstellt", "DocGen", DokumentID, docdata.PartnerNr.ToString(), docdata.Ersteller.ToString());
|
|
}
|
|
else { DokumentID = ""; };
|
|
return DokumentID;
|
|
}
|
|
|
|
public string Barcodetest(string dokumentid)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string generate_pdf(string dokumentid)
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public string generate_serienbrief(string vorlage,serienbrief sb, string dokumentid, string resturi, string apikey)
|
|
{
|
|
SyncFWord sfword = new SyncFWord(resturi,apikey);
|
|
clsdok dok = new clsdok("", "", "");
|
|
clsDocData dd = new clsDocData();
|
|
dd.DocMacros = new List<clsDocMacro>();
|
|
dd.Dokumentid = dokumentid;
|
|
dd.DokumentDatum = sb.dokumentdatum.ToString();
|
|
dd.Unterschrift_Links=sb.unterschriftlinks.ToString();
|
|
dd.Unterschrift_Rechts = sb.unterschriftrechts.ToString();
|
|
dd.DocValues = sb.DocValues;
|
|
dd.As_Faksimile = sb.faksimile_unterschrfit.ToString();
|
|
dd.Barcode = sb.vertrag == 1;
|
|
dd.VorlageNr = sb.officevorlagenr.ToString();
|
|
dd.barcode_height = sb.barcode_height;
|
|
dd.barcode_width = sb.barcode_width;
|
|
dd.barcode_top = sb.barcode_top;
|
|
dd.barcode_left = sb.barcode_left;
|
|
dd.barcode_horizontal = sb.barcode_horizontal;
|
|
dd.barcode_font=sb.barcode_font;
|
|
dd.barcode_fontsize = Convert.ToInt32(sb.barcode_fontsize);
|
|
dd.barcode_textposition=sb.barcode_textposition;
|
|
dd.barcode_zusatz = sb.barcode_zusatz;
|
|
dd.barcode_type=sb.barcode_type;
|
|
dd.barcode_content = sb.barcode_content;
|
|
dd.barcode_text = sb.barcode_text;
|
|
|
|
dok.dokument = sfword.Generate_Word(vorlage,dd, sb.img_unterschriftlinks,sb.img_unterschrfitrechts,sb.img_faktura);
|
|
db = null;
|
|
dok.doktype = "D";
|
|
|
|
sfword = null;
|
|
return dok.dokument;
|
|
}
|
|
|
|
//public void createpdf(string filename)
|
|
//{
|
|
// WordDocument document = new WordDocument(filename, FormatType.Automatic);
|
|
// CompatibilityMode compatibilityMode = document.Settings.CompatibilityMode;
|
|
// //document.UpdateDocumentFields();
|
|
// //document.UpdateDocumentFields();
|
|
// //TextSelection textSelection = document.Find("den Kunden", false, true);
|
|
// //WTextRange textRange = textSelection.GetAsOneRange();
|
|
// //Modifies the text
|
|
// //textRange.Text = "Replaced text";
|
|
// using (Syncfusion.DocToPDFConverter.DocToPDFConverter converter = new Syncfusion.DocToPDFConverter.DocToPDFConverter())
|
|
// {
|
|
// converter.Settings.EmbedFonts = true;
|
|
// //converter.Settings.UpdateDocumentFields = true;
|
|
// //converter.Settings.EnableAlternateChunks = true;
|
|
// //converter.Settings.AutoDetectComplexScript = true;
|
|
|
|
// //Converts Word document into PDF document
|
|
// using (PdfDocument pdfDocument = converter.ConvertToPDF(document))
|
|
// {
|
|
// pdfDocument.Save(filename + ".pdf");
|
|
// }
|
|
// };
|
|
//}
|
|
}
|
|
}
|