B2018-071 Don't crash when trying to convert an invalid word document to PDF
This commit is contained in:
parent
86c85bee58
commit
a2e0b9aee3
@ -727,6 +727,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
PdfInfo myPdf = PdfInfo.Get(sect,DocReplace!=null);
|
PdfInfo myPdf = PdfInfo.Get(sect,DocReplace!=null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// B2018-071 Save list of DocIDs for invalid document so that error log messages are not repeated
|
||||||
|
private static List<int> _MissingDocs = new List<int>();
|
||||||
public static bool SetDocPdf(DocumentInfo docInfo, ItemInfo sect)
|
public static bool SetDocPdf(DocumentInfo docInfo, ItemInfo sect)
|
||||||
{
|
{
|
||||||
string pdfTmp = null;
|
string pdfTmp = null;
|
||||||
@ -737,6 +739,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
if (!_MissingDocs.Contains(docInfo.DocID))// B2018-071 Only add the message once to the error log
|
||||||
|
{
|
||||||
|
_MyLog.WarnFormat("Error trying to create PDF DocID = {0}", docInfo.DocID);// 2018-071 MS Word section could not be converted to PDF
|
||||||
|
_MissingDocs.Add(docInfo.DocID);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pdfTmp == null) return false;
|
if (pdfTmp == null) return false;
|
||||||
|
@ -1145,7 +1145,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (MyContent.MyEntry != null && MyContent.MyEntry.MyDocument != null)
|
if (MyContent.MyEntry != null && MyContent.MyEntry.MyDocument != null)
|
||||||
{
|
{
|
||||||
PdfInfo pi = PdfInfo.Get(this, false);
|
PdfInfo pi = PdfInfo.Get(this, false);
|
||||||
_MSWordPageCount = (float)pi.PageCount;
|
if(pi != null) _MSWordPageCount = (float)pi.PageCount;// B2018-071 Don't crash on invalid MS Word section
|
||||||
}
|
}
|
||||||
return _MSWordPageCount;
|
return _MSWordPageCount;
|
||||||
}
|
}
|
||||||
@ -2091,6 +2091,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//if (si.SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.Default)
|
//if (si.SectionConfig.Section_ColumnMode != SectionConfig.SectionColumnMode.Default)
|
||||||
return (int)si.SectionConfig.Section_ColumnMode - 1;
|
return (int)si.SectionConfig.Section_ColumnMode - 1;
|
||||||
}
|
}
|
||||||
|
//Console.WriteLine("PMode={0}, si.ColumnMode={1}, ColumnMode={2}", ActiveFormat.MyStepSectionLayoutData.PMode ,si.ColumnMode,(ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) - 1);
|
||||||
}
|
}
|
||||||
return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) - 1;
|
return (ActiveFormat.MyStepSectionLayoutData.PMode ?? 2) - 1;
|
||||||
}
|
}
|
||||||
@ -4273,7 +4274,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//wkstr = Regex.Replace(wkstr, @"{![.*?]}", @"{!$1}");
|
//wkstr = Regex.Replace(wkstr, @"{![.*?]}", @"{!$1}");
|
||||||
//wkstr = wkstr.Replace("{}", "");
|
//wkstr = wkstr.Replace("{}", "");
|
||||||
//if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}");
|
//if (vefont != null && vefont.HasCircleString2()) wkstr.Insert(0,"{!C0}");
|
||||||
//wkstr = wkstr.Replace("ê", @"{Box Step}");
|
//wkstr = wkstr.Replace("j", @"{Box Step}");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// if this has an alternate tab, use it. These have been used in background documents.
|
// if this has an alternate tab, use it. These have been used in background documents.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user