miachm / SODS

A simple Java library for handle ODS (Open Document Spreadsheet, compatible with Excel and Libreoffice)
The Unlicense
74 stars 30 forks source link

Allow setting default column cell style in written sheets #67

Closed LoadingByte closed 1 year ago

LoadingByte commented 1 year ago

It's often useful to specify the cell style of an entire column, especially when the user is expected to add new rows himself. Thankfully, ODS makes this very easy: just add the table:default-cell-style-name attribute to the table:table-column element:

<table:table-column ... table:default-cell-style-name="cel0"></table:table-column>

API-wise, this could be integrated via a new method Sheet::setDefaultColumnCellStyle(int, Style). Looking at the current backend code, adding the feature should be straightforward.

As with my other suggestions, I would be very happy to hear your thoughts! Thank you a lot for your amazing work :)

miachm commented 1 year ago

Sure! It should be relatively straightforward. There is already certain compatibility in the reading. Although it's quite basic.

Thanks for your feedback so far. This is for cinecred, isn't it?

LoadingByte commented 1 year ago

Yes, all three pull requests stem from features I'd like to add to Cinecred :)

  1. The user-editable spreadsheet contains column descriptions, and the absence of paragraphs makes them unwieldy at the moment; this is what the first issue tries to fix: An unwieldy column description

  2. Users have told me that LibreOffice automatically converts certain inputs to another data type, and when later reading the file in with SODS, Cinecred gets that data type and lets Java convert it back to a string. The solution is of course to set the cell's data style to "@", which can be done manually in LibreOffice's UI. As there's not a single reason for this automatic interpretation to be enabled in Cinecred spreadsheets, I'd like to just turn it off globally. That's where this issue and the previous one come in :)

LoadingByte commented 1 year ago

Hi Miguel,

do you already have a rough idea when you could get around to resolving #65, #66, and #67? I plan on releasing the next version of Cinecred soon, and depending on your time frame, I'll hold off the release a little longer or implement a minimal ODS writer myself.

miachm commented 1 year ago

@LoadingByte who knows. I usually try to update the library every 6 months to keep it alive, so probably I'll release a new version before September. But depends of my availability, at the end this is pure altruism!

You are free to send pull requests so I can merge them. I automated the release process, so I could release the new version with just one click.