Example #1
0
        public ExcelValue this[BaseAZ column, int line]
        {
            get
            {
                var cell = SpreadsheetHelper.GetCell(Owner.OpenXmlSheetData, column, (uint)line, createIfDoesntExists: false);

                var value = SpreadsheetHelper.GetValue(Owner.Owner.OpenXmlDocument, Owner.OpenXmlSheetData, cell);

                return(new ExcelValue(value, cell?.DataType?.Value));
            }
            set
            {
                if (value == null || value.IsEmpty)
                {
                    var cell = SpreadsheetHelper.GetCell(Owner.OpenXmlSheetData, column, (uint)line, createIfDoesntExists: false);

                    cell?.Remove();
                }
                else
                {
                    Owner.Consolidate();

                    SpreadsheetHelper.SetValue(Owner.Owner.OpenXmlDocument, null, value.ToString(), value.ValueType, Owner.OpenXmlSheetData, column, (uint)line);
                }
            }
        }
Example #2
0
        public uint?this[BaseAZ column, int line]
        {
            get
            {
                var cell = SpreadsheetHelper.GetCell(Owner.OpenXmlSheetData, column, (uint)line, createIfDoesntExists: false);

                return(cell.StyleIndex);
            }
            set
            {
                Owner.Consolidate();

                var cell = SpreadsheetHelper.GetCell(Owner.OpenXmlSheetData, column, (uint)line, createIfDoesntExists: true);

                if (cell.CellValue == null)
                {
                    cell.CellValue = new CellValue(null);
                }
                cell.StyleIndex = value;
            }
        }
Example #3
0
 public ExcelValue this[string column, int line]
 {
     get { return(this[BaseAZ.Parse(column), line]); }
     set { this[BaseAZ.Parse(column), line] = value; }
 }