Exemple #1
0
        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);
            }
        }