当前位置: 首页>>代码示例>>C#>>正文


C# CellValueRecordInterface类代码示例

本文整理汇总了C#中CellValueRecordInterface的典型用法代码示例。如果您正苦于以下问题:C# CellValueRecordInterface类的具体用法?C# CellValueRecordInterface怎么用?C# CellValueRecordInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CellValueRecordInterface类属于命名空间,在下文中一共展示了CellValueRecordInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormatNumberDateCell

        /**
         * Formats the given numeric of date Cell's contents
         *  as a String, in as close as we can to the way
         *  that Excel would do so.
         * Uses the various format records to manage this.
         *
         * TODO - move this to a central class in such a
         *  way that hssf.usermodel can make use of it too
         */
        public String FormatNumberDateCell(CellValueRecordInterface cell)
        {
            double value;
            if (cell is NumberRecord)
            {
                value = ((NumberRecord)cell).Value;
            }
            else if (cell is FormulaRecord)
            {
                value = ((FormulaRecord)cell).Value;
            }
            else
            {
                throw new ArgumentException("Unsupported CellValue Record passed in " + cell);
            }

            // Get the built in format, if there is one
            int formatIndex = GetFormatIndex(cell);
            String formatString = GetFormatString(cell);

            if (formatString == null)
            {
                return value.ToString();
            }
            else
            {
                // Format, using the nice new
                //  HSSFDataFormatter to do the work for us
                return formatter.FormatRawCellContents(value, formatIndex, formatString);
            }
        }
开发者ID:babywzazy,项目名称:Server,代码行数:40,代码来源:FormatTrackingHSSFListener.cs

示例2: InsertCell

        public void InsertCell(CellValueRecordInterface cell)
        {
            int column = cell.Column;
            int row = cell.Row;
            if (row >= records.Length)
            {
                CellValueRecordInterface[][] oldRecords = records;
                int newSize = oldRecords.Length * 2;
                if (newSize < row + 1) newSize = row + 1;
                records = new CellValueRecordInterface[newSize][];
                Array.Copy(oldRecords, 0, records, 0, oldRecords.Length);
            }
            object objRowCells = records[row];
            if (objRowCells == null)
            {
                int newSize = column + 1;
                if (newSize < 10) newSize = 10;
                objRowCells = new CellValueRecordInterface[newSize];
                records[row] = (CellValueRecordInterface[])objRowCells;
            }
            CellValueRecordInterface[] rowCells = (CellValueRecordInterface[])objRowCells;
            if (column >= rowCells.Length)
            {
                CellValueRecordInterface[] oldRowCells = rowCells;
                int newSize = oldRowCells.Length * 2;
                if (newSize < column + 1) newSize = column + 1;
                // if(newSize>257) newSize=257; // activate?
                rowCells = new CellValueRecordInterface[newSize];
                Array.Copy(oldRowCells, 0, rowCells, 0, oldRowCells.Length);
                records[row] = rowCells;
            }
            rowCells[column] = cell;

            if ((column < firstcell) || (firstcell == -1))
            {
                firstcell = column;
            }
            if ((column > lastcell) || (lastcell == -1))
            {
                lastcell = column;
            }
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:42,代码来源:ValueRecordsAggregate.cs

示例3: IsEqual

 /// <summary>
 /// returns whether this cell represents the same cell (NOT VALUE)
 /// </summary>
 /// <param name="i"> record to Compare</param>
 /// <returns>true if the cells are the same cell (positionally), false if not.</returns>
 public bool IsEqual(CellValueRecordInterface i)
 {
     return _formulaRecord.IsEqual(i);
 }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:9,代码来源:FormulaRecordAggregate.cs

示例4: ValueRecordsAggregate

 private ValueRecordsAggregate(int firstCellIx, int lastCellIx, CellValueRecordInterface[][] pRecords)
 {
     firstcell = firstCellIx;
     lastcell = lastCellIx;
     records = pRecords;
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:6,代码来源:ValueRecordsAggregate.cs

示例5: MyEnumerator

 public MyEnumerator(ref CellValueRecordInterface[][] _records)
 {
     this.records = _records;
     this.nextRow = 0;
     this.lastRow = _records.Length - 1;
     //FindNext();
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:7,代码来源:ValueRecordsAggregate.cs

示例6: Construct

 public void Construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh)
 {
     if (rec is FormulaRecord)
     {
         FormulaRecord formulaRec = (FormulaRecord)rec;
         // read optional cached text value
         StringRecord cachedText=null;
         Type nextClass = rs.PeekNextClass();
         if (nextClass == typeof(StringRecord))
         {
             cachedText = (StringRecord)rs.GetNext();
         }
         else
         {
             cachedText = null;
         }
         InsertCell(new FormulaRecordAggregate(formulaRec, cachedText, sfh));
     }
     else
     {
         InsertCell(rec);
     }
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:23,代码来源:ValueRecordsAggregate.cs

示例7: RemoveCell

        public void RemoveCell(CellValueRecordInterface cell)
        {
            if (cell == null)
            {
                throw new ArgumentException("cell must not be null");
            }

            int row = cell.Row;
            if (row >= records.Length)
            {
                throw new Exception("cell row is out of range"); 
            }
            CellValueRecordInterface[] rowCells = records[row];
            if (rowCells == null)
            {
                throw new Exception("cell row is already empty");
            }
            int column = cell.Column;
            if (column >= rowCells.Length)
            {
                throw new Exception("cell column is out of range");
            }
            rowCells[column] = null;
            
        }
开发者ID:ctddjyds,项目名称:npoi,代码行数:25,代码来源:ValueRecordsAggregate.cs

示例8: HSSFCell

        /// <summary>
        /// Creates an Cell from a CellValueRecordInterface.  HSSFSheet uses this when
        /// reading in cells from an existing sheet.
        /// </summary>
        /// <param name="book">Workbook record of the workbook containing this cell</param>
        /// <param name="sheet">Sheet record of the sheet containing this cell</param>
        /// <param name="cval">the Cell Value Record we wish to represent</param>
        public HSSFCell(HSSFWorkbook book, HSSFSheet sheet, CellValueRecordInterface cval)
        {
            record = cval;
            cellType = DetermineType(cval);
            stringValue = null;
            this.book = book;
            this.sheet = sheet;
            switch (cellType)
            {
                case CellType.STRING:
                    stringValue = new HSSFRichTextString(book.Workbook, (LabelSSTRecord)cval);
                    break;

                case CellType.BLANK:
                    break;

                case CellType.FORMULA:
                    stringValue = new HSSFRichTextString(((FormulaRecordAggregate)cval).StringValue);
                    break;
            }
            //ExtendedFormatRecord xf = book.Workbook.GetExFormatAt(cval.XFIndex);

            //CellStyle = new HSSFCellStyle((short)cval.XFIndex, xf, book);
        }
开发者ID:xiepeixing,项目名称:npoi,代码行数:31,代码来源:HSSFCell.cs

示例9: DetermineType

        /**
         * used internally -- given a cell value record, figure out its type
         */
        private CellType DetermineType(CellValueRecordInterface cval)
        {
            if (cval is FormulaRecordAggregate)
            {
                return CellType.Formula;
            }

            Record record = (Record)cval;
            int sid = record.Sid;

            switch (sid)
            {

                case NumberRecord.sid:
                    return CellType.Numeric;


                case BlankRecord.sid:
                    return CellType.Blank;


                case LabelSSTRecord.sid:
                    return CellType.String;


                case FormulaRecordAggregate.sid:
                    return CellType.Formula;


                case BoolErrRecord.sid:
                    BoolErrRecord boolErrRecord = (BoolErrRecord)record;

                    return (boolErrRecord.IsBoolean)
                             ? CellType.Boolean
                             : CellType.Error;

            }
            throw new Exception("Bad cell value rec (" + cval.GetType().Name + ")");
        }
开发者ID:Reinakumiko,项目名称:npoi,代码行数:42,代码来源:HSSFCell.cs

示例10: IsEqual

 public bool IsEqual(CellValueRecordInterface i)
 {
     return ((this.Row == i.Row)
             && (this.Column == i.Column));
 }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:5,代码来源:BoolErrRecord.cs

示例11: IsAfter

 public bool IsAfter(CellValueRecordInterface i)
 {
     if (this.Row < i.Row)
     {
         return false;
     }
     if ((this.Row == i.Row)
             && (this.Column < i.Column))
     {
         return false;
     }
     if ((this.Row == i.Row)
             && (this.Column == i.Column))
     {
         return false;
     }
     return true;
 }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:18,代码来源:BoolErrRecord.cs

示例12: IsBefore

 public bool IsBefore(CellValueRecordInterface i)
 {
     if (this.Row > i.Row)
     {
         return false;
     }
     if ((this.Row == i.Row)
             && (this.Column > i.Column))
     {
         return false;
     }
     if ((this.Row == i.Row)
             && (this.Column == i.Column))
     {
         return false;
     }
     return true;
 }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:18,代码来源:BoolErrRecord.cs

示例13: GetFormatIndex

 /**
  * Returns the index of the format string, used by your cell,
  *  or -1 if none found
  */
 public int GetFormatIndex(CellValueRecordInterface cell)
 {
     ExtendedFormatRecord xfr = (ExtendedFormatRecord)
         xfRecords[cell.XFIndex];
     if (xfr == null)
     {
         logger.Log(POILogger.ERROR, "Cell " + cell.Row + "," + cell.Column + " uses XF with index " + cell.XFIndex + ", but we don't have that");
         return -1;
     }
     return xfr.FormatIndex;
 }
开发者ID:JnS-Software-LLC,项目名称:npoi,代码行数:15,代码来源:FormatTrackingHSSFListener.cs

示例14: CreateCellFromRecord

        /// <summary>
        /// Create a high level Cell object from an existing low level record.  Should
        /// only be called from HSSFSheet or HSSFRow itself.
        /// </summary>
        /// <param name="cell">The low level cell to Create the high level representation from</param>
        /// <returns> the low level record passed in</returns>
        public Cell CreateCellFromRecord(CellValueRecordInterface cell)
        {
            Cell hcell = new HSSFCell(book, sheet, cell);

            AddCell(hcell);
            int colIx = cell.Column;
            if (row.IsEmpty)
            {
                row.FirstCol=(colIx);
                row.LastCol=(colIx + 1);
            }
            else
            {
                if (colIx < row.FirstCol)
                {
                    row.FirstCol = (colIx);
                }
                else if (colIx > row.LastCol)
                {
                    row.LastCol = (colIx + 1);
                }
                else
                {
                    // added cell is within first and last cells
                }
            }
            return hcell;
        }
开发者ID:babywzazy,项目名称:Server,代码行数:34,代码来源:HSSFRow.cs

示例15: GetFormatString

 /**
  * Returns the format string, eg $##.##, used
  *  by your cell 
  */
 public String GetFormatString(CellValueRecordInterface cell)
 {
     int formatIndex = GetFormatIndex(cell);
     if (formatIndex == -1)
     {
         // Not found
         return null;
     }
     return GetFormatString(formatIndex);
 }
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:14,代码来源:FormatTrackingHSSFListener.cs


注:本文中的CellValueRecordInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。