I am working with Excel (xlsx) in Java. I never understood the return value type from getRow(int RowNum)
. What do you mean by "IT RETURNS THE LOGICAL ROW (0-Based)"? See below code.
我正在使用Java中的Excel(xlsx)。我从未理解getRow(int RowNum)的返回值类型。 “IT返回逻辑行(基于0)”是什么意思?见下面的代码。
row=sheet.getRow(0);
I am trying to get the data from 3rd row, 1st col. Apparently it worked and I got the result what I need (only after writing bit of further code).
我试图从第3行,第1列获取数据。显然它工作,我得到了我需要的结果(只有在写了更多的代码之后)。
But, my question is how user manage to get data from 3rd row? when the rownum is given as 0 (as you can see). I am expecting that it will (row) stick to 0th row ie. first row in Excel sheet.
但是,我的问题是用户如何设法从第3行获取数据?当rownum为0时(如你所见)。我期待它(行)坚持到第0行即。 Excel工作表中的第一行。
getLastCellNum()
method of XSSFRow class - what do you mean by "Gets the index of the last cell contained in this row PLUS ONE"?.
XSSFRow类的getLastCellNum()方法 - 你是什么意思“获取此行PLUS ONE中包含的最后一个单元格的索引”?
1 个解决方案
#1
1
For getRow(int RowNum)
, I think the logical row means it is a logical view on the physical sheet, but if you change the physical rows it will not get updated accordingly.
对于getRow(int RowNum),我认为逻辑行意味着它是物理工作表上的逻辑视图,但是如果更改物理行,它将不会相应地更新。
For example:
例如:
Row a = sheet.getRow(5);
Row b = sheet.createRow(0); // every physical row gets shifted down
System.out.println(a.getRowNum()); // still prints 5, logical row has not been updated
Concerning getLastCellNum()
, I think it just means it returns the number of cells in the row (including blank ones). It just happens that the underlying datamodel stores this value and it is returned as-is, and it is also convenient for iterating on cells…
关于getLastCellNum(),我认为它只是意味着它返回行中的单元格数(包括空白单元格)。只是发生了基础数据模型存储此值并按原样返回,并且它也方便迭代单元格...
#1
1
For getRow(int RowNum)
, I think the logical row means it is a logical view on the physical sheet, but if you change the physical rows it will not get updated accordingly.
对于getRow(int RowNum),我认为逻辑行意味着它是物理工作表上的逻辑视图,但是如果更改物理行,它将不会相应地更新。
For example:
例如:
Row a = sheet.getRow(5);
Row b = sheet.createRow(0); // every physical row gets shifted down
System.out.println(a.getRowNum()); // still prints 5, logical row has not been updated
Concerning getLastCellNum()
, I think it just means it returns the number of cells in the row (including blank ones). It just happens that the underlying datamodel stores this value and it is returned as-is, and it is also convenient for iterating on cells…
关于getLastCellNum(),我认为它只是意味着它返回行中的单元格数(包括空白单元格)。只是发生了基础数据模型存储此值并按原样返回,并且它也方便迭代单元格...