private void setCellValue(object value) { string text = Convert.ToString(value, CultureInfo.InvariantCulture); if (String.IsNullOrEmpty(text)) { return; } if (value is string) { int index = row.sheet.document.InsertSharedStringItem(text); cell.CellValue = new CellValue(index.ToString()); cell.DataType = new EnumValue <CellValues>(CellValues.SharedString); } else if (ExcelCell.IsNumericType(value.GetType())) { cell.CellValue = new CellValue(text); cell.DataType = new EnumValue <CellValues>(CellValues.Number); } else { cell.CellValue = new CellValue(text); cell.DataType = new EnumValue <CellValues>(CellValues.String); } }
public ExcelCell this[string address] { get { return(_rows[ExcelCell.GetRowIndex(address)].Cells[ExcelCell.GetColumnName(address)]); } }
public ExcelCell GetCell(uint index) { if (index < 1) { throw new ArgumentException("Index column cannot be less than 1!"); } if (this.List.ContainsKey(index)) { return(this.List[index]); } string address = ExcelCell.ConvertToLetter(index) + row.index.ToString(); Cell newCell = new Cell() { CellReference = address }; ExcelCell nextCell = this.List.FirstOrDefault(p => p.Key > index).Value; if (nextCell != null) { row.row.InsertBefore(newCell, nextCell.cell); } else { row.row.Append(newCell); } ExcelCell retVal = new ExcelCell(newCell, row); this.List.Add(retVal.Index, retVal); return(retVal); }
public ExcelCellCollection(ExcelRow row) { this.row = row; this.List = new SortedDictionary <uint, ExcelCell>(); foreach (Cell cell in row.row.Elements <Cell>()) { ExcelCell newCell = new ExcelCell(cell, row); this.List.Add(newCell.Index, newCell); } }
public ExcelCell this[string name] { get { uint index = ExcelCell.GetColumnIndex(name); if (index < 1) { throw new ArgumentException("Index column cannot be less than 1!"); } if (this.List.ContainsKey(index)) { return(this.List[index]); } return(GetCell(index)); } }
public ExcelCell GetCell(uint index) { if (index < 1) throw new ArgumentException("Index column cannot be less than 1!"); if (this.List.ContainsKey(index)) return this.List[index]; string address = ExcelCell.ConvertToLetter(index) + row.index.ToString(); Cell newCell = new Cell() { CellReference = address }; ExcelCell nextCell = this.List.FirstOrDefault(p => p.Key > index).Value; if (nextCell != null) row.row.InsertBefore(newCell, nextCell.cell); else row.row.Append(newCell); ExcelCell retVal = new ExcelCell(newCell, row); this.List.Add(retVal.Index, retVal); return retVal; }
public ExcelCellCollection(ExcelRow row) { this.row = row; this.List = new SortedDictionary<uint, ExcelCell>(); foreach (Cell cell in row.row.Elements<Cell>()) { ExcelCell newCell = new ExcelCell(cell, row); this.List.Add(newCell.Index, newCell); } }
public void Remove(string colName) { Remove(ExcelCell.GetColumnIndex(colName)); }
public bool Contains(string colName) { return(this.List.ContainsKey(ExcelCell.GetColumnIndex(colName))); }
public void RemoveCell(string address) { RemoveCell(ExcelCell.GetRowIndex(address), ExcelCell.GetColumnIndex(ExcelCell.GetColumnName(address))); }