record.cs

来自「Excel的操作,其中可以读取及写入Excel 文件」· CS 代码 · 共 107 行

CS
107
字号
using System;

using Microsoft.Fawvw.Components.NExcel.Biff;

namespace Microsoft.Fawvw.Components.NExcel.Read.Biff
{
	
	/// <summary> A container for the raw record data within a biff file</summary>
	public sealed class Record 
	{
		/// <summary> Gets the .Length of the record
		/// 
		/// </summary>
		/// <returns> the .Length of the record
		/// </returns>
		public int Length
		{
			get
			{
				return length;
			}
			
		}
		/// <summary> Gets the data portion of the record
		/// 
		/// </summary>
		/// <returns> the data portion of the record
		/// </returns>
		public sbyte[] Data
		{
			get
			{
				if (data == null)
				{
					data = file.read(dataPos, length);
				}
				
				return data;
			}
			
		}
		/// <summary> The excel 97 code
		/// 
		/// </summary>
		/// <returns> the excel code
		/// </returns>
		public int Code
		{
			get
			{
				return code;
			}
			
		}
		/// <summary> The excel biff code</summary>
		private int code;
		/// <summary> The data type</summary>
		private Microsoft.Fawvw.Components.NExcel.Biff.Type type;
		/// <summary> The .Length of this record</summary>
		private int length;
		/// <summary> A pointer to the beginning of the actual data</summary>
		private int dataPos;
		/// <summary> A handle to the excel 97 file</summary>
		private File file;
		/// <summary> The raw data within this record</summary>
		private sbyte[] data;
		
		/// <summary> Constructor
		/// 
		/// </summary>
		/// <param name="offset">the offset in the raw file
		/// </param>
		/// <param name="f">the excel 97 biff file
		/// </param>
		/// <param name="d">the data record
		/// </param>
		internal Record(sbyte[] d, int offset, File f)
		{
			code = IntegerHelper.getInt(d[offset], d[offset + 1]);
			length = IntegerHelper.getInt(d[offset + 2], d[offset + 3]);
			file = f;
			file.skip(4);
			dataPos = f.Pos;
			file.skip(length);
			type = Microsoft.Fawvw.Components.NExcel.Biff.Type.getType(code);
		}
		
		/// <summary> Gets and sets the biff type
		/// 
		/// </summary>
		/// <returns> the biff type
		/// </returns>
		public Microsoft.Fawvw.Components.NExcel.Biff.Type Type
		{
			get
			{
				return type;
			}
			set
			{
				type = value;
			}
		}
		
	}
}

⌨️ 快捷键说明

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