Index ¦ Archives ¦ RSS

Calc buttons with macros: better XLSX support

Estimated read time: 2 minutes

Embedding macros to Calc documents and invoking them by clicking on buttons is a common use-case. There was also decent support for importing these from XLSX (XLSM to be precise), but the export side was not on par with the binary XLS export.

Calc now got a series of incremental improvements to map our form controls (buttons in particular) to OOXML’s form controls, especially when macros are assigned to such buttons.

This work is primarily for Collabora Online, but the feature is fully available in desktop Calc as well.


Excel has both form controls and ActiveX controls, and tdf#106181 XLSX export: output form controls last year started adding support for form control export to XLSX.

Hoping that this will be mostly shared drawingML export code fixing (benefiting DOCX and PPTX as well), it seemed reasonable to assume that we can improve button handling from the "it’s lost" state to "it’s good enough" with some effort.

Results so far

Now Excel shows the button and you can click on it:
Figure 1. Excel consuming our XLSM output with a button and a macro

While it used to just refuse our export result:
Figure 2. Excel refusing bad XLSM output

How is this implemented?

If you would like to know a bit more about how this works, continue reading… :-)

As usual, the end goal was reached via a set of incremental commits:

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.3).

© Miklos Vajna. Built using Pelican. Theme by Giulio Fidente on github.