diff --git a/PROMS/Volian.Print.Library/CompleteRORpt.cs b/PROMS/Volian.Print.Library/CompleteRORpt.cs index a93a4ea8..bb8768ca 100644 --- a/PROMS/Volian.Print.Library/CompleteRORpt.cs +++ b/PROMS/Volian.Print.Library/CompleteRORpt.cs @@ -235,26 +235,29 @@ namespace Volian.Print.Library { int uidx = 0; string strChk = (instr.Substring(idx)); - MatchCollection mc1 = Regex.Matches(strChk, "[_](.*?)"); // look for underline on/off - foreach (Match m1 in mc1) + if (!_LastWasName) //B2016-251 Don't change underscore to underline to Name value { - if (uidx < m1.Index) + MatchCollection mc1 = Regex.Matches(strChk, "[_](.*?)"); // look for underline on/off + foreach (Match m1 in mc1) { - string tstr = (strChk.Substring(uidx, m1.Index - uidx)); - if (tstr.EndsWith(" ")) - tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; - chk = new Chunk(tstr, fnt); - if (underlineChunk) - chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); - chk.SetTextRise(0); - p.Add(chk); - uidx += (tstr.Length+1); - underlineChunk = !underlineChunk; - } - else if (uidx == m1.Index) - { - uidx++; - underlineChunk = !underlineChunk; + if (uidx < m1.Index) + { + string tstr = (strChk.Substring(uidx, m1.Index - uidx)); + if (tstr.EndsWith(" ")) + tstr = tstr.Substring(0, tstr.Length - 1) + "\xA0"; + chk = new Chunk(tstr, fnt); + if (underlineChunk) + chk.SetUnderline(Color.BLACK, 0, 0.05F, 0, -.131F, PdfContentByte.LINE_CAP_ROUND); + chk.SetTextRise(0); + p.Add(chk); + uidx += (tstr.Length + 1); + underlineChunk = !underlineChunk; + } + else if (uidx == m1.Index) + { + uidx++; + underlineChunk = !underlineChunk; + } } } if (uidx <= strChk.Length - 1) @@ -403,9 +406,9 @@ namespace Volian.Print.Library showStatBar.BarMax = (int)RO_df.GetFileLength(); showStatBar.StatMsg = "Creating Report"; // Loop until either printing is aborted or end of file. - while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) + while (!StopPrinting && (iRecType = RO_df.ReadInteger16()) != -1) { - //Console.WriteLine("Record Type: {0}", iRecType); + //Console.WriteLine("Record Type: {0}.{0:X}", iRecType); switch (iRecType) { case 1: // Set Header @@ -658,7 +661,8 @@ namespace Volian.Print.Library else Hdrs.repeatCount[iLoop] =hdrRptCnt; pTmp = RO_df.ReadText(); - if (Hdrs.strHdrs.Count-1 < iLoop) + //Console.WriteLine("SH[{0}]", pTmp); + if (Hdrs.strHdrs.Count - 1 < iLoop) Hdrs.strHdrs.Add(pTmp); else Hdrs.strHdrs[iLoop] = pTmp; @@ -669,13 +673,16 @@ namespace Volian.Print.Library // Set the new header count Hdrs.HdrCnt = iNewCnt; } + bool _LastWasName = false;//B2016-251 Don't change underscore to underline to Name value public void PushHeader() { //if (m_pPrinterOut->Row() > 55) //// m_pPrinterOut->newpage(); //pdfReportDoc.NewPage(); string pTmp = RO_df.ReadText(); + //Console.WriteLine("PH[{0}]", pTmp); curheaderlen = pTmp.Length; + _LastWasName = (pTmp == "Name");//B2016-251 Don't change underscore to underline to Name value //Hdrs.strHdrs[Hdrs.HdrCnt] = pTmp; Hdrs.strHdrs.Add(pTmp); //Hdrs.repeatCount[Hdrs.HdrCnt] = 2; @@ -731,7 +738,8 @@ namespace Volian.Print.Library //pdfDest = new PdfDestination(PdfDestination.FITH, _MyPDFWriter.DirectContent.PdfDocument.PageSize.Height); AddOutlineLevel(parentOutline, iLoop, Hdrs.strHdrs[iLoop], MyPdfDestPage); } - AddText(Hdrs.strHdrs[iLoop], F12Bold); // should be bold and first header is centered + // Change double underscore to spaces in header text + AddText(Hdrs.strHdrs[iLoop].Replace("__"," "), F12Bold); // should be bold and first header is centered } } static float _Top = 792; @@ -837,7 +845,11 @@ namespace Volian.Print.Library { // Get the lenght of the text string and read it in Int16 iValue = RO_df.ReadInteger16(); - string szStr = RO_df.ReadText(iValue); + string szStr = ""; + // B2016-247 If size is zero it is an empty string. + if (iValue > 0) + szStr = RO_df.ReadText(iValue); + //Console.WriteLine("[{0}.{0:X}]='{1}'",iValue,szStr); string temp = szStr; Chunk chk = LastHeader(); Phrase p = new Phrase();