firegloves / MemPOI

A library to simplify export from database to Excel files using Apache POI :japanese_goblin:
MIT License
57 stars 7 forks source link

Cell Style Based on Cell Value #68

Closed apoorva-sriv closed 11 months ago

apoorva-sriv commented 1 year ago

Is there a way to apply a cell style based on the cell value? For example, I have a column that should be right aligned if the cell value is not null and left aligned if it's null.

firegloves commented 1 year ago

Not currently, even if it is a planned improvement.

You could manually loop on the resulting document in order to check the value and apply what you need, but If you want to keep the generation process atomic and avoid saving the document using mempoi and then open it manually and update it, I think you could leverage the data post elaboration pipeline. You could leave empty the analysis methods and enclose the whole logic inside the execute method

apoorva-sriv commented 1 year ago

Thanks. I'll try it out and update maybe on Tuesday. UPDATE: It turns out this won't be a problem after all for our use case, so you can close this issue if you want or keep it open until the "planned improvement".