|
2#
楼主 |
发表于 2006-12-1 16:46:32
|
只看该作者
问题解决,思路还是用动态库处理,WR调用动态库,基本代码如下:
public const E_NO_EXCEL = -20661;
public const E_NO_EXCEL_FILE = -20662;
public const E_NO_EXCEL_SHEET = -20663;
public const E_EXCEL_ERROR = -20664;
public function Excel_active_sheet ( in excel_file, in excel_sheet )
{
auto rc, line;
static excel_signature = "邢唷?";#这个是标准Excel文件前8个字节
rc = file_open( excel_file, FO_MODE_READ );
if ( rc != E_OK )
return rc;
rc = file_getline ( excel_file, line );#取文件第一行
file_close( excel_file );
if ( rc != E_OK || match( line, excel_signature ) != 1 )#如果第1、2个字节组成不是“邢”,说明不是标准的Excel文件
return E_NO_EXCEL_FILE;
rc = SetExcelSheet ( excel_file, excel_sheet );
return (rc) ? -20660+rc : E_OK;#若rc返回0,则return E_OK,否则返回-20660+rc;
} |
|