C2018-017 Put description of all know symbol characters in the baseline meta file
C2018-018 Put the contents of the Word sections in the baseline meta file
This commit is contained in:
@@ -2376,5 +2376,302 @@ namespace VEPROMS.CSLA.Library
|
||||
_MyWord = myWord;
|
||||
}
|
||||
}
|
||||
|
||||
public class TextForBaseline
|
||||
{
|
||||
// put the symbol description in the baseline metafile output
|
||||
public static string MetaSymbolText(string str)
|
||||
{
|
||||
string rtnVal = str;
|
||||
FormatData fmtdata = FormatInfo.PROMSBaseFormat.FormatData;
|
||||
if (fmtdata != null && fmtdata.SymbolList != null)
|
||||
{
|
||||
SymbolList sl = fmtdata.SymbolList;
|
||||
if (sl != null)
|
||||
{
|
||||
foreach (Symbol sym in sl)
|
||||
rtnVal = rtnVal.Replace(((char)sym.Unicode).ToString(), string.Format("[{0}]", sym.Desc)); //C2018-017 output symbol description from fromat file
|
||||
}
|
||||
}
|
||||
return rtnVal;
|
||||
}
|
||||
public static string FixText(string str) // C2018-004 create meta file for baseline compares
|
||||
{
|
||||
return FixText(str, false);
|
||||
}
|
||||
public static string FixText(string str, bool doingWordDoc) // C2018-004 create meta file for baseline compares
|
||||
{
|
||||
// put a description of know symbols and ascii commands inbetween square brackets
|
||||
if (str == null) return null;
|
||||
str = MetaSymbolText(str); // C2018-017 replace know symbol character with text description
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (char c in str)
|
||||
{
|
||||
if (c < '\x1F' || c > '\x7F')
|
||||
{
|
||||
int i = (int)c;
|
||||
switch (i)
|
||||
{
|
||||
case '\u0005':
|
||||
sb.Append("[HngInd]"); // Hanging Indent char (for 16-bit) also used in MS Word tables for cell borders
|
||||
break;
|
||||
case '\u000A':
|
||||
sb.Append("[LF]"); // line feed
|
||||
break;
|
||||
case '\u00A0':
|
||||
sb.Append("[HS]"); // hard space
|
||||
break;
|
||||
case '\u2011':
|
||||
sb.Append("[NBDash]"); // non-breaking dash
|
||||
break;
|
||||
case '\u000D':
|
||||
sb.Append("[CR]"); // carriage return
|
||||
break;
|
||||
case '\uF0C9':
|
||||
sb.Append("[dbxULC]"); // upper left cornner double line box
|
||||
break;
|
||||
case '\uF0BB':
|
||||
sb.Append("[dbxURC]"); //upper right cornner double line box
|
||||
break;
|
||||
case '\uF0C8':
|
||||
sb.Append("[dbxLLC]"); // lower left cornner double line box
|
||||
break;
|
||||
case '\uF0BC':
|
||||
sb.Append("[dbxLRC]"); // lower right cornner double line box
|
||||
break;
|
||||
case '\uF0CD':
|
||||
sb.Append("[dbxHZ]"); // horz double line box
|
||||
break;
|
||||
case '\uF0BA':
|
||||
sb.Append("[dbxVT]"); // vertial double line box
|
||||
break;
|
||||
case '\uF0CC':
|
||||
sb.Append("[dbxLM]"); // Left Midddle double line box
|
||||
break;
|
||||
case '\uF0B9':
|
||||
sb.Append("[dbxRM]"); // right Midddle double line box
|
||||
break;
|
||||
case '\uF0CB':
|
||||
sb.Append("[dbxDM]"); // down Midddle double line box
|
||||
break;
|
||||
case '\uF0CA':
|
||||
sb.Append("[dbxUM]"); // up Midddle double line box
|
||||
break;
|
||||
case '\uF0CE':
|
||||
sb.Append("[dbxMI]"); // Midddle intersection double line box
|
||||
break;
|
||||
case '\uF0D7':
|
||||
sb.Append("[bxMIVDL]"); // Midddle intersection Single line box Vertial double line
|
||||
break;
|
||||
case '\uF0D8':
|
||||
sb.Append("[dbxMIVSL]"); // Midddle intersection double line box Vertial Single line
|
||||
break;
|
||||
case '\uF0D1':
|
||||
sb.Append("[dbxSLD]"); //double line to single line down
|
||||
break;
|
||||
case '\uF0CF':
|
||||
sb.Append("[dbxSLU]"); //double line to single line Up
|
||||
break;
|
||||
case '\uF0C7':
|
||||
sb.Append("[dbxSL]"); //double line to single line left
|
||||
break;
|
||||
case '\uF0B6':
|
||||
sb.Append("[dbxSR]"); //double line to single line right
|
||||
break;
|
||||
case '\uF0D2':
|
||||
sb.Append("[bxDLD]"); //single line to double line down
|
||||
break;
|
||||
case '\uF0D0':
|
||||
sb.Append("[bxDLU]"); //single line to double line up
|
||||
break;
|
||||
case '\uF0DA':
|
||||
case '\u250C':
|
||||
sb.Append("[bxULC]"); //upper left cornner single line box
|
||||
break;
|
||||
case '\uF0BF':
|
||||
case '\u2510':
|
||||
sb.Append("[bxURC]"); //upper right cornner single line box
|
||||
break;
|
||||
case '\uF0C0':
|
||||
case '\u2514':
|
||||
sb.Append("[bxLLC]"); //lower left cornner single line box
|
||||
break;
|
||||
case '\uF0D9':
|
||||
case '\u2518':
|
||||
sb.Append("[bxLRC]"); //lower right cornner single line box
|
||||
break;
|
||||
case '\uF0C4':
|
||||
case '\u2500':
|
||||
sb.Append("[bxHZ]"); // horz single line box
|
||||
break;
|
||||
case '\uF0B3':
|
||||
sb.Append("[bxVT]"); // Vertial single line box
|
||||
break;
|
||||
case '\uF0C5':
|
||||
case '\u253C':
|
||||
sb.Append("[bxMI]"); // middle intersection single line box
|
||||
break;
|
||||
case '\uF0B4':
|
||||
case '\u2524':
|
||||
sb.Append("[bxMR]"); // middle right single line box
|
||||
break;
|
||||
case '\uF0C3':
|
||||
case '\u251C':
|
||||
sb.Append("[bxML]"); // middle left single line box
|
||||
break;
|
||||
case '\uF0B5':
|
||||
sb.Append("[bxMDLL]"); // middle single line box double line left
|
||||
break;
|
||||
case '\uF0C2':
|
||||
case '\u252C':
|
||||
sb.Append("[bxMD]"); // middle down single line box
|
||||
break;
|
||||
case '\uF0C1':
|
||||
case '\u2534':
|
||||
sb.Append("[bxMU]"); // middle up single line box
|
||||
break;
|
||||
case '\uF0DC':
|
||||
sb.Append("[thbxtop]"); // top thick line box
|
||||
break;
|
||||
case '\uF0DB':
|
||||
sb.Append("[thbxSide]"); // Side thick line box
|
||||
break;
|
||||
case '\uF0DF':
|
||||
sb.Append("[thbxBtm]"); // Bottom thick line box
|
||||
break;
|
||||
case '\uF0DD':
|
||||
sb.Append("[thbxLfSide]"); // Left Side thick line box
|
||||
break;
|
||||
case '\uF0DE':
|
||||
sb.Append("[thbxRtSide]"); // Right Side thick line box
|
||||
break;
|
||||
case '\uF020':
|
||||
case '\u2002':
|
||||
case '\u2003':
|
||||
sb.Append("[{SP}]"); // unicode space
|
||||
break;
|
||||
case '\u2010':
|
||||
case '\u2012':
|
||||
case '\u2013':
|
||||
case '\u2014':
|
||||
case '\u001E':
|
||||
case '\u25AA':
|
||||
sb.Append("[{Dash}]"); // dash
|
||||
break;
|
||||
case '\u201C':
|
||||
case '\u001C':
|
||||
sb.Append("[{BgDblQt}]"); // begin double quote
|
||||
break;
|
||||
case '\u201D':
|
||||
case '\u001D':
|
||||
case '\u2033':
|
||||
sb.Append("[{EnDblQt}]"); // end double quote
|
||||
break;
|
||||
case '\u2018':
|
||||
sb.Append("[{fwdQuote}]"); // forward quote (single quote)
|
||||
break;
|
||||
case '\u2019':
|
||||
case '\u2032':
|
||||
sb.Append("[{bckQuote}]"); // back quote (single quote)
|
||||
break;
|
||||
case '\u2022':
|
||||
//case '\uF06C':
|
||||
sb.Append("[{bullet}]"); // bullet not in PROMS symbol list
|
||||
break;
|
||||
case '\u00B7':
|
||||
//case '\uF06C':
|
||||
sb.Append("[{SqrBullet}]"); // square bullet not in PROMS symbol list
|
||||
break;
|
||||
case '\uF0B7':
|
||||
case '\uF0A3':
|
||||
sb.Append("[{ChkBox}]"); // check box not in PROMS symbol list
|
||||
break;
|
||||
case '\u00B5':
|
||||
sb.Append("[{Micro}]"); // micro not in PROMS symbol list
|
||||
break;
|
||||
case '\u00B3':
|
||||
sb.Append("[{Cubed}]"); // cubed char (supper script 3) not in PROMS symbol list
|
||||
break;
|
||||
case '\u2206':
|
||||
sb.Append("[{Delta}]"); // Delta not in PROMS symbol list
|
||||
break;
|
||||
case '\u00BE':
|
||||
sb.Append("[{3/4}]"); // 3/4 char not in PROMS symbol list
|
||||
break;
|
||||
case '\u2070':
|
||||
case '\u00BA':
|
||||
case '\u030A':
|
||||
case '\u02DA':
|
||||
case '\uF0B0':
|
||||
sb.Append("[{Degree}]"); // degree char not in PROMS symbol list
|
||||
break;
|
||||
case '\uF0A8':
|
||||
sb.Append("[{Diamond}]"); // Diamond char not in PROMS symbol list
|
||||
break;
|
||||
case '\u0018':
|
||||
sb.Append("[{UpArrow}]"); // Up Arrow char not in PROMS symbol list
|
||||
break;
|
||||
case '\u01C0':
|
||||
sb.Append("[{VtBar}]"); // Vertical bar char not in PROMS symbol list
|
||||
break;
|
||||
case '\u2026':
|
||||
sb.Append("[{...}]"); // 3 dots (etc) char not in PROMS symbol list
|
||||
break;
|
||||
case '\u02C3':
|
||||
sb.Append("[{>}]"); // greater than char not in PROMS symbol list
|
||||
break;
|
||||
case '\u00D7':
|
||||
sb.Append("[{x}]"); // times char not in PROMS symbol list
|
||||
break;
|
||||
case '\u2298':
|
||||
sb.Append("[{CirWthVLn}]"); // Cirlce with VLine char not in PROMS symbol list
|
||||
break;
|
||||
default:
|
||||
bool hanledWrdChar = false;
|
||||
if (doingWordDoc) // These characters are valid only in Word documents
|
||||
{
|
||||
hanledWrdChar = true;
|
||||
switch (i)
|
||||
{
|
||||
case '\u0001':
|
||||
sb.Append("[WordImage]"); // embedded image in Word document
|
||||
break;
|
||||
case '\u0002':
|
||||
sb.Append("[WordFtNtChar]"); // Foot Note in Word document
|
||||
break;
|
||||
case '\u0015':
|
||||
sb.Append("[WordBltLstChar]"); // Bullet List in Word document
|
||||
break;
|
||||
case '\u000B':
|
||||
sb.Append("[VT]"); // vertical tab (used to center text in Word tables)
|
||||
break;
|
||||
case '\u000C':
|
||||
sb.Append("[PgBrk]"); // new page (form feed)
|
||||
break;
|
||||
case '\u0009':
|
||||
sb.Append("[TAB]"); // tab
|
||||
break;
|
||||
case '\u0007':
|
||||
sb.Append("[Bell]"); // bell but used in MS Word tables for cell borders
|
||||
break;
|
||||
default:
|
||||
hanledWrdChar = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hanledWrdChar)
|
||||
{
|
||||
if (c > '\uF01F' && c < '\uF07F')
|
||||
sb.Append(string.Format("[{{{0}}}]", Convert.ToChar(((int)c & '\xFF')))); // usually normal text but was using the Volian Line Draw font
|
||||
else
|
||||
sb.Append(string.Format("[[{0:X}]]", (int)c));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
sb.Append(c);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user