您好,欢迎光临本网站![请登录][注册会员]  
文件名称: c++操作Excel的一个动态库程序
  所属分类: C++
  开发工具:
  文件大小: 228kb
  下载次数: 0
  上传时间: 2008-10-07
  提 供 者: kevin_*******
 详细说明: 这是曾经做过的一个项目时写的一个动态库,用c++来操作Excel,包括以下功能: //===================================mainly function============================ //FuncName: xls_create //function: create excel server //return value: return 1 if success, otherwise 0 _export bool xls_create(); //FuncName: xls_new_file/xls_new_file2 //function: create an excel file (from a template) //parameter: strTemplate ->excel template file name,eg: "template.xlt" or "d:\teplate.xls" // strFileName ->the file name used to save excel fil e as,eg: "Temp.xls" // openfile ->1: open excel file after writen it,otherwize don't open it //return value: return the excel fileID which created from template, between 1 and 256 if success, or zero otherwise _export int xls_new_file(char* szTemplate, char* szFileName, int openfile); _export int xls_new_file2(char* szFileName, int openfile); //FuncName: xls_open_file //function: Open an exist excel file //parameter:the file name will to be opened //return value: return the fileID, if open file success,otherwize return 0 _export int xls_open_file(char* szFileName); //FuncName: xls_write_xxx //function: write a double value to xls file //parameter: fileID ->the excel file ID which we will write the value into,between 1 and 256 // sheetID ->the sheet index of the excel file which we will write the value into,between 1 and 256 // crow ->the row index which we will write the value into, not less 1 // ccol ->the column index which we will write the value into, not less 1 // value ->the double value which we will write into excel //Note: if you want to input enter key in excel file,you may use \n in your str //return value: return 1 if success, otherwise 0 _export int xls_write_str(int fileID, int sheetID, int crow, int ccol, char* value); _export int xls_write_dbl(int fileID, int sheetID, int crow, int ccol, double value); _export int xls_write_int(int fileID, int sheetID, int crow, int ccol, int value); //FuncName: xls_read_xxx //function: read value from the cell //return value: return 1 if read success, else return 0 _export int xls_read_str(int fileID, int sheetID, int row, int column, char* cBuffer, int nBufLen); _export int xls_read_dbl(int fileID, int sheetID, int row, int column, double &value); _export int xls_read_int(int fileID, int sheetID, int row, int column, int &value); _export int xls_read_time(int fileID, int sheetID, int row, int column, SYSTEMTIME &st); //FuncNam: xls_is_cell_empty //function: adjust whether the cell is empty //return value: return true if the cell is empty, else return false _export bool xls_is_cell_empty(int fileID, int sheetID, int row, int column); //FuncName: xls_close_file //function: close the excel file which opened before //parameter: fileID->the id of the file which will closed // savechange->whether save change before close the file //returna value: return zero if fail, otherwize return norzero _export int xls_close_file(int fileID, bool savechange); _export int xls_close_all(bool savechange); //FuncName: xls_draw_line //function: draw a line in the excel file //parameter: ArrowBegin ->0: the begin of the line hasn't a arrow // 1: the begin of the line has a arrow // ArrowEnd ->0: the end of the line hasn't a arrow // 1: the end of the line has a arrow // BeginX ->The X coordinate (in points) for the starting point of the // line. The coordinate is relative to the top left corner of the slide. // BeginY ->The Y coordinate (in points) for the starting point of the // line. The coordinate is relative to the top left corner of the slide. // EndX ->The X coordinate (in points) for the ending point of the // line. The position is relative to the bottom left corner of the slide. // EndY ->The Y coordinate (in points) for the ending point of the // line. The position is relative to the bottom left corner of the slide. // DashStyle ->the line dash style, the value must between 0 and 10 // Style ->the style of the line, the value must between 0 and 4 // Weight ->the weight of the line, the unit is pound, and the value must be a multiple of 0.25 //return value: return 1 if success, otherwise 0 //Note: you can get the column wide and the row height by function xls_wide_xxx and xls_height_xxx. _export int xls_draw_line(int fileID, int sheetID, float BeginX, float BeginY, float EndX, float EndY, int ArrowBegin, int ArrowEnd, int DashStyle=-1, int Style=-1, float Weight=-1); //FuncName: xls_save //function: save the file after write all values //parameter: fileID ->the excel file ID which will be saved // overwrite ->1: delete destination file if it has already exist when you save file // 0: it will pop up a message box to ask you whether or not to overwrite // the destination file if the destination exist. //return value: return 1 if success, otherwise 0 _export bool xls_save(int fileID, int overwrite); //FuncName: xls_destroy //function: destroy excel server and close all excel file //return value: return 1 if success, otherwise 0 _export bool xls_destroy(); //=================================assistant function=========================== //Function: only get the column "col" wide or get the wide from column "A" to "col" // only get the row "row" height or the height from row "1" to row "row" _export float xls_wide_column(int fileID, int sheetID, char *szCol); _export float xls_wide_total(int fileID, int sheetID, char *szCol1, char *szCol2); _export float xls_height_row(int fileID, int sheetID, int row); _export float xls_height_total(int fileID, int sheetID, int row1, int row2); //FuncName: xls_print_area/xls_print_area2 //function: set print area _export int xls_print_area(int fileID, int sheetID, int row1, int col1, int row2, int col2); _export int xls_print_area2(int fileID, int sheetID, int row1, char *szCol1, int row2, char *szCol2); //FuncName: xls_set_header //function: set header info of excel file when you print it //parameter: pos ->1: left page header // 2: center page header // 3: right page header // info ->header information // Note: if you want to show the current page number and total page number, // then you can use &P to represent the current page number, // and use &N to represent the total page number. // eg: if you want to show print information "page 1/4" on the right header,then you can set pos=3,info="page &P/&N" _export int xls_set_header(int fileID, int sheetID, int pos, char* info); //FuncName: xls_set_footer //function: set footer of the excel file when you print it //parameter: pos ->1: left footer // 2: center footer // 3: right footer // info ->footer information _export int xls_set_footer(int fileID, int sheetID, int pos, char* info); //FuncName: xls_merge //function: merge more than one cells into one cell //parameter: fileID ->the excel file ID which we will merge the cell,between 1 and 256 // sheetID ->the sheet index of the excel file which we will merge the cells,between 1 and 256 // nRow1 ->top most cell index which to merge // nRow2 ->bottom most cell index which to merge // nCol1 ->left most cell index which to merge // nCol2 ->right most cell index which to merge //return value: return 1 if success, otherwise 0 _export int xls_merge(int fileID, int sheetID, int nRow1, int nRow2, int nCol1, int nCol2); //FuncName: xls_set_alignment //function: set cells property of alignment //parameter: HAlignment->1:default(text stand left and digit stand right) // 2:left // 3:center // 4:right // VAlignment->1:top // 2:middle // 3:bottom _export int xls_set_alignment(int fileID, int sheetID, int RowTop, int RowBottom, int ColLeft, int ColRight, int HAlignment, int VAlignment); //FuncName: xls_set_orient //function: set the orient of text in the cells //return value: return 1 if success, else return 0 _export int xls_set_orient(int fileID, int sheetID, int row1, int col1, int row2, int col2, int degree); //FuncName: xls_set_color //function: set cells bkcolor,fontcolor,fontsize //Parameter: name: font name // fontstyle: 0 -> 常规 // 1 -> 倾斜 // 2 -> 加粗 // 3 -> 加粗 倾斜 // underline: 1 -> 无下划线 // 2 -> 单下划线 // 3 -> 双下划线 // 4 -> 会计用单下划线 // 5 -> 会计用双下划线 _export int xls_set_font(int fileID, int sheetID, int row1, int col1, int row2, int col2, char *name, int fontsize, int fontstyle, int fontcolor, int bkcolor, int underline); //FuncName: xls_get_sheetname //function: get the sheet name _export int xls_get_sheetname(int fileID, int sheetID, char *name, int buflen); //FuncName: xls_draw_textframe //draw textframe shape //Parameter: orientation 1 -> Horizontal // 2 -> Vertical(up to down) // 3 -> Vertical(left to right) // 4 -> Vertical(right to left) // border: true(nomal) // false(no border) _export int xls_draw_textframe(int fileID, int sheetID, int orientation, char* text, float left, float top, float width, float height); ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: C++ C Excel VBA
 输入关键字,在本站1000多万海量源码库中尽情搜索: