天软金融分析.NET函数大全 > 文档处理函数 > Excel处理函数 > Excel处理函数-txlsreadwrite版

ExcelGetDataRange2    

简述

  获得指定的Excel中的指定的Sheet包含有数据的区域
  注:此函数无需依赖office/wps,但需要关闭文件。
定义
ExcelGetDataRange2(ExcelFileName:String;ExcelSheetName:String;StartRow:Integer;StartCol:Integer;EndRow:Integer;EndCol:Integer):Integer
参数
名称类型说明
ExcelFileNameString字符串,Excel文件名
ExcelSheetNameString字符串,Sheet名
StartRowInteger整数,有数据的开始行
StartColInteger整数,有数据的开始列
EndRowInteger整数,有数据的结束行
EndColInteger整数,有数据的结束列
返回Integer 整数。如果成功则返回真,如果指定的文件不存在或者指定的Sheet不存在或者失败则返回假。
  • 范例

    //取本地文件C:\VBA.xlsx有数据的起始行列号和结束行列号
      dir:="C:\\VBA.xlsx";
      sheet:="Sheet1";
      ret:=rdo2 ExcelGetDataRange2(dir,sheet,row_start,col_start,row_end,col_end);
      if ret then
      begin
        return array("row_start":row_start,"col_start":col_start,"row_end":row_end,"col_end":col_end);
      end;
      return 0;
相关