• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CellValueRecordInterface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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)
     {
         Console.Error.WriteLine("Cell " + cell.Row + "," + cell.Column + " uses XF with index " + cell.XFIndex + ", but we don't have that");
         return -1;
     }
     return xfr.FormatIndex;
 }
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:15,代码来源:FormatTrackingHSSFListener.cs


示例17: AddValueRecord

        /// <summary>
        /// Adds a value record to the sheet's contained binary records
        /// (i.e. LabelSSTRecord or NumberRecord).
        /// This method is "loc" sensitive.  Meaning you need to Set LOC to where you
        /// want it to start searching.  If you don't know do this: SetLoc(GetDimsLoc).
        /// When Adding several rows you can just start at the last one by leaving loc
        /// at what this Sets it to.
        /// </summary>
        /// <param name="row">the row to Add the cell value to</param>
        /// <param name="col">the cell value record itself.</param>
        public void AddValueRecord(int row, CellValueRecordInterface col)
        {
            //if (log.Check(POILogger.DEBUG))
            //{
            //    log.Log(POILogger.DEBUG, "Add value record  row" + row);
            //}
            DimensionsRecord d = _dimensions;

            if (col.Column >= d.LastCol)
            {
                d.LastCol = ((short)(col.Column + 1));
            }
            if (col.Column < d.FirstCol)
            {
                d.FirstCol = (col.Column);
            }
            _rowsAggregate.InsertCell(col);
        }
开发者ID:WPG,项目名称:npoi,代码行数:28,代码来源:InternalSheet.cs


示例18: 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:xiepeixing,项目名称:npoi,代码行数:42,代码来源:HSSFCell.cs


示例19: RemoveValueRecord

 /// <summary>
 /// Remove a value record from the records array.
 /// This method is not loc sensitive, it Resets loc to = dimsloc so no worries.
 /// </summary>
 /// <param name="row">the row of the value record you wish to Remove</param>
 /// <param name="col">a record supporting the CellValueRecordInterface.</param>
 public void RemoveValueRecord(int row, CellValueRecordInterface col)
 {
     //log.LogFormatted(POILogger.DEBUG, "Remove value record row,dimsloc %,%",
     //                 new int[] { row, dimsloc });
     _rowsAggregate.RemoveCell(col);
 }
开发者ID:WPG,项目名称:npoi,代码行数:12,代码来源:InternalSheet.cs


示例20: FormatNumberDateCell

            /// <summary>
            /// Formats a number or date cell, be that a real number, or the
            /// answer to a formula
            /// </summary>
            /// <param name="cell">The cell.</param>
            /// <param name="value">The value.</param>
            /// <returns></returns>
            private String FormatNumberDateCell(CellValueRecordInterface cell, double value)
            {
                // Get the built in format, if there is one
                int formatIndex = ft.GetFormatIndex(cell);
                String formatString = ft.GetFormatString(cell);

                if (formatString == null)
                {
                    return value.ToString();
                }
                else
                {
                    // Is it a date?
                    if (HSSFDateUtil.IsADateFormat(formatIndex, formatString) &&
                            HSSFDateUtil.IsValidExcelDate(value))
                    {
                        // Java wants M not m for month
                        formatString = formatString.Replace('m', 'M');
                        // Change \- into -, if it's there
                        formatString = formatString.Replace("\\\\-", "-");

                        // Format as a date
                        DateTime d = HSSFDateUtil.GetJavaDate(value, false);
                        SimpleDateFormat df = new SimpleDateFormat(formatString);
                        return df.Format(d);
                    }
                    else
                    {
                        if (formatString == "General")
                        {
                            // Some sort of wierd default
                            return value.ToString();
                        }

                        // Format as a number
                        DecimalFormat df = new DecimalFormat(formatString);
                        return df.Format(value);
                    }
                }
            }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:47,代码来源:EventBasedExcelExtractor.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CertEncodingType类代码示例发布时间:2022-05-24
下一篇:
C# CellValueChangedEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap