ExportRTF?

I need to generate a fax cover sheet on the fly as an attachment for an automated fax service we’re going to use. I’d like to generate an rtf file in order to keep the formatting.

I’m having some issues getting ExportRTF to work…

I’m generating mail messages in a scheduled agent and creating the rich text fields on the fly. Is it possible to use exportRTF for that? Any other suggestions?

Here’s a sample I found:

Dim Ws As New NotesUIWorkspace

Dim Doc As NotesDocument

Set Doc = Ws.CurrentDocument.Document

Dim fileSize As Long

Const file_name = “c:\temp\text.cd”

Const font_file = “c:\temp\fonts.cd”

Call MailGetMessageBodyComposite(Doc.handle , “Body”, FILE_NAME$, fileSize) ’ write to file body field

Call MailGetMessageBodyComposite(Doc.handle , “$Fonts”, font_file$, fileSize) ’ write to file font field

Call concatenate (font_file,file_name, “c:\temp\export.cd”) 'make one file

Call ExportRTF(“c:\temp\export.cd”, 0, 0, “”, “c:\temp\export.rtf” )

End Sub

export.rtf

Subject: ExportRTF ?

Hello,

Try taking a look at NotesStream class in Designer Help. Specifically the WriteText method. It has a great example and you might be able to get that to work for you.

HTH,

  • David

Subject: ExportRTF ?

this code looks quite familiar… hm.

I assume that if you create the RT items on the fly, you do not create $Fonts item (?maybe you indirectly create it), so probably you just need to export “Body” that must be much easier to do. Also – if you create RT on the fly it may not always available to other routines. Save the documents you create RT items in – at least while testing to be sure it is not caused by unavailable RT.

On the other hand you maybe are better of directly manipulating Word instead of creating Notes RT and then exporting.

Subject: RE: ExportRTF ?

was that your example I found? How 'bout that.

I just thought I could save some time – the code was already written for when I would just sent the cover sheet in the body of the message – now with a new vendor, it must be an attachment.

I’m going to have to create text files for everything I’m going to fax now! ugh.

Anyway – I’m trying to just create a simple html doc and see if I can attach that first – if that will work. So far the answer is ‘no’

Subject: RE: ExportRTF ?

yes, I think it’s my code, but I do not think you can “find it” just like that. Whatever, you do not respond to my suggestions, besides you do not say what is NOT working.

You get some errors? Or the code completes without doing anything? In the latter case maybe you have some “on error resume” added to hide all errors. Besides as you understand there are some declarations and functions this sample uses. Could you be more specific about what problems you have?

Subject: RE: ExportRTF ?

I promise you that by surfing the internet I was able to find that code – but don’t ask me how it was a long day yesterday!

Also, sorry if my last response last night was vague – I do appreciate your help and I respect everyone on this forum… I love this forum! It was just a long day.

I had already started on code to create a file via html and attaching that before I saw your response - I was making progress so I just continued.

I do want to get this to work just for my own benefit and thought your suggestion about saving the document and then deleting later would be a good place to start testing and see what happens.

Unfortunately I don’t have any code to show you at this point because I scrapped it to go in another direction. But I will put up what I have if I can get back to it today.

I’d like to just get a basic thing going using your code and creating an rtitem on the fly and see how that works.

But the declarations, and please correct me if I’m wrong, I believe you need are (thanks to the download from Julian Robichaux http://www.nsftools.com )

'** API functions we’ll be using (adjust libraries as needed for your platform)

Declare Function MailGetMessageBodyComposite Lib “nnotes” (Byval hNote As Long, _

Byval ItemName As String, Byval OutputFile As String, retFileSize As Long) As Integer

'** I found out about this one on LDD, at:

'** http://www-10.lotus.com/ldd/46dom.nsf/55c38d716d632d9b8525689b005ba1c0/f8d2104fa0fc7b9e85256bc300684368?OpenDocument

Declare Function ExportRTF Lib “nxrtf” Alias “ExportRTF” (Byval sTempFile As String, _

Byval flags As Long, hmod As Long, Byval altlibrary As String, _

Byval sRTFFile As String) As Integer

Thanks again!

Subject: RE: ExportRTF ?

well, problem is that myself i cannot remember when I wrote it and where this code could be found :slight_smile: and if you are doing it otherwise, there probably is no need to pursue this option.

BTW the declarations look correct. I normally use “As LMBCS String”, but that should make no diff in this case. Also Julian has added that optimistic comment about changing the library clause for different platforms – it is really not a universal truth, but close enough (I mean that alone may not be enough:-)