Changed Debug Format for invalid fonts in tables

This commit is contained in:
Rich 2017-10-05 14:35:49 +00:00
parent f3ac8c9a42
commit 96c253ad87

View File

@ -419,7 +419,7 @@ namespace Volian.Print.Library
iTextSharp.text.Font ff = null;
if (!ii.FormatStepData.Font.FontIsProportional())
ff = Volian.Svg.Library.VolianPdf.GetFont("VESymbFix", (int)ii.FormatStepData.Font.Size, (int)ii.FormatStepData.Font.WindowsFont.Style);
iTextSharp.text.Paragraph myPara = RtfToParagraph(str, ff);
iTextSharp.text.Paragraph myPara = RtfToParagraph(str, ff, r, c);
myColumnText1.SetSimpleColumn(0, 0, w-2, MyContentByte.PdfDocument.PageSize.Top); // Padding = 4
if (str.Contains(@"\'05"))
@ -776,9 +776,9 @@ namespace Volian.Print.Library
str = _StatRTB.Rtf;
return str;
}
private iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont)
private iTextSharp.text.Paragraph RtfToParagraph(string rtf, iTextSharp.text.Font mySymFont,int r, int c)
{
rtf=FixRTFToPrint(rtf);
rtf=FixRTFToPrint(rtf,r,c);
IRtfDocument rtfDoc = RtfInterpreterTool.BuildDoc(rtf);
Rtf2iTextSharp rtf2IText = new Rtf2iTextSharp(rtfDoc);
rtf2IText.DefaultFont = mySymFont;
@ -793,7 +793,7 @@ namespace Volian.Print.Library
/// </summary>
/// <param name="rtf"></param>
/// <returns></returns>
private string FixRTFToPrint(string rtf)
private string FixRTFToPrint(string rtf,int r, int c)
{
// Only do this if the text contains symbols.
if (rtf.Contains("VESymbFix"))
@ -832,7 +832,8 @@ namespace Volian.Print.Library
if (rtb.SelectionLength == 0 && strRTF != null && rtb.SelectionFont.FontFamily.Name == "VESymbFix")
{
// Add debug information to the error log if the selection length is zero
_MyLog.WarnFormat("Font Issues in Table Cell rtf= {0}, \nI= {1}, TXT = {2}", strRTF, i, rtb.Text.Substring(0, i));
// Changed debug information to make it more useful
_MyLog.WarnFormat("\r\n=====>Font Issues in Table ItemID {0} [{1},{2}] I= {3}, TXT = {4}",MyTable.ItemID,r,c, i, rtb.Text.Substring(Math.Max(0, i-10), Math.Min(20,rtb.TextLength -i)));
strRTF = null;
}
// bug fix: B2017-046 - check for selection length of zero to fix index out of bounds error