Added logic to handle RO table (in word section) that uses underbars to draw the horizontal lines.
This commit is contained in:
parent
7ceacd813c
commit
238724db6c
@ -1051,39 +1051,52 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
// Back in the DOS days, an underbar was used to toggle underlining on/off
|
// Back in the DOS days, an underbar was used to toggle underlining on/off
|
||||||
// Spit the val text on the underbar characters
|
// Spit the val text on the underbar characters
|
||||||
string[] parts = val.Split("_".ToCharArray());
|
string[] parts = val.Split("_".ToCharArray());
|
||||||
foreach (string part in parts)
|
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"))
|
|
||||||
{
|
{
|
||||||
int idx = part.IndexOf("\r");
|
// if we have a row of underbar "_" chars then we will parts of empty strings.
|
||||||
string part1 = part.Substring(0, idx);
|
// in this case, we want to output the underbar char and turn off underlining.
|
||||||
string part2 = part.Substring(idx);
|
// Ex Commanche Peak RO table in ECA-1.1A Attachment 5
|
||||||
sel.TypeText(part1);
|
if (part.Equals(""))
|
||||||
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
|
{
|
||||||
sel.TypeText(part2);
|
if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone)
|
||||||
}
|
{
|
||||||
else // put out each part of the split text and toggle the underline on/off
|
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
|
||||||
{
|
sel.TypeText("_");
|
||||||
// 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
|
sel.TypeText("_");
|
||||||
// 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.
|
// If there is a carrage return, and underline is turned on, then turn off the underline
|
||||||
// The problem was in Farley's FNP-1-ECP-3.1, Table 1 - 'ro': W.4T.
|
else if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone && part.Contains("\r"))
|
||||||
if (part.EndsWith(" "))
|
|
||||||
{
|
{
|
||||||
sel.TypeText(part.Substring(0,part.Length-1));
|
int idx = part.IndexOf("\r");
|
||||||
sel.InsertSymbol(160);
|
string part1 = part.Substring(0, idx);
|
||||||
}
|
string part2 = part.Substring(idx);
|
||||||
else
|
sel.TypeText(part1);
|
||||||
sel.TypeText(part);
|
|
||||||
|
|
||||||
if (sel.Font.Underline == LBWdUnderline.wdUnderlineNone)
|
|
||||||
sel.Font.Underline = LBWdUnderline.wdUnderlineSingle;
|
|
||||||
else
|
|
||||||
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
|
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
|
// We are done processing the text in val, if underline is on, turn it off
|
||||||
if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone)
|
if (sel.Font.Underline != LBWdUnderline.wdUnderlineNone)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user