コード例 #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
        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);
        }
コード例 #3
0
        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 = this.m_stringHandler.AddString(stringWrapperBIFF);

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