Hi,
im searching for a way to insert html formatex text into a document.
at the moment im using unoidl.com.sun.star.text.XTextRange setString function but it ignore html and style tags, inserts the tags instead
best regards
djunges
Howto insert html styled text
Re: Howto insert html styled text
Have you tried pasting with the dispatch helper?
Code: Select all
dim document as object
dim dispatcher as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Howto insert html styled text
Hi JeJe,
Thank you for you response.
This would be a possible solution, but I didn't want to use the Clipboard.
If pasting from the clipboard works then it should have a function that allows me to do the same but unfortunately I still can't find it.
I hope someone can help me
regards
djunges
Thank you for you response.
This would be a possible solution, but I didn't want to use the Clipboard.
If pasting from the clipboard works then it should have a function that allows me to do the same but unfortunately I still can't find it.
I hope someone can help me
regards
djunges
Re: Howto insert html styled text
You don't say the source of your html.
You can use gettransferable and settransferable to copy/paste content from an OO source
without using the clipboard
Example:
viewtopic.php?f=21&t=78814
You can use gettransferable and settransferable to copy/paste content from an OO source
without using the clipboard
Example:
viewtopic.php?f=21&t=78814
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Howto insert html styled text
thanks for you response,
The html source comes from database.
I have seen the settransferable, but i not found a way to create a XTransferable object and put the data into it. It seems to be used only to copy from one documento to another.
best regards
djunges
The html source comes from database.
I have seen the settransferable, but i not found a way to create a XTransferable object and put the data into it. It seems to be used only to copy from one documento to another.
best regards
djunges
Re: Howto insert html styled text
If no-one comes up with a better way you could save it to a file and then insert the file in the document.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Howto insert html styled text
Hi JeJe
Thanks for you help.
To avoid using the Clipboard a saved the html data into a tmp file and then insert it with ".uno:InsertDoc"
regards
djunges
Thanks for you help.
To avoid using the Clipboard a saved the html data into a tmp file and then insert it with ".uno:InsertDoc"
regards
djunges