views:

89

answers:

3

Okay, here's the deal. I am using C# with the Domino API. I have some rich text data that I want to insert into a lotus notes rich text field.

  1. NotesDocument.ReplaceItemValue just inserts the text as is with no formatting.
  2. NotesDocument.CreateRichTextItem gives me a NotesRichTextItem object that I can use for manually creating RichText (methods like AddNewLine() AddPageBreak() etc). But it does not have any kind of Parse method to get already formatted rich text data, which is what I need. I want my users to put whatever they want in there - so using the aforementioned methods is useless to me.
  3. The NotesRichTextItem.Values object throws an error when I try to add a rich text formatted string.

So now, what do I do? I guess I'm pretty much screwed here, but hoping some genius will come up with a solution. Any help much appreciated.

Thanks guys!

PS - Inserting notes rich text data or HTML data would be fine. Either one would be just as good as long as it displays proper rich text in the document and not an unformatted string.

A: 

Without knowing the details of your application, I'm not sure this would suffice. But you can store HTML as text within a Notes rich text field, and then in your Notes app display the field as "pass-through HTML". Downside is that you would not be able to do subsequent editing from the Notes client. Also, the HTML rendering engine within the Notes client is pretty poor, so you may not get anywhere near full fidelity.

If that doesn't meet your needs, you can always look into using the Notes C API (rather than the COM/API you are using). The lower level API does allow you to insert anything into a rich text field, but you will need to write the parser / converter yourself. Search for Composite Data (CD) records.

Here is a link to the API site: http://www14.software.ibm.com/webapp/download/nochargesearch.jsp?k=ALL&status=Active&q=Lotus+%22C+API%22

Ed Schembor
+1  A: 

Well, I found an answer - it's not pretty, but it works! What I did was

  1. Use the DXL Exporter to grab the xml
  2. edit it (adding the rich text) and then
  3. Delete the original document
  4. Use the DXL importer to import the edited document

Voila! :-D

Thanks anyway for such a quick response :-)

Matt
My intial trawl over the internet came to the same conclusion. You may get some inspiration from something like this link http://www.cubetoon.com/2008/notes-rich-text-manipulation-using-dxl/
giulio
A: 

Does the API not provide you with access to the various rich text classes? Perhaps they could help? For example, there are classes for NotesRichTextStyle, NotesRichTextNavigator, NotesRichTextSection, NotesRichText, and so on and so forth.

Ben Poole