How to solve "invalid parameter" error when saving as .ods Calc file

I occasionally encounter the “invalid parameter” error when saving as .ods Calc file.


This is albeit the same set of instructions did not previously show the “invalid parameter” error.

LibreOffice Version: (x86)

Operating System: Windows 7 Ultimate Service Pack 1

Dim Prop(1) as New
Dim saveAsODSArgs(1) as new

dispatcher = createUnoService("")

sOutputPath = DirectoryNameoutofPath(ThisComponent.getURL(),"/")
sOutputFileName = "WeeklyCollectionReportWorkbook.ods"

saveAsODSArgs(0).Name = "URL"
saveAsODSArgs(0).Value = sOutputPath & "/" & sOutputFileName
saveAsODSArgs(1).Name = "FilterName"
saveAsODSArgs(1).Value = "writer8"
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame, ".uno:SaveAs", "", 0, saveAsODSArgs())

Present Solution

To solve the “invalid parameter” error, I restart LibreOffice Calc.

If the problem persists, I restart the Operating System.

What is the best technique to solve this problem?

Thank you. Peace.

may be you need “” instead of “/” for windows OS? (proper that you’d mention your OS!)

imho there are! functionalities in LO that let you handle path names in macros OS independent ??? but i’m not familiar with it, just use the search engine of your choice, or search in ‘ask’ or ‘bugs’ …

peace and sanity …

From my understanding, as URL input for the PropertyValue, “saveAsODSArgs”, forward slash, i.e. “/”, is correct regardless of the Operating System. Thank you.

There are API functions ConvertToURL() and ConvertFromURL() for exact converting the Windows style Full Path strings to URL format. Not only the slashes matter, but even some “special characters” will be converted when you use these functions.

OK! Thank you.

Do you want convert a spreadsheet file into textual format? The “.ods” file extension and the “Writer8” export filter are not compatible…

In this case, the output file is “.ods”. What is the correct export filter if not “Writer8”? Thank you.

OK! I verified that using “Calc8” as the export filter name successfully saves the output .ods file. I shall continue to observe if the “invalid parameter” error re-occurs using a Windows Machine. Thank you.