odftoolkit
odftoolkit copied to clipboard
Help Request: Formating cells in an ODF-Table
Hi,
i currently face the problem of exporting data from a database into an odf-table. Inserting data seems to work fine, but formating goes cracy since i dont want to use simple-odf.
Here is the problem: After writing a cell and formating it bold or set a background color, the next cell i write also uses this style, not the default plain setting. (as i read a little, this has something to do with automatic styles?)
how do i get this resolved? Some samples down below...
// Calls to formating like this
protected void fillCompanyInformation(int row) {
// Fill the first cells with company data
setCellTextInItalic(row++, 0, prefs.get(Constants.PREFERENCES_YOURCOMPANY_NAME, ""));
setCellTextInItalic(row++, 0, prefs.get(Constants.PREFERENCES_YOURCOMPANY_OWNER, ""));
setCellTextInItalic(row++, 0, prefs.get(Constants.PREFERENCES_YOURCOMPANY_STREET, ""));
setCellTextInItalic(row++, 0, prefs.get(Constants.PREFERENCES_YOURCOMPANY_ZIP, "") + " " + prefs.get(Constants.PREFERENCES_YOURCOMPANY_CITY, ""));
}
// Formating works like this
public static void setBold(final OdfTable spreadsheet, final int row, final int column) {
// Get the cell by the row and the column
OdfTableCell cell = getCell(spreadsheet, row, column);
cell.getOdfElement().setProperty(OdfTextProperties.FontWeight, "bold");
}
Thank you for your help in advance.