Example #1
0
        List <Cell> GetCells(XMLNodeList rowElement, SharedStrings sharedStrings)
        {
            List <Cell> cellList = new List <Cell>();

            foreach (XMLNode cellElement in rowElement)
            {
                Cell cell = new Cell(cellElement, sharedStrings);
                if (!string.IsNullOrEmpty(cell.Value))
                {
                    string valueTrim = cell.Value.Trim();
                    if (!string.IsNullOrEmpty(valueTrim))
                    {
                        cellList.Add(cell);
                        if (cell.ColumnIndex < m_ColumnStart)
                        {
                            m_ColumnStart = cell.ColumnIndex;
                        }
                        else if (cell.ColumnIndex > m_ColumnEnd)
                        {
                            m_ColumnEnd = cell.ColumnIndex;
                        }
                    }
                }
            }
            return(cellList);
        }
Example #2
0
        /// <summary>
        /// Create a new Cell
        /// </summary>
        /// <param name="cellElement">Cell</param>
        /// <param name="sharedStrings">The collection of shared strings used by this document</param>
        internal Cell(XMLNode cellElement, SharedStrings sharedStrings)
        {
            bool   iShareString = cellElement.GetValue("@t") == "s";
            string columnName   = cellElement.GetValue("@r");

            this.ColumnIndex = GetExcelColumnNumber(columnName);
            this.Value       = cellElement.GetValue("v>0>_text");
            if (this.Value != null && iShareString)
            {
                this.Value = sharedStrings.GetString(this.Value);
            }
        }
Example #3
0
        internal Row(XMLNode rowElement, SharedStrings sharedStrings)
        {
            m_ColumnStart = 1;
            try
            {
                this.RowIndex = int.Parse(rowElement.GetValue("@r"));
            }
            catch (Exception ex)
            {
                throw new Exception("Row Number not found", ex);
            }
            XMLNodeList cellList = rowElement.GetDeepNodeList("c");

            this.Cells = new List <Cell>();
            if (cellList != null && cellList.Count > 0)
            {
                this.Cells = GetCells(cellList, sharedStrings);
            }
        }