openComponentFromURL FilterName .xlsx

@JohnSUN just a problem I had in this other thread. Unfortunately, one of the files I need to open is a *.xlsx file, and using the filter “calc8” seems to prevent the files’ being opened correctly. Is there a load argument filter name that will correctly handle .xlsx files? Or have LO’s abilities to handle .xlsx been stripped away with Windows’ latest updates?

You don’t need to specify any file type. Just pass an empty array.

sTemp = "C:\Path\file.xlsx"
StarDesktop.loadComponentFromURL(convertToURL(sTemp), "_blank", 0, Array()

What did the macro from Listing 5.46: Enumerate all supported filter names tell you about the available filters? Have you seen Calc MS Excel 2007 XML there? Maybe you can find this line here?

Unfortunately, the latest Windows update seems to have broken LO’s ability to detect the file type, which was what was being addressed in the earlier thread.

You can obtain the necessary information yourself.

  1. Open the file in LO.
  2. Menu / Tools / Development Tools. Tab: Properties. Find Args, then find element FilterName.

LibreOffice detects the file types anyway. It does not depend on OS settings nor file name extensions.
reportFileTypes.odt (26.0 KB) is a Python macro to report all known filters of your current Open/LibreOffice suite.

1 Like