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 AddFooter(string left, string center, string right)
        {
            StringBuilder stringBuilder = new StringBuilder();

            ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(left, stringBuilder.Append("&L"));
            ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(center, stringBuilder.Append("&C"));
            ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(right, stringBuilder.Append("&R"));
            m_worksheet.FooterString = stringBuilder.ToString();
        }
예제 #4
0
 private void AppendWithChecking(string value)
 {
     ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(value, m_stringBuilder, m_checkForRotatedFarEastChars, out bool foundEastAsianChar);
     if (m_checkForRotatedFarEastChars && foundEastAsianChar)
     {
         m_checkForRotatedFarEastChars = false;
         m_foundRotatedFarEastChar     = true;
     }
 }
예제 #5
0
        private void AppendWithChecking(string value)
        {
            bool foundEastAsianChar = false;

            ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(value, _text, _checkForRotatedFarEastChars, out foundEastAsianChar);
            if (foundEastAsianChar)
            {
                _checkForRotatedFarEastChars = false;
                _foundRotatedEastAsianChar   = true;
            }
        }
        private void AppendWithChecking(string value)
        {
            bool flag = default(bool);

            ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(value, this.m_stringBuilder, this.m_checkForRotatedFarEastChars, out flag);
            if (this.m_checkForRotatedFarEastChars && flag)
            {
                this.m_checkForRotatedFarEastChars = false;
                this.m_foundRotatedFarEastChar     = true;
            }
        }
        private void AppendWithChecking(string value)
        {
            bool flag = false;

            ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(value, this._text, this._checkForRotatedFarEastChars, out flag);
            if (flag)
            {
                this._checkForRotatedFarEastChars = false;
                this._foundRotatedEastAsianChar   = true;
            }
        }
예제 #8
0
 private string GetUsablePortionOfHeaderFooterString(string candidate, ref int spaceRemaining)
 {
     if (!string.IsNullOrEmpty(candidate) && spaceRemaining > 2)
     {
         StringBuilder stringBuilder = new StringBuilder(candidate.Length);
         ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(candidate, stringBuilder);
         int num = Math.Min(spaceRemaining - 2, stringBuilder.Length);
         spaceRemaining -= num + 2;
         return(stringBuilder.ToString(0, num));
     }
     return(null);
 }
예제 #9
0
 private void FinalizeCell()
 {
     if (this._currentRow != null && !this._currentCellHasBeenModified && (this._currentStyle == null || !this._currentStyle.HasBeenModified))
     {
         this._currentRow.ClearCell(this._currentColumn);
     }
     else
     {
         bool flag = false;
         if (this._currentRichText != null)
         {
             this._currentRichText.Commit(this._currentStyle);
             flag = this._currentRichText.FoundRotatedEastAsianChar;
             this._currentRichText = null;
         }
         else if (this._currentCell != null && this._currentCell.ValueType == Cell.CellValueType.Text && this._currentCell.Value != null)
         {
             string text = this._currentCell.Value.ToString();
             if (text.Length > 0)
             {
                 StringBuilder stringBuilder = new StringBuilder(text.Length);
                 ExcelGeneratorStringUtil.ConvertWhitespaceAppendString(text, stringBuilder, this._checkForRotatedEastAsianChars, out flag);
                 this._currentCell.Value = stringBuilder.ToString();
             }
         }
         if (flag)
         {
             this._currentStyle.Orientation = Orientation.Vertical;
         }
         if (this._currentCell != null)
         {
             if (this._currentStyle != null && (this._currentCell.ValueType == Cell.CellValueType.Text || this._currentCell.ValueType == Cell.CellValueType.Blank || this._currentCell.ValueType == Cell.CellValueType.Error))
             {
                 this._currentStyle.NumberFormat = null;
             }
             this._currentCell.Style = this._currentStyle;
         }
         this._currentStyle = null;
     }
     this._checkForRotatedEastAsianChars = false;
 }