Example #1
0
 public TableCell this[string columnName]
 {
     get
     {
         TableColumn tc = Parent
                          .TableColumns()
                          .Where(x => x.Name.ToLower() == columnName.ToLower())
                          .FirstOrDefault();
         if (tc == null)
         {
             throw new Exception("Invalid column name: " + columnName);
         }
         string[] refs          = Parent.Ref.Split(':');
         string[] startRefs     = XlsxTables.SplitAddress(refs[0]);
         string   columnAddress = XlsxTables.IndexToColumnAddress(XlsxTables.ColumnAddressToIndex(startRefs[0]) + tc.ColumnIndex);
         Cell     cell          = Row.Cells().Where(c => c.ColumnAddress == columnAddress).FirstOrDefault();
         if (cell != null)
         {
             if (cell.Type == "s")
             {
                 return(new TableCell(cell.SharedString));
             }
             else
             {
                 return(new TableCell(cell.Value));
             }
         }
         else
         {
             return(new TableCell(""));
         }
     }
 }