コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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;
        }