Escrever dados em planilha do Excel com a Api JXL

0 respostas
G

Como escrever na planilha com a API JXL? pesquisei e nada...

Meu código até agora foi esse:

Tentei addCell mas não funcionou! Ele pede uma writablecell mas nos tutorias o pessoal usa(linha,coluna,string) e aqui não funcionou!

import java.awt.Label;
import java.io.File;
import java.io.IOException;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;


public class ExcelTeste {

	public static void main(String[] args) throws BiffException, IOException {
		WritableWorkbook workbook = Workbook.getWorkbook(new File("C:\\Users\\Neto\\Downloads\\JAVA\\teste.xls"));
		WritableSheet sheet = workbook.getSheet(0);
		
	
		
		int linhas = sheet.getRows();
		System.out.println("Começou! Numero de linhas: "+linhas+" Numero de colunas: "+ sheet.getColumns());
		
		for(int i=1; i<linhas; i++){
		Cell celula1 = sheet.getCell(0, i);
		String celula = celula1.getContents();
		System.out.println(celula);
		}
		workbook.close();
	}

}

Alguém sabe como adicionar uma string?

Criado 14 de agosto de 2013
Respostas 0
Participantes 1