IDispatch col = (IDispatch) ((IDispatch)cursheet.get("UsedRange")).get("Columns");
int cols = Integer.parseInt(col.get("Count").toString());
(17)获得行列以后要获得里面的内容(这里用的rows 和 cols就是上面所得的)
String cellVal="";
String cellTxt="";
String hasFormula= "";
String cellFormula="";
for(int i=0;i<rows;i++){
for(int j=0;j<cols;j++){
IDispatch cells = (IDispatch) cursheet.get("Cells", new Object[] {
new Integer(i+1),new Integer(j+1) });
cellVal = cells.get("value").toString();
cellTxt = cells.get("text").toString();
hasFormula = cells.get("HasFormula").toString();
cellFormula = cells.get("FormulaR1C1").toString();
}
}
延伸阅读
文章来源于领测软件测试网 https://www.ltesting.net/