B2015-083: For WCNTRN, the Responsibility data was not wrapping correctly in some cases. This was fixed.

This commit is contained in:
Kathy Ruffing 2015-06-17 13:59:12 +00:00
parent 8546a09674
commit 3045682ed7

View File

@ -861,6 +861,7 @@ namespace Volian.Print.Library
private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation) private float DrawText(PdfContentByte cb, ref float yPageStart, float yTopMargin, float yBottomMargin, ref float yLocation)
{ {
// KBR (6/17/15): Fix for underline location in compressed steps: PrintOverride.StepCompress = false;
if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText); if(DebugText.IsOpen)DebugText.WriteLine("{0},'{1}','{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, FormattedText);
//Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content); //Console.WriteLine("{0},{1},'{2}','<<END>>'", MyItemInfo.ItemID, MyItemInfo.DBSequence, IParagraph.Content);
float retval = yLocation; float retval = yLocation;
@ -953,7 +954,10 @@ namespace Volian.Print.Library
//if (MyItemInfo.InList(39048)) Console.WriteLine("Here"); //if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
} }
MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier); MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier);
// KBR (6/17/15): Fix for underline location in compressed steps:
// KBR (6/17/15): if (MyPageHelper.YMultiplier != 1) PrintOverride.StepCompress = true;
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin); retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
// KBR (6/17/15): PrintOverride.StepCompress = true;
ProfileTimer.Pop(profileDepth); ProfileTimer.Pop(profileDepth);
if (retval == 0) // problem occurred - paragraph was not able to be printed on page if (retval == 0) // problem occurred - paragraph was not able to be printed on page
{ // pagination logic needs to be fixed. { // pagination logic needs to be fixed.
@ -3625,7 +3629,7 @@ namespace Volian.Print.Library
// This code handles whether user enters \r\n to separate lines or not. The // This code handles whether user enters \r\n to separate lines or not. The
// max width that a line can be in the Responsibility column is a format flag (passed in) // max width that a line can be in the Responsibility column is a format flag (passed in)
List<string> results = new List<string>(); List<string> results = new List<string>();
int width = 0; int width = 0; // keep track of current width of current 'line' while looking for space to break
int start = 0; // start of line (index into string 'text') int start = 0; // start of line (index into string 'text')
int lastspace = 0; // location of lastspace (index into string) int lastspace = 0; // location of lastspace (index into string)
for (int indx = 0; indx < responsStr.Length; indx++) for (int indx = 0; indx < responsStr.Length; indx++)
@ -3644,10 +3648,16 @@ namespace Volian.Print.Library
{ {
// what should be done if lastspace == 0 // what should be done if lastspace == 0
// cannot find space char to split on, so break the word // cannot find space char to split on, so break the word
if (lastspace == 0) lastspace = indx; bool spFound = true;
if (lastspace == 0)
{
lastspace = indx;
spFound = false;
}
results.Add(responsStr.Substring(start, lastspace - start).Trim(" ".ToCharArray()) + "\r\n"); results.Add(responsStr.Substring(start, lastspace - start).Trim(" ".ToCharArray()) + "\r\n");
start = lastspace + 1; start = lastspace + (spFound?1:0); // increment start based on whether a space is found, i.e. if no space keep at 'indx'
width = 0; // width either is equal to width of text after the last space, or is zero if at the maxlen of width:
width = (width - start - 1) > 0 ? width - start - 1 : 0;
lastspace = 0; lastspace = 0;
} }
} }