Added underline to the LBFontClass
Added logic to support using underbars to turn underlining on/off – only implemented in X/Y Plot RO’s for now
This commit is contained in:
parent
3dfb222834
commit
262a8c3ad3
@ -583,6 +583,11 @@ namespace LBWordLibrary
|
|||||||
get { return (GetProperty("Name").ToString()); }
|
get { return (GetProperty("Name").ToString()); }
|
||||||
set { SetProperty("Name", value); }
|
set { SetProperty("Name", value); }
|
||||||
}
|
}
|
||||||
|
public LBWdUnderline Underline
|
||||||
|
{
|
||||||
|
get { return (LBWdUnderline)GetProperty("Underline"); }
|
||||||
|
set { SetProperty("Underline", value); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public enum LBWdInformation
|
public enum LBWdInformation
|
||||||
{
|
{
|
||||||
@ -1251,4 +1256,25 @@ namespace LBWordLibrary
|
|||||||
wdRelativeVerticalPositionInnerMarginArea = 6,
|
wdRelativeVerticalPositionInnerMarginArea = 6,
|
||||||
wdRelativeVerticalPositionOuterMarginArea = 7
|
wdRelativeVerticalPositionOuterMarginArea = 7
|
||||||
}
|
}
|
||||||
|
public enum LBWdUnderline
|
||||||
|
{
|
||||||
|
wdUnderlineNone = 0,
|
||||||
|
wdUnderlineSingle = 1,
|
||||||
|
wdUnderlineWords = 2,
|
||||||
|
wdUnderlineDouble = 3,
|
||||||
|
wdUnderlineDotted = 4,
|
||||||
|
wdUnderlineThick = 6,
|
||||||
|
wdUnderlineDash = 7,
|
||||||
|
wdUnderlineDotDash = 9,
|
||||||
|
wdUnderlineDotDotDash = 10,
|
||||||
|
wdUnderlineWavy = 11,
|
||||||
|
wdUnderlineDottedHeavy = 20,
|
||||||
|
wdUnderlineDashHeavy = 23,
|
||||||
|
wdUnderlineDotDashHeavy = 25,
|
||||||
|
wdUnderlineDotDotDashHeavy = 26,
|
||||||
|
wdUnderlineWavyHeavy = 27,
|
||||||
|
wdUnderlineDashLong = 39,
|
||||||
|
wdUnderlineWavyDouble = 43,
|
||||||
|
wdUnderlineDashLongHeavy = 55
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,10 +723,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
val = val.Replace("`", "\xB0");
|
val = val.Replace("`", "\xB0");
|
||||||
//sel.Text = "";
|
|
||||||
// An X/Y Plot RO type might have text preceding the Plot Commands
|
// An X/Y Plot RO type might have text preceding the Plot Commands
|
||||||
int pstart = val.IndexOf("<<G"); // find the starting Plot Command
|
int pstart = val.IndexOf("<<G"); // find the starting Plot Command
|
||||||
sel.Text = val.Substring(0, pstart); // replace the RO token with what's in front of the X/Y Plot
|
AddPrecedingText(sel, val.Substring(0, pstart));// 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
|
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 width = 72 * Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) / 12.0F;
|
||||||
//float height = 72 * lines / 6.0F;
|
//float height = 72 * lines / 6.0F;
|
||||||
@ -800,6 +799,41 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static void AddPrecedingText(LBSelection sel, string val)
|
||||||
|
{
|
||||||
|
if (val.IndexOf("_") == -1) // Is some of the text underlined?
|
||||||
|
{
|
||||||
|
sel.Text = val; // nothing is underlined, use text as is
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 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"))
|
||||||
|
{
|
||||||
|
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
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
sel.Font.Underline = LBWdUnderline.wdUnderlineNone;
|
||||||
|
}
|
||||||
|
|
||||||
public static void AdjustMargins(DocStyle myDocStyle, LBDocumentClass myDoc, bool printingMode)
|
public static void AdjustMargins(DocStyle myDocStyle, LBDocumentClass myDoc, bool printingMode)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user