Update DTS for Grid and Content after exiting grid.
Changed property MyItemInfo to method GetMyItemInfo so that it is not saved to XML. Use new vlnFlexGrid method GetMyItemInfo.
This commit is contained in:
parent
55eafe8115
commit
27cfd702fb
@ -530,7 +530,12 @@ namespace Volian.Controls.Library
|
|||||||
string xml = MyFlexGrid.GetXMLData();
|
string xml = MyFlexGrid.GetXMLData();
|
||||||
using (Item itm = MyItemInfo.Get())
|
using (Item itm = MyItemInfo.Get())
|
||||||
{
|
{
|
||||||
|
//if (!MatchingXML(itm.MyContent.MyGrid.Data, xml))
|
||||||
|
//{
|
||||||
|
// CompareXML(itm.MyContent.MyGrid.Data, xml);
|
||||||
itm.MyContent.MyGrid.Data = xml;
|
itm.MyContent.MyGrid.Data = xml;
|
||||||
|
itm.MyContent.MyGrid.DTS = DateTime.Now;
|
||||||
|
//}
|
||||||
// if this is the initial save of an ro table, then the 'DoLinkForRoTable' will
|
// if this is the initial save of an ro table, then the 'DoLinkForRoTable' will
|
||||||
// create the usage for it. this code gets run on modify of the ro table and also
|
// create the usage for it. this code gets run on modify of the ro table and also
|
||||||
// on exit of the griditem. We don't want to save the ro usage again, if it's already
|
// on exit of the griditem. We don't want to save the ro usage again, if it's already
|
||||||
@ -538,7 +543,11 @@ namespace Volian.Controls.Library
|
|||||||
if (MyFlexGrid.IsRoTable && MyFlexGrid.ROID != null && itm.MyContent.ContentRoUsageCount < 1)
|
if (MyFlexGrid.IsRoTable && MyFlexGrid.ROID != null && itm.MyContent.ContentRoUsageCount < 1)
|
||||||
{
|
{
|
||||||
searchableText = string.Format(@"\v<START]\v0 {0} \v {1}[END>\v0 ", searchableText, DoLinkForRoTable());
|
searchableText = string.Format(@"\v<START]\v0 {0} \v {1}[END>\v0 ", searchableText, DoLinkForRoTable());
|
||||||
|
//if (itm.MyContent.Text != searchableText)
|
||||||
|
//{
|
||||||
itm.MyContent.Text = searchableText;
|
itm.MyContent.Text = searchableText;
|
||||||
|
itm.MyContent.DTS = DateTime.Now;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
if (!MyFlexGrid.IsRoTable)itm.MyContent.Text = searchableText;
|
if (!MyFlexGrid.IsRoTable)itm.MyContent.Text = searchableText;
|
||||||
itm.Save();
|
itm.Save();
|
||||||
@ -546,6 +555,55 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
private void CompareXML(string v1, string v2)
|
||||||
|
{
|
||||||
|
v1 = Regex.Replace(v1, "\r\n *", "");
|
||||||
|
v1 = Regex.Replace(v1, "version *= *\"[^\"]*\"", "");
|
||||||
|
v2 = Regex.Replace(v2, "\r\n *", "");
|
||||||
|
v2 = Regex.Replace(v2, "version *= *\"[^\"]*\"", "");
|
||||||
|
int iStart = 0;
|
||||||
|
int l1 = v1.Length;
|
||||||
|
int l2 = v2.Length;
|
||||||
|
int l3 = Math.Min(l1, l2);
|
||||||
|
while (iStart < l3 && v1[iStart] == v2[iStart])
|
||||||
|
iStart++;
|
||||||
|
int iEnd1 = l1 - 1;
|
||||||
|
int iEnd2 = l2 - 1;
|
||||||
|
while (iStart < iEnd1 && iStart < iEnd2 && v1[iEnd1] == v2[iEnd2])
|
||||||
|
{
|
||||||
|
iEnd1--;
|
||||||
|
iEnd2--;
|
||||||
|
}
|
||||||
|
if (iStart < iEnd1) Console.WriteLine("v1 = {0}", v1.Substring(iStart, iEnd1 - iStart));
|
||||||
|
if (iStart < iEnd2) Console.WriteLine("v2 = {0}", v2.Substring(iStart, iEnd2 - iStart));
|
||||||
|
|
||||||
|
}
|
||||||
|
private bool MatchingXML(string v1, string v2)
|
||||||
|
{
|
||||||
|
v1 = Regex.Replace(v1, "\r\n *", "");
|
||||||
|
v1 = Regex.Replace(v1, "version *= *\"[^\"]*\"", "");
|
||||||
|
v2 = Regex.Replace(v2, "\r\n *", "");
|
||||||
|
v2 = Regex.Replace(v2, "version *= *\"[^\"]*\"", "");
|
||||||
|
int l1 = v1.Length;
|
||||||
|
int l2 = v2.Length;
|
||||||
|
if(l1 != l2 )return false;
|
||||||
|
//int l3 = Math.Min(l1, l2);
|
||||||
|
//int l4 = Math.Max(l1, l2);
|
||||||
|
for (int i = 0; i < l1; i++)
|
||||||
|
if (v1[i] != v2[i]) return false;
|
||||||
|
return true;
|
||||||
|
//Console.WriteLine("{0} - {1},{2}",i, showChar(v1[i]), showChar(v2[i]));
|
||||||
|
//if(l1 > l3)Console.WriteLine("v1 = {0}",v1.Substring(l3));
|
||||||
|
//if(l2 > l3)Console.WriteLine("v2 = {0}",v2.Substring(l3));
|
||||||
|
}
|
||||||
|
//private object showChar(char c)
|
||||||
|
//{
|
||||||
|
// int i = (int)c;
|
||||||
|
// if (i <= 32)
|
||||||
|
// return string.Format("<{0}>", i);
|
||||||
|
// else
|
||||||
|
// return c.ToString();
|
||||||
|
//}
|
||||||
public void BasicSave()
|
public void BasicSave()
|
||||||
{
|
{
|
||||||
using (Item itm = MyItemInfo.Get())
|
using (Item itm = MyItemInfo.Get())
|
||||||
|
@ -91,11 +91,15 @@ namespace Volian.Controls.Library
|
|||||||
set { _MyBorders = value; }
|
set { _MyBorders = value; }
|
||||||
}
|
}
|
||||||
private ItemInfo _MyItemInfo;
|
private ItemInfo _MyItemInfo;
|
||||||
public ItemInfo MyItemInfo
|
public ItemInfo GetMyItemInfo()
|
||||||
{
|
{
|
||||||
get { return _MyItemInfo; }
|
return _MyItemInfo;
|
||||||
set { _MyItemInfo = value; }
|
|
||||||
}
|
}
|
||||||
|
//public ItemInfo MyItemInfo
|
||||||
|
//{
|
||||||
|
// get { return _MyItemInfo; }
|
||||||
|
// set { _MyItemInfo = value; }
|
||||||
|
//}
|
||||||
public void SetBorders(CellRange myRange,
|
public void SetBorders(CellRange myRange,
|
||||||
GridLinePattern top, GridLinePattern middle, GridLinePattern bottom,
|
GridLinePattern top, GridLinePattern middle, GridLinePattern bottom,
|
||||||
GridLinePattern left, GridLinePattern center, GridLinePattern right)
|
GridLinePattern left, GridLinePattern center, GridLinePattern right)
|
||||||
@ -535,9 +539,9 @@ namespace Volian.Controls.Library
|
|||||||
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!VESymbFix)(?!Arial Unicode MS))([^;]*)|(!!!!))(;})");
|
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!VESymbFix)(?!Arial Unicode MS))([^;]*)|(!!!!))(;})");
|
||||||
public void LoadGrid(ItemInfo itemInfo)
|
public void LoadGrid(ItemInfo itemInfo)
|
||||||
{
|
{
|
||||||
MyItemInfo = itemInfo;
|
_MyItemInfo = itemInfo;
|
||||||
string str = itemInfo.MyContent.MyGrid.Data;
|
string str = itemInfo.MyContent.MyGrid.Data;
|
||||||
VE_Font vefont = MyItemInfo.GetItemFont();
|
VE_Font vefont = _MyItemInfo.GetItemFont();
|
||||||
FontFamily ff = StepRTB.MyFontFamily ?? vefont.WindowsFont.FontFamily; // TODO: Does not change fixed font.
|
FontFamily ff = StepRTB.MyFontFamily ?? vefont.WindowsFont.FontFamily; // TODO: Does not change fixed font.
|
||||||
if (StepRTB.MySymbolFontName != "VESymbFix")
|
if (StepRTB.MySymbolFontName != "VESymbFix")
|
||||||
str = _ReplaceVESymbFix.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
|
str = _ReplaceVESymbFix.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
|
||||||
@ -573,7 +577,6 @@ namespace Volian.Controls.Library
|
|||||||
_ReadingXml = false;
|
_ReadingXml = false;
|
||||||
Select(-1, -1); // this keeps the cell from being selected when the grid is first displayed
|
Select(-1, -1); // this keeps the cell from being selected when the grid is first displayed
|
||||||
Visible = true;
|
Visible = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid()
|
private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid()
|
||||||
{
|
{
|
||||||
@ -1533,7 +1536,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int TotalColWidths()
|
private int TotalColWidths()
|
||||||
{
|
{
|
||||||
int cwid = 0;
|
int cwid = 0;
|
||||||
@ -1565,7 +1567,6 @@ namespace Volian.Controls.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void AdjustCellHeightWidth(int r, int c)
|
//private void AdjustCellHeightWidth(int r, int c)
|
||||||
//{
|
//{
|
||||||
// StepRTB trtb = new StepRTB();
|
// StepRTB trtb = new StepRTB();
|
||||||
@ -3070,7 +3071,7 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
public void ConvertTableROToGrid(string valtext, int rodbid, string roid)
|
public void ConvertTableROToGrid(string valtext, int rodbid, string roid)
|
||||||
{
|
{
|
||||||
VE_Font vefont = MyItemInfo.GetItemFont();
|
VE_Font vefont = _MyItemInfo.GetItemFont();
|
||||||
this.Font = vefont.WindowsFont;
|
this.Font = vefont.WindowsFont;
|
||||||
this.MergedRanges.Clear();
|
this.MergedRanges.Clear();
|
||||||
this.Clear();
|
this.Clear();
|
||||||
|
@ -181,7 +181,7 @@ namespace Volian.Print.Library
|
|||||||
float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
|
float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
|
||||||
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1];
|
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1];
|
||||||
string str = MyFlexGrid.GetCellRTFString(r, c) ?? string.Empty;
|
string str = MyFlexGrid.GetCellRTFString(r, c) ?? string.Empty;
|
||||||
DisplayText dt = new DisplayText(MyFlexGrid.MyItemInfo, str, false);
|
DisplayText dt = new DisplayText(MyFlexGrid.GetMyItemInfo(), str, false);
|
||||||
str = dt.StartText;
|
str = dt.StartText;
|
||||||
using (StepRTB myRTB = new StepRTB())
|
using (StepRTB myRTB = new StepRTB())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user