예제 #1
0
        private TGroup CreateGroup(XmlNode group)
        {
            var g = new TGroup();

            if (group.Attributes["text"] != null)
            {
                g.Text = group.Attributes["text"].Value;
            }

            foreach (XmlNode row in group.SelectNodes("./row"))
            {
                var r = new TRow();
                foreach (XmlNode field in row.SelectNodes("./field"))
                {
                    r.Fields.Add(TField.FromXmlNode(field));
                }
                g.Rows.Add(r);
            }
            return(g);
        }
예제 #2
0
        private void ClearBlankRowsFromGroup(TGroup group)
        {
            if (group == null || group.Rows.Count == 0)
            {
                return;
            }

            var list = new List <int>();

            for (int i = 0; i < group.Rows.Count; i++)
            {
                var r = group.Rows[i];
                if (r.Cols.Count == 0 || r.Cols.Where(c => string.IsNullOrEmpty(c.Id)).Count() == r.Cols.Count)
                {
                    list.Add(i);
                }
            }

            foreach (var i in list)
            {
                group.Rows.RemoveAt(i);
            }
        }