⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cellvalue.cs

📁 Excel的操作,其中可以读取及写入Excel 文件
💻 CS
字号:
using System;

using Microsoft.Fawvw.Components.NExcel.ExcelCommon;
using Microsoft.Fawvw.Components.NExcel.Format;
using Microsoft.Fawvw.Components.NExcel.Biff;

namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
	
	/// <summary> Abstract class for all records which actually contain cell values</summary>
	public abstract class CellValue:RecordData, Cell
	{
		/// <summary> Interface method which returns the row number of this cell
		/// 
		/// </summary>
		/// <returns> the zero base row number
		/// </returns>
		virtual public int Row
		{
			get
			{
				return row;
			}
			
		}
		/// <summary> Interface method which returns the column number of this cell
		/// 
		/// </summary>
		/// <returns> the zero based column number
		/// </returns>
		virtual public int Column
		{
			get
			{
				return column;
			}
			
		}
		/// <summary> Gets the XFRecord corresponding to the index number.  Used when
		/// copying a spreadsheet
		/// 
		/// </summary>
		/// <returns> the xf index for this cell
		/// </returns>
		virtual public int XFIndex
		{
			get
			{
				return xfIndex;
			}
			
		}
		/// <summary> Gets the CellFormat object for this cell.  Used by the WritableWorkbook
		/// API
		/// 
		/// </summary>
		/// <returns> the CellFormat used for this cell
		/// </returns>
		virtual public Microsoft.Fawvw.Components.NExcel.Format.CellFormat CellFormat
		{
			get
			{
				if (!initialized)
				{
					format = formattingRecords.getXFRecord(xfIndex);
					initialized = true;
				}
				
				return format;
			}
		
		}

		virtual public CellType Type
		{
			get
			{
				return null;
			}
		}
		
		/// <summary> Determines whether or not this cell has been hidden
		/// 
		/// </summary>
		/// <returns> TRUE if this cell has been hidden, FALSE otherwise
		/// </returns>
		virtual public bool Hidden
		{
			get
			{
				ColumnInfoRecord cir = sheet.getColumnInfo(column);
				
				if (cir != null && (cir.Width == 0 || cir.Hidden))
				{
					return true;
				}
				
				RowRecord rr = sheet.getRowInfo(row);
				
				if (rr != null && (rr.RowHeight == 0 || rr.isCollapsed()))
				{
					return true;
				}
				
				return false;
			}
			
		}
		/// <summary> Accessor for the sheet
		/// 
		/// </summary>
		/// <returns> the sheet
		/// </returns>
		virtual protected internal SheetImpl Sheet
		{
			get
			{
				return sheet;
			}
			
		}
		/// <summary> The logger</summary>
		private static Logger logger;
		
		/// <summary> The row number of this cell record</summary>
		private int row;
		
		/// <summary> The column number of this cell record</summary>
		private int column;
		
		/// <summary> The XF index</summary>
		private int xfIndex;
		
		/// <summary> A handle to the formatting records, so that we can
		/// retrieve the formatting information
		/// </summary>
		private FormattingRecords formattingRecords;
		
		/// <summary> A lazy initialize flag for the cell format</summary>
		private bool initialized;
		
		/// <summary> The cell format</summary>
		private XFRecord format;
		
		/// <summary> A handle back to the sheet</summary>
		private SheetImpl sheet;
		
		/// <summary> Constructs this object from the raw cell data
		/// 
		/// </summary>
		/// <param name="t">the raw cell data
		/// </param>
		/// <param name="fr">the formatting records
		/// </param>
		/// <param name="si">the sheet containing this cell
		/// </param>
		protected internal CellValue(Record t, FormattingRecords fr, SheetImpl si):base(t)
		{
			sbyte[] data = getRecord().Data;
			row = IntegerHelper.getInt(data[0], data[1]);
			column = IntegerHelper.getInt(data[2], data[3]);
			xfIndex = IntegerHelper.getInt(data[4], data[5]);
			sheet = si;
			formattingRecords = fr;
			initialized = false;
		}
		

		virtual public string Contents
		{
			get
			{
				return null;
			}
		}
	
		/// <summary>
		/// Returns a empty value.
		/// </summary>
		virtual public object Value
		{
			get
			{
				return null;
			}
		}


		static CellValue()
		{
			logger = Logger.getLogger(typeof(CellValue));
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -