Ask Your Question

Open a calc file using ole object

asked 2018-04-23 13:20:50 +0100

Bly gravatar image

Hello, I'd like give to the end user the option to use LibreOffice instead of MS Office when it comes to load spreadsheet files into my custom application. Right now, I use OLE objects and I call "excel.application" to connect to the OLE object. This, of course, works when the customer have installed the MS Office Excel product. I think it will be nice have my app being able to use LibreOffice too. I did read I can use "OO.application" for OpenOffice but I am looking for LibreOffice, someone can point me to the correct call to use? TIA!

Here is a snippet of the code I use now:

iRes = ole_excel.ConnectToNewObject("excel.application") // MS Excel
if iRes <> 0 then
    sError = "Error running MS Excel api"
end if
ole_workbook = ole_excel.application.workbooks(1)
ole_worksheet = ole_workbook.worksheets(1)
lnumrows = ole_worksheet.UsedRange.Rows.Count
lnumcol = ole_worksheet.UsedRange.Columns.Count
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-04-23 16:02:42 +0100

erAck gravatar image

If it works with OpenOffice and "OO.Application" (I have no idea whether it does or not, where did you read that?) then chances are it works the same with LibreOffice, depending on which one is installed.

edit flag offensive delete link more


Tried "OO.application" but didn't worked, I only can guess LibreOffice uses a different scope name than "OO". I am right now taking a look to the LibreOffice SDK to see if something must be done on my side. But I think my app does not have to require the user install the SDK too, to let him/her load an Excel file, OLE object is expected being registered by the standard installer. But I'm only guessing right now, still reading the docs and looking at help here in forum ;)

Bly gravatar imageBly ( 2018-04-24 10:08:21 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-04-23 13:20:50 +0100

Seen: 515 times

Last updated: Apr 23 '18