Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help Request: Formating cells in an ODF-Table #273

Open
Boarschti42 opened this issue Jan 3, 2024 · 1 comment
Open

Help Request: Formating cells in an ODF-Table #273

Boarschti42 opened this issue Jan 3, 2024 · 1 comment

Comments

@Boarschti42
Copy link

Boarschti42 commented Jan 3, 2024

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.

@svanteschubert
Copy link
Contributor

I am sorry, I have too little time to dive into it and fix it. Unless someone else fixes this specific problem. You might preformat the spreadsheet you are using.
Otherwise, if the functionality is not doing what is expected. Please assist and try to provide a patch.
Thanks in advance!
Svante

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants