Added logic to handle RO table (in word section) that uses underbars to draw the horizontal lines.

This commit is contained in:
John Jenko 2014-02-25 15:22:18 +00:00
parent 7ceacd813c
commit 238724db6c

View File

@ -1051,39 +1051,52 @@ namespace VEPROMS.CSLA.Library
}
// Back in the DOS days, an underbar was used to toggle underlining on/off
// Spit the val text on the underbar characters
string[] parts = val.Split("_".ToCharArray());
foreach (string part in parts)
{
// If there is a carrage return, and underline is turned on, then turn off the underline
if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone && part.Contains("\r"))
string[] parts = val.Split("_".ToCharArray());
foreach (string part in parts)
{
int idx = part.IndexOf("\r");
string part1 = part.Substring(0, idx);
string part2 = part.Substring(idx);
sel.TypeText(part1);
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
sel.TypeText(part2);
}
else // put out each part of the split text and toggle the underline on/off
{
// Farley had a case where the underlining of text with spaces at end of line was
// not underlining the spaces. To fix this, test for spaces at the end of text
// and ireplace last space with a hard space. Note that the underlying issue
// existed in MS Word, so this is a work around from our code to make MS Word work.
// The problem was in Farley's FNP-1-ECP-3.1, Table 1 - 'ro': W.4T.
if (part.EndsWith(" "))
// if we have a row of underbar "_" chars then we will parts of empty strings.
// in this case, we want to output the underbar char and turn off underlining.
// Ex Commanche Peak RO table in ECA-1.1A Attachment 5
if (part.Equals(""))
{
if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone)
{
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
sel.TypeText("_");
}
sel.TypeText("_");
}
// If there is a carrage return, and underline is turned on, then turn off the underline
else if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone && part.Contains("\r"))
{
sel.TypeText(part.Substring(0,part.Length-1));
sel.InsertSymbol(160);
}
else
sel.TypeText(part);
if (sel.Font.Underline == LBWdUnderline.wdUnderlineNone)
sel.Font.Underline = LBWdUnderline.wdUnderlineSingle;
else
int idx = part.IndexOf("\r");
string part1 = part.Substring(0, idx);
string part2 = part.Substring(idx);
sel.TypeText(part1);
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
}
sel.TypeText(part2);
}
else // put out each part of the split text and toggle the underline on/off
{
// Farley had a case where the underlining of text with spaces at end of line was
// not underlining the spaces. To fix this, test for spaces at the end of text
// and ireplace last space with a hard space. Note that the underlying issue
// existed in MS Word, so this is a work around from our code to make MS Word work.
// The problem was in Farley's FNP-1-ECP-3.1, Table 1 - 'ro': W.4T.
if (part.EndsWith(" "))
{
sel.TypeText(part.Substring(0, part.Length - 1));
sel.InsertSymbol(160);
}
else
sel.TypeText(part);
if (sel.Font.Underline == LBWdUnderline.wdUnderlineNone)
sel.Font.Underline = LBWdUnderline.wdUnderlineSingle;
else
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
}
//}
}
// We are done processing the text in val, if underline is on, turn it off
if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone)