update 20250501

This commit is contained in:
Stefan Hutter
2025-05-01 09:50:49 +02:00
parent eb5c908f0c
commit c7a4e24e3f
160 changed files with 1339 additions and 400 deletions

View File

@@ -1988,19 +1988,37 @@ namespace OnDocOffice
clsFileHelper fh = new clsFileHelper();
string filename=tempdir+ DateTime.Now.ToString("yyyyMMddhhmmss")+"_"+dokumentid+dok.extension;
string outputfile = filename + ".pdf";
fh.SaveBase64ToFile(dok.dokument, filename);
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document worddoc = new Microsoft.Office.Interop.Word.Document();
worddoc= word.Documents.Open(filename);
word.ActiveDocument.EmbedTrueTypeFonts = true;
worddoc.EmbedTrueTypeFonts= true;
worddoc.ExportAsFixedFormat(outputfile.ToString(), Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF, false, Microsoft.Office.Interop.Word.WdExportOptimizeFor.wdExportOptimizeForPrint, Microsoft.Office.Interop.Word.WdExportRange.wdExportAllDocument,0,99, Microsoft.Office.Interop.Word.WdExportItem.wdExportDocumentContent, true, true, Microsoft.Office.Interop.Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, true, true, false);
try
{
fh.SaveBase64ToFile(dok.dokument, filename);
Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document worddoc = new Microsoft.Office.Interop.Word.Document();
worddoc = word.Documents.Open(filename);
word.ActiveDocument.EmbedTrueTypeFonts = true;
worddoc.EmbedTrueTypeFonts = true;
worddoc.ExportAsFixedFormat(outputfile.ToString(), Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF, false, Microsoft.Office.Interop.Word.WdExportOptimizeFor.wdExportOptimizeForPrint, Microsoft.Office.Interop.Word.WdExportRange.wdExportAllDocument, 0, 99, Microsoft.Office.Interop.Word.WdExportItem.wdExportDocumentContent, true, true, Microsoft.Office.Interop.Word.WdExportCreateBookmarks.wdExportCreateNoBookmarks, true, true, false);
worddoc.Close(false);
word.Quit(false);
worddoc = null;
word = null;
return fh.Base64FromFile(outputfile);
}
catch { return ""; }
finally
{
try
{
System.IO.File.Delete(filename);
}
catch { }
try
{
System.IO.File.Delete(outputfile.ToString());
}
catch { };
}
worddoc.Close(false);
word.Quit(false);
worddoc = null;
word = null;
return fh.Base64FromFile(outputfile);
}