How to set Conditional Formatting -> Data Bar from a macro?


recently I found the feature Data Bar under Format -> Conditional Formatting -> Data Bar... and I find it very useful. However, I would like to set this formatting from a macro. Unfortunately I was unable to find any helpful information regarding this topic.

Does anybody knows how to set Conditional Formatting -> Data Bar... from a macro?

Many thanks in advance!

I already discussed this topic here. Unfortunately I did not find a satisfying solution.

At the moment there is no API for the new conditional formats as they are in stabilization phase and may require one more refactoring. At least in LibO 4.2 I will provide a public API for that feature.

Is the related calcext:conditional-formats element simply a temporary ODF 1.2 Extended feature that will be otherwise encoded differently (elsewhere in the schema) in time i.e., in ODF 1.3?

Hello moggi,
When can I expect LibO 4.2?
Is there a way to get a preliminary API?

Many thanks,

Yes calcext:conditional-formats and all sub elements are ODF 1.2 extended elements that will change with hopefully get a proper place in the spec with ODF 1.3. Until now we have to live with this solution.

4.2 will be released in about 8 or 9 months. We are close to the 4.1 feature freeze and my list for items till the feature freeze is actually too long to work on conditional formats in the remaining time. I’m still hoping that there are some responses at the ODF change request before I start working on a stable API as I have to be much more careful with major design changes after providing a public API.

Hi moggi, I am really desperate on having a solution for this issue. But I also understand that the API is not in the release plan for 4.1. Unfortunately I cannot wait 9 Months until the release of 4.2 and need to find a solution now. I see two options here: to develop some dirty workaround to set the data bar formatting directly in the content.xml or to move completely to MS Office 2010. I would like to avoid the latter option. Would you be able to guide me in the development of the workaround?

The best documentation for this is the source code at Except for that just have a quick look at generated output. The content is really quite straight forward as I tried to keep it simple.

Hi moggi,

I just installed LibreOffice Is the official API for DataBars already there?
If yes, do you have an example how to use it?