REPOST: Is it possible to change paragraph style?

Is it possible to change paragraph style using the new R6 Rich Text LotusScript classes? I am trying to programmatically modify the alignment of rich text fields from “left” to “center”, and it seems that this is not possible, although it is very easy to change text style (font size, etc). Your help will be greatly appreciated.

Thanks

Subject: RE: Can I change paragraph style of existing rich text?

The back-end classes, as you have noticed, don’t include a method for changing the paragraph style of existing text. I’ve tried to find a way to do this also, with no success.

If you can assume that the paragraph doesn’t contain any information that you can’t see using the rich text classes, such as images or URL links, then you can delete the text and reinsert it with a new style. This may get you an extra, undesired prargraph break, but you can go back and delete that.

Another choice is to export the document in DXL, change the DXL and re-import it.

Or, you can use the C/C++ Notes API or a 3rd-party tool based on that API, such as Midas Rich Text LSX from www.geniisoft.com.

Subject: thanks

Subject: Re: REPOST: Is it possible to change paragraph style?

i thought I had discovered a way around this problem with the method RichTextItem.beginInsert().

I tried this

moreText=navigator.findNextElement(RichTextItem.RTELEM_TYPE_TEXTPARAGRAPH);

               richText.beginInsert(navigator);

                richText.appendParagraphStyle(paragraphStyle);

Unfortunately this results in:

NotesException: Method is not available

at lotus.domino.local.RichTextItem.NappendParagraphStyle(Native Method)



at lotus.domino.local.RichTextItem.appendParagraphStyle(Unknown Source)

So yeah, it looks like its impossible.

Subject: RE: Re: REPOST: Is it possible to change paragraph style?

I have the workaround for Method is not available:

First, you “touch” all the paragraphs:

If rtnav.FindFirstElement (RTELEM_TYPE_TEXTPARAGRAPH) Then

			Do

				Call rtitem.BeginInsert (rtnav)

				Call rtitem.AppendText ("")

				Call rtitem.EndInsert

			Loop	While rtnav.FindNextElement (RTELEM_TYPE_TEXTPARAGRAPH)

		End If

Now you can append the style:

If rtnav.FindFirstElement (RTELEM_TYPE_TEXTPARAGRAPH) Then

			Do

				Call rtitem.BeginInsert (rtnav)

				Call rtitem.AppendParagraphStyle(rtpStyle)

				Call rtitem.EndInsert

			Loop	While rtnav.FindNextElement (RTELEM_TYPE_TEXTPARAGRAPH)

		End If

Subject: I suggest you read the documentation a little better. To point you in the right direction…

Look at the NotesRichTextParagraphStyle.Alignment property.Example

Represents rich text paragraph attributes.

Note This class is new with Release 5.

Containment

Contained by: NotesSession

Contains: NotesRichTextTab

Properties

Alignment

FirstLineLeftMargin

InterLineSpacing

LeftMargin

Pagination

RightMargin

SpacingAbove

SpacingBelow

Tabs

Methods

ClearAllTabs

SetTab

SetTabs

Creation

To create a new NotesRichTextParagraphStyle object, use the CreateRichTextParagraphStyle method in NotesSession.

Access

Use a NotesRichTextParagraphStyle object with the AppendParagraphStyle method in NotesRichTextItem.

Subject: But, that only works for new paragraphs

Either you need to re-create the rich text with the new style or look at something like our Midas Rich Text LSX (http://www.GeniiSoft.com) to change existing paragraph styles.