public class Dimension extends Object
Excel的列由A-Z大写字母组成,行由1,2,3数字组成,每个坐标都由列+行组成
1行1列表示为A1以此类推,当列到达Z之后就由两位字母联合组成,
Z的下一列表示为AA,同理ZZ列的下一列表示为AAA
范围值包含两个坐标,例A1:B5它表示从1行1列到5行2列的范围,如果起始坐标和结束坐标一样
也就是压缩到一个单元格可以简写为起始坐标A1:A1被记为A1
| 限定符和类型 | 字段和说明 |
|---|---|
short |
firstColumn
起始列号 (one base)
|
int |
firstRow
起始行号 (one base)
|
int |
height
宽 = 末尾列-起始列+1
高 = 末尾行-起始行+1
|
short |
lastColumn
末尾列号 (one base)
|
int |
lastRow
末尾行号 (one base)
|
int |
width
宽 = 末尾列-起始列+1
高 = 末尾行-起始行+1
|
| 构造器和说明 |
|---|
Dimension(int firstRow,
short firstColumn) |
Dimension(int firstRow,
short firstColumn,
int lastRow,
short lastColumn) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
checkRange(int r,
int c)
检查指定坐标是否在本范围中
|
boolean |
equals(Object o) |
short |
getFirstColumn()
获取起始列号,最小为1
|
int |
getFirstRow()
获取起始行号,最小为1
|
int |
getHeight()
获取范围高度,高 = 末尾行-起始行+1
|
short |
getLastColumn()
获取末尾列号
|
int |
getLastRow()
获取末尾行号
|
int |
getWidth()
获取范围宽度,宽 = 末尾列-起始列+1
|
int |
hashCode() |
static Dimension |
of(String range)
解析范围字符串,有效的范围字符串至少包含一个起始坐标,最多包含两个坐标,坐标间使用
‘:’分隔 |
String |
toString() |
public final int firstRow
public final int lastRow
public final short firstColumn
public final short lastColumn
public final int width
public final int height
public Dimension(int firstRow,
short firstColumn)
public Dimension(int firstRow,
short firstColumn,
int lastRow,
short lastColumn)
public static Dimension of(String range)
‘:’分隔range - 范围字符串 像A2:B2Dimension entrypublic int getFirstRow()
public int getLastRow()
public short getFirstColumn()
public short getLastColumn()
public int getWidth()
public int getHeight()
public boolean checkRange(int r,
int c)
r - 行号c - 列号Copyright © 2024. All rights reserved.