Calc - load styles option is missing?

I have a spreadsheet template in which I’ve created and updated several styles, and I want to overwrite the styles used in another document from this template. According to the official documentation and all of my searches, there should be a “load styles” option on a drop-down somewhere in the Styles sidebar that will allow me to load styles from another file.

I can’t find this option anywhere.

Workaround:

Put all your styles in a separate cell below each other. Select this block and paste it into another spreadsheet. The styles should be copied as well.

I hope this helps.


With me:
Version: 7.1.5.2 (x64) / LibreOffice Community
Build ID: 85f04e9f809797b8199d13c421bd8a2b025d52b5
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL

1 Like

… and you are sure this “official documentation” is related to Calc? This option exists in Writer.

1 Like

So what you’re saying is this option is missing from Calc. That’s an unfortunate oversight.

Hello
Here is an working example written in python, you have to run it from the Calcdocument you want to import the Styles:

from com.sun.star.beans import PropertyValue

def import_styles():
    doc = XSCRIPTCONTEXT.getDocument()
    styles = doc.StyleFamilies
    pv = PropertyValue()
    pv.Name = "OverwriteStyles"
    pv.Value = True
    style_template_url = "file:///the/path/to/your/template.ods"
    styles.loadStylesFromURL(style_template_url, (pv,))

and the Transscription to Basic:

Sub importStyles

    Dim prop(1) As new com.sun.star.beans.PropertyValue
    doc = thisComponent
    styles = doc.StyleFamilies
    
    prop(0).Name = "OverwriteStyles"
    prop(0).Value = True
    style_template_url = "file:///the/path/to/your/template.ods"
    styles.loadStylesFromURL(style_template_url, (prop))


End Sub
1 Like

the Api provides also for calc:
loadStylesFromDocument()

How do I actually do it though? Is the API function there but there’s just no toolbar button for it?