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

📄 basicexcel.hpp

📁 对EXCEL的操作
💻 HPP
📖 第 1 页 / 共 3 页
字号:
	void InsertPropertyTree(PropertyTree* parentTree, Property* property, size_t index);
	void DeletePropertyTree(PropertyTree* tree);
	void UpdateChildrenIndices(PropertyTree* parentTree);
	void IncreasePropertyReferences(PropertyTree* parentTree, size_t index);
	void DecreasePropertyReferences(PropertyTree* parentTree, size_t index);
	PropertyTree* propertyTrees_;
	PropertyTree* currentDirectory_;
	vector<Property*> properties_;
	vector<PropertyTree*> previousDirectories_;
};
} // YCompoundFiles namespace end

namespace YExcel
{
using namespace YCompoundFiles;

struct CODE
{
	enum {	FORMULA=0x0006,		//Token array and the result of a formula cell.
			YEOF=0x000A,			//End of a record block with leading BOF record.
			CALCCOUNT=0x000C,	//Maximum number of times the forumlas should be iteratively calculated
			CALCMODE=0x000D,	//Calculate formulas manually, automatically, or automatically except for multiple table operations
			PRECISION=0x000E,	//Whether formulas use the real cell values for calculation or the values displayed on the screen.
			REFMODE=0x000F,		//Method used to show cell addresses in formulas.
			DELTA=0x0010,		//Maximum change of the result to exit an iteration.
			ITERATION=0x0011,	//Whether iterations are allowed while calculating recursive formulas.
			PROTECT=0x0012,		//Whether worksheet or a workbook is protected against modification.
			PASSWORD=0x0013,	//16-bit hash value, calculated from the worksheet or workbook protection password.
			HEADER=0x0014,		//Page header string for the current worksheet.
			FOOTER=0x0015,		//Page footer string for the current worksheet.
			EXTERNSHEET=0x0017,	//List with indexes to SUPBOOK records
			NAME=0x0018,		//Name and token array of an internal defined name.
			WINDOWPROTECT=0x0019,	//Whether the window configuration of the document is protected.
			SELECTION=0x001D,	//Addresses of all selected cell ranges and position of the active cell for a pane in the current sheet.
			DATEMODE=0x0022,	//Base date for displaying date values.
			EXTERNNAME=0x0023,	//Name of an external defined name, name of an add-in function, a DDE item or an OLE object storage identifier.
			LEFTMARGIN=0x0026,	//Left page margin of the current worksheet.
			RIGHTMARGIN=0x0027,	//Right page margin of the current worksheet.
			TOPMARGIN=0x0028,	//Top page margin of the current worksheet.
			BOTTOMMARGIN=0x0029,	//Bottom page margin of current worksheet
			PRINTHEADERS=0x002A,	//Whether row and column headers (the areas with row numbers and column letters) will be printed.
			PRINTGRIDLINES=0x002B,	//Whether sheet grid lines will be printed.
			FILEPASS=0x002F,	//Information about the read/write password of the file.
			FONT=0x0031,		//Information about a used font, including character formatting.
			TABLE=0x0036,		//Information about a multiple operation table in the sheet.
			CONTINUE=0x003C,	//Continue from previous record
			WINDOW1=0x003D,		//General settings for the workbook global settings.
			BACKUP=0x0040,		//Make backup of file while saving?
			PANE=0x0041,		//Position of window panes.
			CODEPAGE=0x0042,	//Text encoding used to encode byte strings
			DCONREF=0x0051,
			DEFCOLWIDTH=0x0055,	//Default column width for columns that do not have a specific width set
			XCT=0x0059,			//Number of immediately following CRN records.
			CRN=0x005A,			//Contents of an external cell or cell range.
			FILESHARING=0x005B,	//Information about write protection, for instance the write protection password.
			WRITEACCESS=0x005C,	//Name of the user that has saved the file.
			UNCALCED=0x005E,	//Formulas have not been recalculated before the document was saved.
			SAVERECALC=0x005F,	//"Recalculate before save" option
			OBJECTPROTECT=0x0063,	//Whether objects of the current sheet are protected.
			COLINFO=0x007D,		//Width for a given range of columns
			GUTS=0x0080,		//Layout of outline symbols.
			WSBOOL=0x0081,		//16-bit value with boolean options for the current sheet.
			GRIDSET=0x0082,		//Whether option to print sheet grid lines has ever been changed.
			HCENTER=0x0083,		//Sheet is centred horizontally when printed.
			VCENTER=0x0084,		//Whether sheet is centred vertically when printed.
			BOUNDSHEET=0x0085,	//Sheet inside of the workbook
			WRITEPROT=0x0086,	//Whether file is write protected.
			COUNTRY=0x008C,		//User interface language of the Excel version that has saved the file, system regional settings at the time the file was saved.
			HIDEOBJ=0x008D,		//Whether and how to show objects in the workbook.
			SORT=0x0090,		//Last settings from the "Sort" dialogue for each sheet.
			PALETTE=0x0092,		//Definition of all user-defined colours available for cell and object formatting.
			SETUP=0x00A1,		//Page format settings of the current sheet.
			SHRFMLA=0x00BC,		//Token array of a shared formula.
			MULRK=0x00BD,		//Cell range containing RK value cells. All cells are located in the same row.
			MULBLANK=0x00BE,	//Cell range of empty cells. All cells are located in the same row.
			DBCELL=0x00D7,		//Relative offsets to calculate stream position of the first cell record for each row.
			BOOKBOOL=0x00DA,	//Save values linked from external workbooks records and XCT records?
			SCENPROTECT=0x00DD,	//Whether scenarios of the current sheet are protected.
			XF=0x00E0,			//Formatting information for cells, rows, columns or styles.
			MERGEDCELLS=0x00E5,	//All merged cell ranges of the current sheet.
			SST=0x00FC,			//List of all strings used anywhere in the workbook.
			LABELSST=0x00FD,	//Cell that contains a string.
			EXTSST=0x00FF,		//Create a hash table with stream offsets to the SST record to optimise string search operations.
			LABELRANGES=0x015F,	//Addresses of all row and column label ranges in the current sheet.
			USESELFS=0x0160,	//Whether formulas in the workbook can use "natural language formulas".
			DSF=0x0161,			//Whether file contains an addition BIFF5/BIFF7 workbook stream.
			SUPBOOK=0x01AE,		//URL of an external document and a list of sheet names inside this document.
			CONDFMT=0x01B0,		//List of cell range addresses for all cells with equal conditional formatting.
			CF=0x01B1,			//Condition and the formatting attributes applied to the cells specified in the CONDFMT record, if the condition is met
			DVAL=0x01B2,		//List header of the data validity table in the current sheet.
			HLINK=0x01B8,		//One cell address or a cell range where all cells contain the same hyperlink.
			DV=0x01BE,			//Data validity settings and a list of cell ranges which contain these settings.
			DIMENSIONS=0x0200,	//Range address of the used area in the current sheet.
			BLANK=0x0201,		//Empty cell, contains cell address and formatting information
			NUMBER=0x0203,		//Cell that contains a floating-point value.
			BOOLERR=0x0205,		//Error value cell
			STRING=0x0207,		//Result of a string formula.
			ROW=0x0208,			//Properties of a single row in the sheet.
			INDEX=0x020B,		//Range of used rows and stream positions of several records of the current sheet.
			ARRAY=0x0221,		//Token array of an array formula
			WINDOW2=0x023E,		//Additional settings for the window of a specific worksheet.
			RK=0x027E,			//Cell that contains an RK value (encoded integer or floating point value).
			STYLE=0x0293,		//Name of a user-defined cell style or specific options for a built-in cell style.
			FORMAT=0x041E,		//Number format.
			SHRFMLA1=0x04BC,	//Token array of a shared formula (added).
			QUICKTIP=0x0800,	//Cell range and text for a tool tip.
			BOF=0x0809,			//Beginning of file
			SHEETLAYOUT=0x0862,	//Colour of the tab below the sheet containing the sheet name.
			SHEETPROTECTION=0x0867,	//Additional options for sheet protection.
			RANGEPROTECTION=0x0868	//Information about special protected ranges in a protected sheet.
		};
};

class Record
{
public:
	Record();
	virtual ~Record();
	virtual size_t Read(const char* data);
	virtual size_t Write(char* data);	
	virtual size_t DataSize();
	virtual size_t RecordSize();
	short code_;
	vector<char> data_;
	size_t dataSize_;
	size_t recordSize_;
	vector<size_t> continueIndices_;
};

struct BOF : public Record
{
	BOF();
	virtual size_t Read(const char* data);
	virtual size_t Write(char* data);	
	short version_;
	short type_;
	short buildIdentifier_;
	short buildYear_;
	int fileHistoryFlags_;
	int lowestExcelVersion_;
};

struct YEOF : public Record
{
	YEOF();
};

struct SmallString
{
	SmallString();
	~SmallString();
	SmallString(const SmallString& s);
	SmallString& operator=(const SmallString& s);
	const SmallString& operator=(const char* str);
	const SmallString& operator=(const wchar_t* str);
	void Reset();
	size_t Read(const char* data);
	size_t Write(char* data);	
	size_t DataSize();
	size_t RecordSize();
	size_t StringSize();
	wchar_t* wname_;
	char* name_;
	char unicode_;
};

struct LargeString
{
	LargeString();
	~LargeString();
	LargeString(const LargeString& s);
	LargeString& operator=(const LargeString& s);
	const LargeString& operator=(const char* str);
	const LargeString& operator=(const wchar_t* str);
	void Reset();
	size_t Read(const char* data);
	size_t ContinueRead(const char* data, size_t size);
	size_t Write(char* data);	
	size_t DataSize();
	size_t RecordSize();
	size_t StringSize();
	vector<wchar_t> wname_;
	vector<char> name_;
	char unicode_;
	short richtext_;
	int phonetic_;
};

class Workbook
{
public:
	Workbook();

public:
	struct FileProtection;
	struct CodePage;
	struct DSF;
	struct TabID;
	struct FnGroupCount;
	struct WorkbookProtection;
	struct Window1 : public Record
	{
		Window1();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		short horizontalPos_;
		short verticalPos_;
		short width_;
		short height_;
		short options_;
		short activeWorksheetIndex_;
		short firstVisibleTabIndex_;
		short selectedWorksheetNo_;
		short worksheetTabBarWidth_;
	};
	struct Backup;
	struct HideObj;
	struct DateMode;
	struct Precision;
	struct RefreshAll;
	struct BookBool;
	struct Font : public Record
	{
		Font();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		virtual size_t DataSize();
		virtual size_t RecordSize();
		short height_;
		short options_;
		short colourIndex_;
		short weight_;
		short escapementType_;
		char underlineType_;
		char family_;
		char characterSet_;
		char unused_;
		SmallString name_;
	};
	struct Format;
	struct XF : public Record
	{
		XF();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		short fontRecordIndex_;
		short formatRecordIndex_;
		short protectionType_;
		char alignment_;
		char rotation_;
		char textProperties_;
		char usedAttributes_;
		int borderLines_;
		int colour1_;
		short colour2_;
	};
	struct Style : public Record
	{
		Style();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		virtual size_t DataSize();
		virtual size_t RecordSize();
		short XFRecordIndex_;
		char identifier_;
		char level_;
		LargeString name_;		
	};
	struct Palette;
	struct UseSelfs;
	struct BoundSheet : public Record
	{
		BoundSheet();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		virtual size_t DataSize();
		virtual size_t RecordSize();
		int BOFpos_;
		char visibility_;
		char type_;
		SmallString name_;		
	};
	struct Country;
	struct LinkTable;
	struct SharedStringTable : public Record
	{
		SharedStringTable();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		virtual size_t DataSize();
		virtual size_t RecordSize();
		int stringsTotal_;
		int uniqueStringsTotal_;
		vector<LargeString> strings_;	
	};
	struct ExtSST : public Record
	{
		ExtSST();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);
		virtual size_t DataSize();
		virtual size_t RecordSize();
		short stringsTotal_;
		vector<int> streamPos_;
		vector<short> firstStringPos_;
		vector<short> unused_;
	};
	size_t Read(const char* data);
	size_t Write(char* data);
	size_t DataSize();
	size_t RecordSize();

	BOF bof_;
	Window1 window1_;
	vector<Font> fonts_;
	vector<XF> XFs_;
	vector<Style> styles_;
	vector<BoundSheet> boundSheets_;
	SharedStringTable sst_;
	ExtSST extSST_;
	YEOF eof_;
};

class Worksheet
{
public:
	Worksheet();

public:
	struct Uncalced;
	struct Index : public Record
	{
		Index();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		virtual size_t DataSize();
		virtual size_t RecordSize();
		int unused1_;
		size_t firstUsedRowIndex_;
		size_t firstUnusedRowIndex_;
		int unused2_;
		vector<size_t> DBCellPos_;
		
	};
	struct CalculationSettings
	{
		struct CalcCount;
		struct CalcMode;
		struct RefMode;
		struct Delta;
		struct Iteration;
		struct SafeRecalc;		
	};
	struct PrintHeaders;
	struct PrintGridlines;
	struct Gridset;
	struct Guts;
	struct DefaultRowHeight;
	struct WSBool;
	struct PageSettings
	{
		struct Header;
		struct Footer;
		struct HCenter;
		struct VCenter;
		struct LeftMargin;
		struct RightMargin;
		struct TopMargin;
		struct BottomMargin;
		struct PLS;
		struct Setup;
	};
	struct WorksheetProtection;
	struct DefColWidth;
	struct ColInfo;
	struct Sort;
	struct Dimensions : public Record
	{
		Dimensions();
		virtual size_t Read(const char* data);
		virtual size_t Write(char* data);	
		size_t firstUsedRowIndex_;
		size_t lastUsedRowIndexPlusOne_;
		short firstUsedColIndex_;
		short lastUsedColIndexPlusOne_;
		short unused_;		
	};
	struct CellTable
	{
		struct RowBlock
		{
			struct Row : public Record
			{
				Row();
				virtual size_t Read(const char* data);
				virtual size_t Write(char* data);	
				short rowIndex_;
				short firstCellColIndex_;
				short lastCellColIndexPlusOne_;
				short height_;
				short unused1_;
				short unused2_;
				int options_;
			};
			struct CellBlock
			{
				struct Blank : public Record
				{
					Blank();
					virtual size_t Read(const char* data);
					virtual size_t Write(char* data);	
					short rowIndex_;
					short colIndex_;
					short XFRecordIndex_;					
				};

⌨️ 快捷键说明

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