update 20250501
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user