This commit is contained in:
@@ -12,6 +12,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using System.Text.RegularExpressions;
|
||||
using Volian.Controls.Library;
|
||||
|
||||
namespace DataLoader
|
||||
{
|
||||
@@ -21,6 +22,8 @@ namespace DataLoader
|
||||
{
|
||||
//if (ProcNumber + "|" + stpseq == "082-002CD|A=S")
|
||||
// Console.WriteLine("here");
|
||||
//if (stpseq == "A;S#")
|
||||
// Console.WriteLine("here");
|
||||
Content content = null;
|
||||
Item item = null;
|
||||
|
||||
@@ -101,7 +104,12 @@ namespace DataLoader
|
||||
stptext = MigrateTrans(cn, stptext, seqcvt, content, pth);
|
||||
stptext = stptext.TrimEnd(" ".ToCharArray());
|
||||
}
|
||||
string fixStpText = FixStepText(stptext);
|
||||
//string fixStpText = FixStepText(stptext,content.Type);
|
||||
string fixStpText = "";
|
||||
if (IsATable(content.Type))
|
||||
fixStpText = ConvertTableToGrid(stptext,content,fmt);
|
||||
else
|
||||
fixStpText = FixStepText(stptext);
|
||||
if (fixStpText != stptext)
|
||||
{
|
||||
txtdirty = true;
|
||||
@@ -297,6 +305,87 @@ namespace DataLoader
|
||||
return stepText;
|
||||
}
|
||||
|
||||
//private Font GridFont = new Font("Courier New", 10);
|
||||
|
||||
//private Regex _RemoveComments = new Regex(@"\\v .*?\\v0 ");
|
||||
private Regex _RemoveComments = new Regex(@"\\v .*?\\v0( |$)");
|
||||
private string ConvertTableToGrid(string stepText, Content content, FormatInfo fmt)
|
||||
{
|
||||
string savethis = stepText;
|
||||
string strGrid = "";
|
||||
VlnFlexGrid grd = new VlnFlexGrid(1, 1);
|
||||
//VE_Font vefont = content.MyFormat.PlantFormat.FormatData.StepDataList.Table.Font;
|
||||
VE_Font vefont = fmt.PlantFormat.FormatData.StepDataList.Table.Font;
|
||||
Font GridFont = new Font(vefont.Family, (float)vefont.Size);
|
||||
grd.Font = GridFont; // this also changes the default Row Height "Rows.DefaultSize"
|
||||
stepText = FixStepText(stepText);
|
||||
stepText = stepText.Replace(@"\u8209?", "-");
|
||||
stepText = stepText.Replace(@"\u9474?", "|");
|
||||
stepText = stepText.Replace(@"\u8805?", "\xf2"); //greater than or equal
|
||||
stepText = stepText.Replace(@"\'b0", "\xB0");
|
||||
stepText = stepText.Replace(@"\up2 ", "\x9566");
|
||||
stepText = stepText.Replace(@"\up0 ", "\x9567");
|
||||
stepText = stepText.Replace(@"\ulnone", "\xBB");
|
||||
stepText = stepText.Replace(@"\ul", "\xAB");
|
||||
stepText = stepText.Replace(@"\{", "{");
|
||||
stepText = stepText.Replace(@"\}", "}");
|
||||
//stepText = stepText.Replace("\\b0", "\x2553");
|
||||
//stepText = stepText.Replace("\\b", "\x2552");
|
||||
stepText = stepText.Replace(@"\b0", "\xD6");
|
||||
stepText = stepText.Replace(@"\b", "\xD5");
|
||||
//stepText = stepText.Replace(@"\u160?", "\xA0"); //hard space
|
||||
stepText = stepText.Replace(@"\u160?", "\xFF"); //hard space xFF is used in 16-bit proms
|
||||
stepText = stepText.Replace(@"\u916?", "\x7F"); // delta
|
||||
//Console.WriteLine("B4 Parse Orig Text: '{0}'", savethis);
|
||||
//Console.WriteLine("B4 Parse sym repl: '{0}'", stepText);
|
||||
grd.ParseTableFromText(_RemoveComments.Replace(stepText, ""));
|
||||
//grd.ParseTableFromText(_RemoveComments.Replace((stepText.Replace(@"\u8209?", "-")).Replace("\\'b0", "\xB0"), ""));
|
||||
//grd.ParseTableFromText(_RemoveComments.Replace((stepText.Replace(@"\u8209?", "-")).Replace("\\par", "\n"), ""));
|
||||
grd.AutoSizeCols();
|
||||
grd.AutoSizeRows();
|
||||
grd.MakeRTFcells();
|
||||
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
grd.WriteXml(sw);
|
||||
Console.WriteLine(sw.GetStringBuilder().ToString());
|
||||
content.MyGrid.Data = sw.GetStringBuilder().ToString();
|
||||
sw.Close();
|
||||
}
|
||||
return strGrid;
|
||||
}
|
||||
//private void FixSymbolsInGridTable(Content content, ItemInfo ii)
|
||||
//{
|
||||
// VlnFlexGrid grd = new VlnFlexGrid(1, 1);
|
||||
// using (TextReader stringreader = new StringReader(content.MyGrid.Data))
|
||||
// {
|
||||
// grd.ReadXml(stringreader);
|
||||
// stringreader.Close();
|
||||
// }
|
||||
// for (int r = 0; r < grd.Rows.Count; r++)
|
||||
// for (int c = 0; c < grd.Cols.Count; c++)
|
||||
// {
|
||||
// StepRTB trtb = new StepRTB();
|
||||
// trtb = grd[r, c];
|
||||
// DisplayText dt = new DisplayText(trtb.Rtf, true);
|
||||
// grd[r, c] = dt.OriginalText;
|
||||
// }
|
||||
//}
|
||||
private bool IsATable(int? contenttype)
|
||||
{
|
||||
bool rtnval = false;
|
||||
switch (contenttype)
|
||||
{
|
||||
case 20008: // Centered table
|
||||
case 20010: // AER table
|
||||
case 20033: // AER table without boarder
|
||||
case 20034: // Centered table without boarder
|
||||
rtnval = true;
|
||||
break;
|
||||
}
|
||||
return rtnval;
|
||||
}
|
||||
|
||||
//private static bool AddContentDetail(Content content, int type, string strn)
|
||||
//{
|
||||
// if (strn != null && strn.Trim() != "" )
|
||||
|
@@ -424,7 +424,8 @@ namespace DataLoader
|
||||
// superscript next is 0x18
|
||||
// subscript next is 0x19
|
||||
// bold next is 0x13
|
||||
s2 = Regex.Replace(s2, @"\x17([^\x17 ]*?)(?:[\x17]|(?= )|\Z)(.*?)", @"\ul $1\ulnone $2");
|
||||
s2 = Regex.Replace(s2, @"\x17([A-Za-z0-9]+)", @"\ul $1\ulnone ");
|
||||
//s2 = Regex.Replace(s2, @"\x17([^\x17 ]*?)(?:[\x17]|(?= )|\Z)(.*?)", @"\ul $1\ulnone $2");
|
||||
//s2 = Regex.Replace(s2, @"\x18([^\x18 ]*?)(?:[\x18]|(?= )|\Z)(.*?)", @"\super $1\nosupersub $2");
|
||||
//s2 = Regex.Replace(s2, @"\x19([^\x19 ]*?)(?:[\x19]|(?= )|\Z)(.*?)", @"\sub $1\nosupersub $2");
|
||||
s2 = Regex.Replace(s2, @"\x18([^\x18 ]*?)(?:[\x18]|(?= )|\Z)(.*?)", @"\up2 $1\up0 $2");
|
||||
|
Reference in New Issue
Block a user