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;
        }
        internal bool Add(object value, RichTextInfo richTextInfo, TypeCode type, ExcelDataType excelType, ExcelErrorCode errorCode, short column, ushort ixfe)
        {
            m_details.Initialize(m_stream, m_row, column, ixfe);
            TransformResult transformResult;

            if (errorCode == ExcelErrorCode.None)
            {
                switch (excelType)
                {
                case ExcelDataType.Blank:
                    transformResult = CreateBlankRecord(m_details);
                    break;

                case ExcelDataType.Boolean:
                    transformResult = CreateBoolRecord(value, m_details);
                    break;

                case ExcelDataType.Number:
                {
                    if (type == TypeCode.DateTime)
                    {
                        value = DateToDays((DateTime)value);
                    }
                    transformResult = CreateRKorNumberRecord((ValueType)value, m_details, out uint?rkValue);
                    if (rkValue.HasValue)
                    {
                        transformResult = CreateRKRecord(rkValue.Value, m_details);
                    }
                    break;
                }

                case ExcelDataType.String:
                {
                    string text = (string)value;
                    transformResult = ((text.Length <= 0) ? CreateBlankRecord(m_details) : CreateStringRecord(text, m_details));
                    break;
                }

                case ExcelDataType.RichString:
                    transformResult = CreateRichStringRecord(richTextInfo, m_details);
                    break;

                default:
                    transformResult = CreateBlankRecord(m_details);
                    break;
                }
            }
            else
            {
                transformResult = CreateErrorRecord(errorCode, m_details);
            }
            return(TransformResult.Handled == transformResult);
        }
        private TransformResult CreateRichStringRecord(RichTextInfo richTextInfo, CellRenderingDetails details)
        {
            StringWrapperBIFF8 stringWrapperBIFF = richTextInfo.CompleteRun();

            if (stringWrapperBIFF.Cch > 32767)
            {
                throw new ReportRenderingException(ExcelRenderRes.MaxStringLengthExceeded(details.Row.ToString(CultureInfo.InvariantCulture), details.Column.ToString(CultureInfo.InvariantCulture)));
            }
            int isst = m_stringHandler.AddString(stringWrapperBIFF);

            OnCellBegin(253, details.Column);
            RecordFactory.LABELSST(details.Output, (ushort)details.Row, (ushort)details.Column, details.Ixfe, (uint)isst);
            return(TransformResult.Handled);
        }