How to get title for Libre Writer from VB.NET

Hi,

I referred code from the below link and i try to get the document title from VB.NET. But i could not get the title for writer document. Can please any one tell how to get or set a title for Libre Writer document?

https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=21494

Thanks

There are two kinds of titles, the window title and the title shown in File → Properties. The code below gets both.

Dim oSM, oDesk, oDoc As Object
Dim oFrame, oDocProps As Object
oSM = CreateObject("com.sun.star.ServiceManager")
oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
oDoc = oDesk.loadComponentFromURL("file:///path/to/document.odt", "_blank", 0, arg)
oFrame = oDoc.getCurrentController().getFrame()
Console.WriteLine(oFrame.Title)
oDocProps = oDoc.getDocumentProperties()
Console.WriteLine(oDocProps.Title)

The document title is one of the attributes of XDocumentProperties.

Hi Jim, Thanks for the solution and its working well… :slight_smile: