using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace ExcelZipLib
{
   [Serializable()]
   [XmlType(Namespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main")]
   [XmlRoot("worksheet", Namespace = "http://schemas.openxmlformats.org/spreadsheetml/2006/main")]
   public class worksheet
   {
      /// <summary>
      /// The rows
      /// </summary>
      [XmlArray("sheetData")]
      [XmlArrayItem("row")]
      [NonSerialized]
      public List<Row> Rows;

      /// <summary>
      /// The number of columns
      /// </summary>
      [XmlIgnore]
      public int NumberOfColumns; // Total number of columns in this worksheet

      /// <summary>
      /// The maximum column index
      /// </summary>
      public static int MaxColumnIndex = 0; // Temporary variable for import

      /// <summary>
      /// Initializes a new instance of the <see cref="worksheet"/> class.
      /// </summary>
      public worksheet()
      {
      }

      /// <summary>
      /// Expands the rows.
      /// </summary>
      public void ExpandRows()
      {
         foreach (var row in Rows)
            row.ExpandCells(NumberOfColumns);
      }
   }
}