Genii Weblog


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Mon 10 Sep 2007, 11:56 AM
As others have noted already, IBM and OpenOffice.org have announced that IBM is contributing both code and resources to OpenOffice.org.  Andy Updegrove has a good writup of the facts and possible implications.

One item jumped out at me.  IBM is dedicating approximately 35 developers to this effort.  Holy cow!  I am highly tempted to point out that IBM sometimes seems resistant to dedicating one developer to Notes rich text, but that might be snarky of me.  Still, it might explain to some naysayers why I am focusing on OpenSesame these days.

Copyright © 2007 Genii Software Ltd.

Mon 10 Sep 2007, 10:09 AM
As I mentioned in my first tip today, I wanted to insert some text at the beginning of a message.  It turns out that with the Midas chunk model, this is a bit more difficult than appending at the end.  The reason is simple, but perhaps more clear if I write in pseudo-code:

[Text 1 ==>]This is the first line of my rich text, and it can go on until a paragraph break, [Text 2 ==>]or until a font or style change[Text 3 ==>], which breaks the text into multiple records.

The text above represents a paragraph, with each text record identified.  Now, let's try and insert the following

Subject: A fairly meaningless paragraph

If we go with the intuitive choice, we would have:

Set rtchunk = rtitem.DefineChunk("Text 1")
Call rtchunk.InsertText("Subject: ", "+Bold -Italic 10pt")
Call rtchunk.InsertText(doc.Subject(0)+Chr(0), "+Bold -Italic 10pt")

but let's look at what the result after each line of code

Set rtchunk = rtitem.DefineChunk("Text 1")

[Text 1 ==>]This is the first line of my rich text, and it can go on until a paragraph break, [Text 2 ==>]or until a font or style change[Text 3 ==>], which breaks the text into multiple records.

Call rtchunk.InsertText("Subject: ", "+Bold -Italic 10pt")

[Text 1 ==>]Subject: [Text 2 ==>]This is the first line of my rich text, and it can go on until a paragraph break, [Text 3 ==>]or until a font or style change[Text 4 ==>], which breaks the text into multiple records.

Call rtchunk.InsertText(doc.Subject(0)+Chr(0), "+Bold -Italic 10pt")

[Text 1 ==>]A fairly meaningless paragraph
[Text 2 ==>]Subject: [Text 3 ==>]This is the first line of my rich text, and it can go on until a paragraph break, [Text 4 ==>]or until a font or style change[Text 5 ==>], which breaks the text into multiple records.

This obviously ins't what we want, as the subject goes before the word "Subject:".  The problem is, as soon as we insert the text, the newly inserted text becomes Text 1.  The easiest solution, although it looks odd in the code, is to add the desired text in reverse:

Set rtchunk = rtitem.DefineChunk("Text 1")
Call rtchunk.InsertText(doc.Subject(0)+Chr(0), "+Bold -Italic 10pt")
Call rtchunk.InsertText("Subject: ", "+Bold -Italic 10pt")

[Text 1 ==>]Subject: [Text 2 ==>]A fairly meaningless paragraph
[Text 3 ==>]This is the first line of my rich text, and it can go on until a paragraph break, [Text 4 ==>]or until a font or style change[Text 5 ==>], which breaks the text into multiple records.

There are other ways, such as inserting a table and adding content to that, or adding something fixed, such as an anchor, and then inserting before that so that it never shifts, but I want to make clear that this is not a bug, but a feature.  (You knew that, right?)  Of course, it is also why OpenSesame offers a chunk which can become a cursor.  We have to learn, don't we?

Copyright © 2007 Genii Software Ltd.

Mon 10 Sep 2007, 10:03 AM
A question came up with a customer who was trying to export e-mails to HTML.  The rich text was exported without any difficulty, but the customer wanted to include the subject, but not render the whole form.  They tried first by simply adding to the generated HTML, but their Arabic and Turkish content didn't get translated if they added to the HTML.  My first guess was that they should use the OpeningBody= parameter, or something similar, but of course those have the same issue.

Instead, the easiest and cleanest answer is to insert whatever you want generated with the HTML into the rich text before generating.  You don't have to save it, so you don't need to worry about changing the original message, but this allows the HTML generation engine to optimize the content and translate everything into the appropriate character set.  I have used this technique before, in the Help DB for example, to add a table inside the generated HTML, but I had forgotten about this technique for foreign language insertion.

Copyright © 2007 Genii Software Ltd.