public void Save()
        {
            // if there are no columns remove tag "cols"
            if (columns.Count == 0)
            {
                data.Remove();
                return;
            }

            // clear existing columns
            data.RemoveNodes();

            // recalculate columns range
            ColumnRange lastRange  = null;
            Column      lastColumn = null;

            foreach (var column in columns)
            {
                if (lastRange == null || !AreEqual(lastColumn, column))
                {
                    lastRange  = column.ToRange(data.Add("col"));
                    lastColumn = column;
                }
                else
                {
                    lastRange.Max = column.Index + 1;
                }
            }
        }
 private void ReadColumns()
 {
     foreach (var columnData in data.Descendants("col"))
     {
         ColumnRange range = new ColumnRange(columnData);
         for (long i = range.Min - 1; i < range.Max; ++i)
         {
             Column column = new Column(ColumnUtil.GetColumnName(i), i, range.Width, range.Style, this);
             columns.Add(column);
         }
     }
 }