Added logic to support the indexed list version of ReplaceSymbolChars
This commit is contained in:
parent
dd4c099741
commit
c6608b8370
@ -805,7 +805,7 @@ namespace Volian.Print.Library
|
||||
//</ReplaceSymbolChars-->
|
||||
//
|
||||
// get the list of symbol replacements
|
||||
FormatData fmtdata = (MyFlexGrid.MyDVI != null) ? MyFlexGrid.MyDVI.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
||||
FormatData fmtdata = (MyFlexGrid.GetMyItemInfo().ActiveFormat != null) ? MyFlexGrid.GetMyItemInfo().ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
||||
ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
|
||||
// Look at one character at a time
|
||||
for (int i = 0; i < rtb.TextLength; i++)
|
||||
@ -827,24 +827,31 @@ namespace Volian.Print.Library
|
||||
rtb.SelectionFont = new System.Drawing.Font(DefaultFont, fnt.Style);
|
||||
changed = true;
|
||||
}
|
||||
if (rtb.SelectionFont.FontFamily.Name == "VESymbFix" && rtb.SelectedText.Length > 0)
|
||||
if ((rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name.StartsWith("Arial Unicode")) && rtb.SelectedText.Length > 0)
|
||||
{
|
||||
for (int j=0; j<SymReplaceList.MaxIndex;j++)
|
||||
{
|
||||
foreach (ReplaceChar rc in SymReplaceList)
|
||||
ReplaceChar rc = SymReplaceList[j];
|
||||
if (rc.Unicode != null)
|
||||
{
|
||||
if (rc.Unicode != null)
|
||||
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
||||
if (rc_uchar == rtb.SelectedText[0])
|
||||
{
|
||||
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
||||
if (rc_uchar == rtb.SelectedText[0])
|
||||
//use bolding underline italics from local font
|
||||
System.Drawing.Font fnt = rtb.SelectionFont;
|
||||
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size, (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
|
||||
rtb.SelectionFont = fntw;
|
||||
if (rc.Replace != null)
|
||||
{
|
||||
//use bolding underline italics from local font
|
||||
System.Drawing.Font fnt = rtb.SelectionFont;
|
||||
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null) ? rc.Family : fnt.FontFamily.Name, (rc.Size != null) ? (float)rc.Size : fnt.Size, (rc.Style != null) ? (System.Drawing.FontStyle)rc.Style : fnt.Style);
|
||||
rtb.SelectionFont = fntw;
|
||||
changed = true;
|
||||
char rc_RplChar = Convert.ToChar(Convert.ToInt32(rc.Replace));
|
||||
rtb.SelectedText = rc_RplChar.ToString();
|
||||
}
|
||||
changed = true;
|
||||
break; // break out of foreach loop since we changed the character
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed) return rtb.Rtf.Replace("<dblbs>", @"\u9586?");
|
||||
}
|
||||
|
@ -4332,7 +4332,7 @@ namespace Volian.Print.Library
|
||||
private string FixRTFToPrint(string rtf)
|
||||
{
|
||||
// Only do this if the text contains symbols.
|
||||
if (rtf.Contains("VESymbFix"))
|
||||
if (rtf.Contains("VESymbFix") || rtf.Contains("Arial Unicode"))
|
||||
{
|
||||
System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
|
||||
rtb.Rtf = rtf.Replace(@"\\","<dblbs>"); // rename backslash character to avoid RTF confusion
|
||||
@ -4357,16 +4357,17 @@ namespace Volian.Print.Library
|
||||
//</ReplaceSymbolChars-->
|
||||
//
|
||||
// get the list of symbol replacements
|
||||
FormatData fmtdata = (MyItemInfo.MyDocVersion != null) ? MyItemInfo.MyDocVersion.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
||||
FormatData fmtdata = (MyItemInfo.ActiveFormat != null) ? MyItemInfo.ActiveFormat.PlantFormat.FormatData : FormatInfo.PROMSBaseFormat.FormatData;
|
||||
ReplaceSymbolCharList SymReplaceList = (fmtdata != null && fmtdata.SectData.ReplaceSymbolCharList != null) ? fmtdata.SectData.ReplaceSymbolCharList : null;
|
||||
// Look at one character at a time
|
||||
for (int i = 0; i < rtb.TextLength; i++)
|
||||
{
|
||||
rtb.Select(i, 1);
|
||||
if (rtb.SelectionFont.FontFamily.Name == "VESymbFix" && rtb.SelectedText.Length > 0)
|
||||
if ((rtb.SelectionFont.FontFamily.Name == "VESymbFix" || rtb.SelectionFont.FontFamily.Name.StartsWith("Arial Unicode")) && rtb.SelectedText.Length > 0)
|
||||
{
|
||||
foreach (ReplaceChar rc in SymReplaceList)
|
||||
for (int j=0; j<SymReplaceList.MaxIndex;j++)
|
||||
{
|
||||
ReplaceChar rc = SymReplaceList[j];
|
||||
if (rc.Unicode != null)
|
||||
{
|
||||
char rc_uchar = Convert.ToChar(Convert.ToInt32(rc.Unicode));
|
||||
@ -4376,7 +4377,13 @@ namespace Volian.Print.Library
|
||||
System.Drawing.Font fnt = rtb.SelectionFont;
|
||||
System.Drawing.Font fntw = new System.Drawing.Font((rc.Family != null)?rc.Family:fnt.FontFamily.Name, (rc.Size != null)?(float)rc.Size:fnt.Size, (rc.Style != null)?(System.Drawing.FontStyle)rc.Style:fnt.Style);
|
||||
rtb.SelectionFont = fntw;
|
||||
if (rc.Replace != null)
|
||||
{
|
||||
char rc_RplChar = Convert.ToChar(Convert.ToInt32(rc.Replace));
|
||||
rtb.SelectedText = rc_RplChar.ToString();
|
||||
}
|
||||
changed = true;
|
||||
break; // break out of foreach loop since we changed the character
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user