LS: Richtextparagraphstyle issue

Hi,

Okay, I am at the point of blowing a fuse!

I am trying to do simple formatting of Data in a Richtext field. However, the first 4 “columns “ (outside of the array) displays correct(horizontal), but all the data after(in the array) displays vertically. I am not sure why? Please see the code. If I do it manually(using tabs in the text properties on the form, it displays some what okay)But, this is not a desirable…

Can anybody help please?

                  Dim rtpStyle As NotesRichTextParagraphStyle

	Dim pos As Long



	Dim interval As Long



	Set rtpStyle = session.CreateRichTextParagraphStyle

	pos = RULER_ONE_CENTIMETER * 0.5	

                   Call rtpStyle.SetTab(pos,1)	

	

	REM Write Fee's to doc & Set total to months array

	Dim element As Variant 

	Dim svalue As String

	Dim w As Integer 

	Redim Preserve ArrayMonth(23) '24 months

	w=0 ‘counter

	Forall value In ArrayFees

		svalue=Cstr(value)

		

			' Write to doc

		Call richText.AppendParagraphStyle(rtpStyle)

		Call richText.AddTab(1)

		Call richText.AppendText(svalue)

		w=w+1

	End Forall

Result looks like this:

Entry1 Entry2 Entry3 Entry4

ENTRY5

ENTRY6

ENTRY7

ect

OR

Entry1 Entry2 Entry3 Entry4

ENTRY5 ENTRY6 ENTRY7 ENTRY8

Subject: LS: Richtextparagraphstyle issue

If you are working with the UI you can write your data to an html file using an html table to organize your data. Then call the import method of the NotesUIDocument class to import the html file into the rich text field.

For example:

Dim htmlFile As String

Dim fileNum As Integer

htmlFile = “c:\temp\dataFile.html”

fileNum = FreeFile()

Open htmlFile for Output As fileNum

Print #fileNum, “

”

Forall value In ArrayFees

svalue=Cstr(value)

Print #fileNum, "<td>" & svalue & "</td>"

End Forall

Print #fileNum, “

”

Close fileNum

Call uiDoc.GotoField(“Your rich text field”)

Call uiDoc.Import(“HTML”, htmlFile )

Kill fileName

Subject: LS: Richtextparagraphstyle issue

I think a little background in the word processing concepts in play here would be helpful. To display tabular data, there must be a tab in the ruler (aka ParagraphStyle) to match each Entry position on a line. Each tab placed in the richtext stream will cause the entry to jump to the next tab on the ruler. In your script there is only one tab in the ruler, so formatting is hosed. Also, the tabs must be widely enough spaced so that they match up under the ruler. For example ENTRY1 should seek Tab 1 and Entry should seek Tab2 on the ruler. If the tabs are too close together, the end of ENTRY1 will push beyond Tab2 and ENTRY2 will then seek Tab3. In your example a 2 or 3 centimeter tab spacing would be appropriate.

Also, tabular data must play out on a line by line basis. You need an inner loop that plays out all the entries on each line and then calls AddNewLine. That loop must lie within an outer loop that loops on lines. Do not AppendParagraphStyle on each entry. Once before you start is sufficient.

Do work out your ruler and tab spacing in the Notes Editor before you write your script, and it will be a lot easier.

Subject: RE: LS: Richtextparagraphstyle issue

Thank you for the reponses.

Unfortunately, I am not working in the UI. But I will use that idea for the future. Great idea!

James, thanks for your info.

I am actually using an inner and outer loop. I did not post all the code.

I have discovered the reason for the odd reaction.

I used another call to the ParagraphStyle before, and this causes it to put the data on the next line.

I am still struggling with the taps and will use the ruler as you stated.

Regards

Bafie