Witam
Mam stworzony arkusz kalkulacyjny xls którego uzywam jako szablonu. Chciałbym aby program wpisywał do niego jakies przetworzone dane, z zachowaniem wyglądu tabel wykresów itp.Programik który stworzyłem wpisuje poprawnie dane, ale mam problem gdyz komórka edytowana jest całkowicie czyszczona przed dodaniem zawartosci (w tym wypadku kolor wypełnienia).
Macie moze jakies sugestie?
public class excel {
public excel() {
try{
Workbook workbook = Workbook.getWorkbook(new File("n.xls"));
WritableWorkbook copy = Workbook.createWorkbook(new File("n.xls"), workbook);
WritableSheet sheet2 = copy.getSheet(1);
WritableCell cell = sheet2.getWritableCell(1, 2);
if (cell.getType() == CellType.LABEL) {
Label l = (Label) cell;
l.setString("modified cell");
}
NumberFormat fivedps = new NumberFormat("#.#####");
WritableCellFormat cellFormat = new WritableCellFormat(fivedps);
cell.setCellFormat(cellFormat);
Label label = new Label(2, 24, "New label record");
sheet2.addCell(label);
jxl.write.Number number = new jxl.write.Number(3, 4, 3.1459);
sheet2.addCell(number);
// All cells modified/added. Now write out the workbook
copy.write();
copy.close();
}catch(java.io.IOException e){System.err.println(e);}
catch(jxl.read.biff.BiffException e){System.err.println(e);}
catch(jxl.write.WriteException e){System.err.println(e);}
}
public static void main(String[] args) {
new excel();
}
}
Ps Do obsługi xls uzywam jxl