Added logic so that MSWord 2010 and beyond uses the internal export to PDF function.
Added logic to handle errors when a document is closed. The code will attempt to do a close 10 times. If it fails ten times, it will document the exception and continue. If an exception occurs when an MSWord section is being saved, a message will be displayed that will document the error.
This commit is contained in:
@@ -110,7 +110,9 @@ namespace LBWordLibrary
|
||||
public string CreatePDF(string pdfFileName)
|
||||
{
|
||||
pdfFileName = AvailableFileName(pdfFileName);
|
||||
if (Convert.ToSingle(Version) >= 12.0F && WordPDFExporterInstalled)
|
||||
if (Convert.ToSingle(Version) > 12.0F)
|
||||
return CreatePDF2007(pdfFileName);
|
||||
if (Convert.ToSingle(Version) == 12.0F && WordPDFExporterInstalled)
|
||||
return CreatePDF2007(pdfFileName);
|
||||
else if (VolianPDFInstalled)
|
||||
return CreatePDF2003BG(pdfFileName);
|
||||
@@ -189,8 +191,9 @@ namespace LBWordLibrary
|
||||
public string CreatePDF2007(string pdfFileName)
|
||||
{
|
||||
pdfFileName = AvailableFileName(pdfFileName);
|
||||
if (!WordPDFExporterInstalled)
|
||||
throw new Exception("MS Word PDF Exporter is not installed");
|
||||
// Removed to support MSWord 2010 and beyond.
|
||||
//if (!WordPDFExporterInstalled)
|
||||
// throw new Exception("MS Word PDF Exporter is not installed");
|
||||
try
|
||||
{
|
||||
ActiveDocument.ExportAsFixedFormat(pdfFileName, LBWdExportFormat.wdExportFormatPDF);
|
||||
|
Reference in New Issue
Block a user