From 96c253ad876ce659126d8e759da1d3869ec5f1d1 Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 5 Oct 2017 14:35:49 +0000 Subject: [PATCH] Changed Debug Format for invalid fonts in tables --- PROMS/Volian.Print.Library/Grid2Pdf.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/PROMS/Volian.Print.Library/Grid2Pdf.cs b/PROMS/Volian.Print.Library/Grid2Pdf.cs index 0dd91c84..10f0124e 100644 --- a/PROMS/Volian.Print.Library/Grid2Pdf.cs +++ b/PROMS/Volian.Print.Library/Grid2Pdf.cs @@ -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 /// /// /// - 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