private void ApplyStyle(SLDocument document, DocumentModel.Cell cell, int rowCounter, int cellCounter) { if (cell.Style == null) { return; } SLStyle style = document.CreateStyle(); this.ApplyStyle(style, cell.Style); document.SetCellStyle(rowCounter, cellCounter, style); }
private void RenderCell(SLDocument document, DocumentModel.Cell cell, int rowCounter, int cellCounter) { if (cell.Value == null) { return; } if (cell.Type == ReportModel.CellType.Formula) { document.SetCellValue(rowCounter, cellCounter, $"={cell.Value.ToString()}"); return; } switch (Type.GetTypeCode(cell.Value.GetType())) { case TypeCode.Boolean: document.SetCellValue(rowCounter, cellCounter, Convert.ToBoolean(cell.Value)); break; case TypeCode.SByte: case TypeCode.Byte: case TypeCode.Int16: case TypeCode.UInt16: case TypeCode.Int32: case TypeCode.UInt32: case TypeCode.Int64: case TypeCode.UInt64: case TypeCode.Single: case TypeCode.Double: case TypeCode.Decimal: document.SetCellValue(rowCounter, cellCounter, Convert.ToDouble(cell.Value)); break; case TypeCode.DateTime: document.SetCellValue(rowCounter, cellCounter, Convert.ToDateTime(cell.Value)); break; case TypeCode.Empty: case TypeCode.Object: case TypeCode.String: case TypeCode.DBNull: case TypeCode.Char: default: document.SetCellValue(rowCounter, cellCounter, cell.Value.ToString()); break; } }