Osaisiko joku tarkkasilmäinen sanoa, mikä tässä Java-koodissa tökkää?
private static void addLabel(WritableSheet sheet, int column, int row, String s) throws WriteException, RowsExceededException {
Label label = new Label(column, row, s);
sheet.addCell(label);
}
public static void write() throws IOException, WriteException {
WorkbookSettings settings = new WorkbookSettings();
File tiedosto = new File( "nimi.xls");
WritableWorkbook seurw = Workbook.createWorkbook(tiedosto, settings);
seurw.createSheet("lehti", 0);
WritableSheet ws = seurw.getSheet(0);
addLabel(ws,0,0,"Sisältöä");
seurw.close();
}
Tuo luopi kyllä uuden Excel -tiedoston, mutta kun sitä yrittää avata tulee virheilmoitus file format is not valid.
private static void addLabel(WritableSheet sheet, int column, int row, String s) throws WriteException, RowsExceededException {
Label label = new Label(column, row, s);
sheet.addCell(label);
}
public static void write() throws IOException, WriteException {
WorkbookSettings settings = new WorkbookSettings();
File tiedosto = new File( "nimi.xls");
WritableWorkbook seurw = Workbook.createWorkbook(tiedosto, settings);
seurw.createSheet("lehti", 0);
WritableSheet ws = seurw.getSheet(0);
addLabel(ws,0,0,"Sisältöä");
seurw.close();
}
Tuo luopi kyllä uuden Excel -tiedoston, mutta kun sitä yrittää avata tulee virheilmoitus file format is not valid.
Vastaukset 2
Vanhimmat
datan kirjoitus dokkariin eli
seurw.write() ennen closea.
Aah mutta saitkin jo vastauksen StackOverflowsta Jaana ;)
siitä kuinka kustaan otsikko, ei tämänkin viestin takia tuhlasin elämästäni n. 2min..