Fixed issue with RO table in a Word section. If the RO token was spaced over, only the first row of the table would be spaced over.
This commit is contained in:
parent
77da149ce7
commit
e24574e1b0
@ -870,7 +870,7 @@ namespace VEPROMS.CSLA.Library
|
||||
val = val.Replace("\xF8", "\xB0");
|
||||
// An X/Y Plot RO type might have text preceding the Plot Commands
|
||||
int pstart = val.IndexOf("<<G"); // find the starting Plot Command
|
||||
AddPrecedingText(sel, val.Substring(0, pstart));// replace the RO token with what's in front of the X/Y Plot
|
||||
AddPrecedingText(sel, val.Substring(0, pstart),0.0F);// replace the RO token with what's in front of the X/Y Plot
|
||||
val = val.Substring(pstart); // set val to the start of the plot commands
|
||||
//float width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
|
||||
//float height = 72 * lines / 6.0F;
|
||||
@ -933,7 +933,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
|
||||
// if val is null, then InsertROValue will put in "RO Not Found" for the value
|
||||
InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper);
|
||||
float indent = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage) - (float)sect.MyDocStyle.Layout.LeftMargin;;
|
||||
InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper, indent);
|
||||
}
|
||||
sel = FindRO();
|
||||
if (sel != null && sel.Start == lastStart)
|
||||
@ -1055,7 +1056,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return indxClose;
|
||||
}
|
||||
public static void AddPrecedingText(LBSelection sel, string val)
|
||||
public static void AddPrecedingText(LBSelection sel, string val, float indent)
|
||||
{
|
||||
if (val.IndexOf("_") == -1) // Is some of the text underlined?
|
||||
{
|
||||
@ -1065,8 +1066,10 @@ 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)
|
||||
bool firstLine = true;
|
||||
foreach (string partq in parts)
|
||||
{
|
||||
string part = partq;
|
||||
// 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
|
||||
@ -1091,6 +1094,19 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
else // put out each part of the split text and toggle the underline on/off
|
||||
{
|
||||
// IP3 has a word attachment containing a table RO. The Accessory Page ID in the word document
|
||||
// is spaced over several characters. When the RO value was printed, only the first line of the table
|
||||
// was spaced over. The remaining lines were up against the left margin.
|
||||
// this code will space over (indent) the remaining lines the same amount as the first line.
|
||||
if (!firstLine) sel.ParagraphFormat.FirstLineIndent = indent;
|
||||
if (firstLine && part.Contains("\r\n"))
|
||||
{
|
||||
int idx = part.IndexOf("\r\n");
|
||||
string beforeCR = part.Substring(0, idx + 2);
|
||||
part = part.Substring(idx + 2);
|
||||
sel.TypeText(beforeCR);
|
||||
sel.ParagraphFormat.FirstLineIndent = indent;
|
||||
}
|
||||
// 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
|
||||
@ -1109,7 +1125,6 @@ namespace VEPROMS.CSLA.Library
|
||||
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)
|
||||
@ -1283,7 +1298,7 @@ namespace VEPROMS.CSLA.Library
|
||||
myFile.Delete();
|
||||
return retval;
|
||||
}
|
||||
private static void InsertROValue(LBSelection sel, string roValue, bool upRoIfPrevUpper)
|
||||
private static void InsertROValue(LBSelection sel, string roValue, bool upRoIfPrevUpper, float indent)
|
||||
{
|
||||
if (roValue == null)
|
||||
{
|
||||
@ -1331,7 +1346,7 @@ namespace VEPROMS.CSLA.Library
|
||||
roValue = roValue.Replace(@"[XB3]", "\xB3");
|
||||
sel.Text = roValue;
|
||||
// look for toggling of '_' to turn underlining on/off:
|
||||
AddPrecedingText(sel, roValue); // parse underlining
|
||||
AddPrecedingText(sel, roValue, indent); // parse underlining
|
||||
sel.Font.Color = LBWdColor.wdColorRed;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user