Ask Your Question
0

how to get all referenced links in a Spread Sheet document through api ??

asked 2018-12-13 14:12:49 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am developing a c++ plugin for libre office in which i have a requirement to get all referenced links present in a sheet through api. I have looked at api documentation for libre office and found some services: 1. com.sun.star.sheet.sheetlinks 2. com.sun.star.sheet.CellArealinks 3. com.sun.star.sheet.ExternalDocLinks

I am having a reference mxDesktop of XDesktop interface. Using this reference i get the current component. here is the code snippet:

Reference < XComponent> lxComponent = mxDesktop->getCurrentComponent();

Then I get the Reference of XSpreadsheetDocument and XMultiServiceFactory .

Reference < XSpreadSheetDocument> lxDocument (lxComponent ,UNO_QUERY);
Reference < XMultiServiceFactory> lxSpreadSheetFactory(lxDocument ,UNO_QUERY);

Then I am trying to get all links from com.sun.star.SheetLinks service :

Reference< XNameAccess> lxNameAccess = 
Reference< XNameAccess> (lxSpreadSheetFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetLinks"))),UNO_QUERY );

On executing this I get lxNameAccess variable as NULL. So how can i access all referenced links in my sheet ?? Is there any other way to get all links in a sheet through api ??

I have also printed all the services using:

Sequence< OUString> links = lxSpreadSheetFactory->getAvailableServicenames().

But did not find com.sun.star.sheet.SheetLinks service name in the list. Same is the case for com.sun.star.sheet.ExternalDocLinks service.

Are these services not implemented by Libre Office ?? is there any other way to get list of all referenced links in a document ??

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-12-14 16:11:02 +0200

erAck gravatar image

SheetLinks is a sheet.SpreadsheetDocument property returning an XNameAccess interface and not available from XMultiServiceFactory.

CellAreaLinks is a sheet.SpreadsheetDocument property returning an XAreaLinks interface.

ExternalDocLinks is not exported at all. Note that neither ExternalDocLinks nor XExternalDocLinks are marked as published.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-12-13 14:12:49 +0200

Seen: 71 times

Last updated: Dec 14 '18