updfate 20250919
This commit is contained in:
@@ -157,16 +157,28 @@ namespace DOCGEN
|
||||
public clsdok GetDocAsPDF(string Docid, DataTable pdfparameters = null,string tempdir="", bool schnellansicht = false)
|
||||
{
|
||||
clsdok dok = GetDoc(Docid);
|
||||
|
||||
DB db = new DB(connectionstring);
|
||||
db.Get_Tabledata("Select dokumenttypnr from dokument where dokumentid='" + Docid + "'", false, true);
|
||||
int dokumenttypnr = Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][0]);
|
||||
db.Get_Tabledata("Select count(*) from dbo.OnDoc_Update_PDF_Document_Fields where dokumenttypnr=" + dokumenttypnr.ToString(), false, true);
|
||||
bool updatefields = false;
|
||||
|
||||
try
|
||||
if (Convert.ToInt32(db.dsdaten.Tables[0].Rows[0][0]) > 0)
|
||||
{
|
||||
updatefields = true;
|
||||
}
|
||||
db = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
switch (dok.doktype.ToUpper().Substring(0, 1))
|
||||
{
|
||||
case "D":
|
||||
if (schnellansicht)
|
||||
{
|
||||
dok.dokument = Convert_Word_To_PDF(dok.dokument.ToString(), pdfparameters);
|
||||
dok.extension = "pdf";
|
||||
dok.dokument = Convert_Word_To_PDF(dok.dokument.ToString(), pdfparameters, false, updatefields);
|
||||
return dok;
|
||||
}
|
||||
DB db1 = new DB(connectionstring);
|
||||
@@ -193,7 +205,7 @@ namespace DOCGEN
|
||||
}
|
||||
|
||||
|
||||
dok.dokument = Convert_Word_To_PDF(dok.dokument.ToString(), pdfparameters);
|
||||
dok.dokument = Convert_Word_To_PDF(dok.dokument.ToString(), pdfparameters,false,updatefields);
|
||||
dok.extension = "pdf";
|
||||
return dok;
|
||||
break;
|
||||
@@ -344,14 +356,15 @@ namespace DOCGEN
|
||||
}
|
||||
|
||||
|
||||
public string Convert_Word_To_PDF(string document, DataTable pdfparameters = null, bool useseettings = false)
|
||||
public string Convert_Word_To_PDF(string document, DataTable pdfparameters = null, bool useseettings = false , bool updatefields=false)
|
||||
{
|
||||
|
||||
|
||||
|
||||
//Dokument erstellen
|
||||
var streamword = new MemoryStream(Convert.FromBase64String(document));
|
||||
WordDocument wordDocument = new WordDocument(streamword, Syncfusion.DocIO.FormatType.Automatic);
|
||||
wordDocument.Properties.Hyphenation.AutoHyphenation = true;
|
||||
wordDocument.UpdateDocumentFields();
|
||||
if (updatefields) { wordDocument.UpdateDocumentFields(); }
|
||||
//FileStream dictornyrystream = new FileStream(@"E:\Software-Projekte\OnDoc\OnDoc\Client\bin\Debug\hyph_de_CH.dic", FileMode.Open);
|
||||
//Hyphenator.Dictionaries.Add("de-CH", dictornyrystream);
|
||||
|
||||
@@ -364,7 +377,7 @@ namespace DOCGEN
|
||||
converter.Settings.EmbedFonts = true;
|
||||
if (useseettings)
|
||||
{
|
||||
converter.Settings.UpdateDocumentFields = true;
|
||||
converter.Settings.UpdateDocumentFields = updatefields;
|
||||
converter.Settings.EnableAlternateChunks = true;
|
||||
converter.Settings.AutoDetectComplexScript = true;
|
||||
converter.Settings.ImageResolution = 640;
|
||||
@@ -372,7 +385,7 @@ namespace DOCGEN
|
||||
}
|
||||
else
|
||||
{
|
||||
converter.Settings.UpdateDocumentFields = true;
|
||||
converter.Settings.UpdateDocumentFields = updatefields;
|
||||
converter.Settings.EnableAlternateChunks = true;
|
||||
converter.Settings.AutoDetectComplexScript = true;
|
||||
converter.Settings.ImageResolution = 640;
|
||||
|
||||
Reference in New Issue
Block a user