private void RenderCell() { if (this.m_column != -1) { ExcelDataType excelDataType = ExcelDataType.Blank; RichTextInfo richTextInfo = null; if (this.m_cellValue != null) { if (this.m_cellValueType == TypeCode.Object) { richTextInfo = (this.m_cellValue as RichTextInfo); if (richTextInfo != null) { excelDataType = ExcelDataType.RichString; } //else if (this.m_cellValue is SqlGeometry || this.m_cellValue is SqlGeography) //{ // excelDataType = ExcelDataType.String; //} } else { excelDataType = FormatHandler.GetDataType(this.m_cellValueType); } } bool flag = false; switch (excelDataType) { case ExcelDataType.String: { string text = this.m_cellValue.ToString(); if (text.Length > 0) { StringBuilder stringBuilder = new StringBuilder(text.Length); ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(text, stringBuilder, this.m_checkForRotatedEastAsianChars, out flag); this.m_cellValue = stringBuilder.ToString(); } break; } case ExcelDataType.RichString: flag = richTextInfo.FoundRotatedFarEastChar; break; } if (flag) { this.m_styleContainer.Orientation = Orientation.Vertical; } this.m_styleContainer.Finish(); if (this.m_cellValue != null || this.m_styleContainer.CellIxfe != 15) { this.m_rowHandler.Add(this.m_cellValue, richTextInfo, this.m_cellValueType, excelDataType, this.m_cellErrorCode, (short)this.m_column, (ushort)this.m_styleContainer.CellIxfe); } this.m_cellValue = null; this.m_cellValueType = TypeCode.String; this.m_cellErrorCode = ExcelErrorCode.None; this.m_styleContainer.Reset(); this.m_checkForRotatedEastAsianChars = false; } }
private void RenderCell() { if (m_column == -1) { return; } ExcelDataType excelDataType = ExcelDataType.Blank; RichTextInfo richTextInfo = null; if (m_cellValue != null) { if (m_cellValueType == TypeCode.Object) { richTextInfo = (m_cellValue as RichTextInfo); if (richTextInfo != null) { excelDataType = ExcelDataType.RichString; } } else { excelDataType = FormatHandler.GetDataType(m_cellValueType); } } bool foundEastAsianChar = false; switch (excelDataType) { case ExcelDataType.String: { string text = m_cellValue.ToString(); if (text.Length > 0) { StringBuilder stringBuilder = new StringBuilder(text.Length); ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(text, stringBuilder, m_checkForRotatedEastAsianChars, out foundEastAsianChar); m_cellValue = stringBuilder.ToString(); } break; } case ExcelDataType.RichString: foundEastAsianChar = richTextInfo.FoundRotatedFarEastChar; break; } if (foundEastAsianChar) { m_styleContainer.Orientation = Orientation.Vertical; } m_styleContainer.Finish(); if (m_cellValue != null || m_styleContainer.CellIxfe != 15) { m_rowHandler.Add(m_cellValue, richTextInfo, m_cellValueType, excelDataType, m_cellErrorCode, (short)m_column, (ushort)m_styleContainer.CellIxfe); } m_cellValue = null; m_cellValueType = TypeCode.String; m_cellErrorCode = ExcelErrorCode.None; m_styleContainer.Reset(); m_checkForRotatedEastAsianChars = false; }
public void SetCellValue(object value, TypeCode type) { if (m_lastDataCheckPoint == -1) { m_lastDataCheckPoint = m_worksheetOut.BaseStream.Position; m_worksheet.SizeOfCellData.Add((ushort)m_startOfFirstCellData); m_startOfFirstCellData = 0L; } m_cellValue = value; m_cellValueType = type; m_cellErrorCode = ExcelErrorCode.None; }
public void SetCellError(ExcelErrorCode errorCode) { SetCellValue(null, TypeCode.Empty); m_cellErrorCode = errorCode; }
public void SetCellError(ExcelErrorCode errorCode) { this.SetCellValue(errorCode, TypeCode.Empty); this._currentCellHasBeenModified = true; }
public bool Add(object value, RichTextInfo richTextInfo, TypeCode type, ExcelDataType excelType, ExcelErrorCode errorCode, short column, ushort ixfe) { this.m_details.Initialize(this.m_stream, this.m_row, column, ixfe); TransformResult transformResult; if (errorCode == ExcelErrorCode.None) { switch (excelType) { case ExcelDataType.Blank: transformResult = this.CreateBlankRecord(this.m_details); break; case ExcelDataType.Boolean: transformResult = this.CreateBoolRecord(value, this.m_details); break; case ExcelDataType.Number: { if (type == TypeCode.DateTime) { value = RowHandler.DateToDays((DateTime)value); } uint?nullable = default(uint?); transformResult = this.CreateRKorNumberRecord((ValueType)value, this.m_details, out nullable); if (nullable.HasValue) { transformResult = this.CreateRKRecord(nullable.Value, this.m_details); } break; } case ExcelDataType.String: { string text = (string)value; transformResult = ((text.Length <= 0) ? this.CreateBlankRecord(this.m_details) : this.CreateStringRecord(text, this.m_details)); break; } case ExcelDataType.RichString: transformResult = this.CreateRichStringRecord(richTextInfo, this.m_details); break; default: transformResult = this.CreateBlankRecord(this.m_details); break; } } else { transformResult = this.CreateErrorRecord(errorCode, this.m_details); } return(TransformResult.Handled == transformResult); }
public TransformResult CreateErrorRecord(ExcelErrorCode errorCode, CellRenderingDetails details) { return(this.CreateBoolErrRecord((byte)errorCode, true, details)); }
internal TransformResult CreateErrorRecord(ExcelErrorCode errorCode, CellRenderingDetails details) { return(CreateBoolErrRecord((byte)errorCode, isError: true, details)); }