public static void main(String[] args) throws IOException, BiffException {
Workbook workbook = Workbook.getWorkbook(new File("C:\testes\teste.xls"));
Sheet sheet = workbook.getSheet(0);
int linhas = sheet.getRows();
File pdfFile = new File("C:\testes\teste.pdf");
System.out.println("Iniciando a leitura da planilha XLS:");
for (int i = 0; i < linhas; i++) {
Cell a1 = sheet.getCell(0, i);
Cell a2 = sheet.getCell(1, i);
Cell a3 = sheet.getCell(2, i);
String as1 = a1.getContents();
String as2 = a2.getContents();
String as3 = a3.getContents();
if ("-".equals(as2)) {
System.out.println("Coluna 1: " + as1);
System.out.println("Coluna 2: Completar ");
System.out.println("Coluna 3: " + as3);
Desktop.getDesktop().open(pdfFile); //Abri o arquivo PDF na primeira página
} else {
System.out.println("Coluna 1: " + as1);
System.out.println("Coluna 2: " + as2);
System.out.println("Coluna 3: " + as3);
}
}
workbook.close();
}
Itriedtochangethelinethatcallsthepdffileto:
Desktop.getDesktop().browse(newURI(pdfFile.toURI().toString()+"?page=2&zoom=10"));
But the parameters were ignored.