Hi Ariel,
Am 18.12.2013 18:57, schrieb Ariel Constenla-Haile:
Hi Peter,
On Wed, Dec 18, 2013 at 09:57:25AM +0100, Peter Eberlein wrote:
Hi,
first thanks to Ariel who simplified the system mail stuff.
But this seems not suitable for html body.
It depends on the MUA implementation, but in general you can assume the
string is a plain text body.
So I tried:
'a selection in the textdocument must be done before
xTransferable = ThisComponent.CurrentController.getTransferable()
dataflavors = xTransferable.getTransferDataFlavors()
data = dataflavors(2)'html
transferData = xtransferable.getTransferData(data)
xMessage =
com.sun.star.mail.MailMessage.create(Array("[email protected]"),Array("[email protected]"),"Subject",
xTransferable )
But this fails. Any ideas why? I think the xTransferable isn't the
correct type, because it supports other mimetypes too.
Yes, this fails because the implementation only takes into account the
first data flavour, see
http://www.openoffice.org/api/docs/common/ref/com/sun/star/mail/XMailMessage.html#Body
"The body of the mail message. It is expected that the transferable
delivers the data as a string. Although a transferable may support
multiple data flavors only the first data flavor supplied will be used
to retrieve the data and it is expected that the data will be provided
as a string."
You can find some examples on
http://people.apache.org/~arielch/api/MailApiTest.zip (they might look
a little overcomplicated, because I used them to test some bug fixes).
Very cool stuff, thank you once again.
Regards
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]