public void SetRowContext(int row)
 {
     if (this.m_rowHandler == null)
     {
         this.m_rowHandler = new RowHandler(this.m_worksheetOut, row, this.m_stringTable);
     }
     this.m_rowHandler.Row = row;
 }
示例#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);
        }
 private void AddNewWorksheet()
 {
     this.m_worksheet            = new WorksheetInfo(this.m_createTempStream("Page" + this.m_worksheets.Count + 1), ExcelRenderRes.SheetName + (this.m_worksheets.Count + 1));
     this.m_worksheet.SheetIndex = this.m_worksheets.Count;
     this.m_worksheets.Add(this.m_worksheet);
     this.m_worksheetOut     = new BinaryWriter(this.m_worksheet.CellData, Encoding.Unicode);
     this.m_numRowsThisBlock = 0;
     this.m_rowHandler       = null;
     this.m_column           = -1;
     this.m_cellValue        = null;
     this.m_cellValueType    = TypeCode.String;
     this.m_checkForRotatedEastAsianChars = false;
     this.m_startOfBlock         = -1L;
     this.m_rowIndexStartOfBlock = 0;
     this.m_startOfFirstCellData = 0L;
     this.m_lastDataCheckPoint   = -1L;
     this.m_styleContainer.Reset();
 }