From 765930867a4694d48769e7631e03d9a012cbddf5 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 30 Sep 2014 16:42:47 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20fix=20B2014-106=20=E2=80=93=20tables=20wi?= =?UTF-8?q?ll=20now=20save=20if=20the=20text=20alignment=20of=20a=20cell?= =?UTF-8?q?=20was=20changed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Controls.Library/VlnFlexGrid.cs | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index dfa0df8c..5b5492d5 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -137,7 +137,11 @@ namespace Volian.Controls.Library //check for cell format changes 4th if (checkFormat && GetCellFormatString(XdNew) != GetCellFormatString(XdOld)) return true; - //check for merged cells 5th + //check for text alignment changes 5th + // put check in for bug fix B2014-106 + if (checkFormat && GetCellTextAlignString(XdNew) != GetCellTextAlignString(XdOld)) + return true; + //check for merged cells 6th if (GetCellMergeString(XdNew) != GetCellMergeString(XdOld)) return true; return false; @@ -262,6 +266,25 @@ namespace Volian.Controls.Library return string.Empty; return xd.SelectSingleNode("C1FlexGrid/MergedRanges").InnerXml; } + private string GetCellTextAlignString(XmlDocument xd) + { + // Note that I could not save (and later compare) the entire Definition string + // because the xml for the old and new table was always different. + // The old xml table data would have, for example "white" for the background color, while + // the new xml table data would have "255,255,255" for the background color. + // Therefore this check is specific for only the TextAlign setting - jsj 9-30-2014 + XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Styles/Style/Definition"); + string data = string.Empty; + foreach (XmlNode xn in nl) + { + string str = xn.InnerText; + string[] splStr = str.Split(';'); + foreach (string s in splStr) + if (s.StartsWith("TextAlign:")) + data += "|" + s; // only save the TextAlign setting + } + return data; + } private static GridCopyInfo _MyCopyInfo; public static GridCopyInfo MyCopyInfo {