Ask Your Question
1

How to get title for Libre Writer from VB.NET

asked 2017-11-29 15:30:51 +0200

Muru gravatar image

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...

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-11-29 16:17:12 +0200

Jim K gravatar image

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.

edit flag offensive delete link more

Comments

Hi Jim, Thanks for the solution and its working well... :)

Muru gravatar imageMuru ( 2017-12-01 18:10:35 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-11-29 15:30:51 +0200

Seen: 205 times

Last updated: Nov 29 '17