Como obter tamanho da linha de uma aquivo do Excel no Java

Estou tentando aplicar um estilo em um cabeçalho em um arquivo Excel, após ter criado o arquivo e o cabeçalho.
Criei uma classe com o estilo para aplicar nas diversas tabelas que terei no decorrer do programa.
Estou tentando obter o tamanho

-----for (int i = 0; i <= cabecalho.getLastCellNum(); i++) {-----

desta forma utilizando o get ou tambémgetPhysicalNumberOfCells(), mas não esta dando, alguem poderia?

for (int i = 0; i <= cabecalho.getPhysicalNumberOfCells()(); i++) {
	CellStyle estilocabecalho = workbookEstilo.createCellStyle();
	Font fonte = workbookEstilo.createFont();
	fonte.setColor(HSSFFont.BOLDWEIGHT_BOLD);
	fonte.setColor(HSSFFont.COLOR_RED);
	fonte.setFontName(HSSFFont.FONT_ARIAL);
	fonte.setFontHeightInPoints((short) 12);
	estilocabecalho.setFont(fonte);
	estilocabecalho.setVerticalAlignment(CellStyle.ALIGN_CENTER);
	estilocabecalho.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
	cabecalho.getCell(i).setCellStyle(estilocabecalho);
}

Se o seu arquivo Excel estiver no formato XLS, os comandos abaixo devem funcionar, são os mesmos que utilizo em uma classe que tenho para importação de arquivos.

//PEGA O QUANTIDADE DE LINHAS
int numRows = sheet.getPhysicalNumberOfRows();//sheet é a aba
                
//PEGA O NÚMERO DE COLUNAS
int numCells = row.getPhysicalNumberOfCells();//row é a linha 0 ou cabeçalho
1 curtida