I have a form named PO in my system, which the form contains a table to let user to key-in PO information. When the Approver clicks on the NOTIFY button, it will run an Agent to send the table content to the supplier’s email, and in the meanwhile, activate the fax function.
First Problem
The table in the PO form looks well, but after the content is sent by email (view in Notes Client), the table is not displayed as what I set in the agent.
In the agent, I set all the columns to be center aligned, but the content is displayed as left aligned in each column instead. And at the same time, for the ITEM DESCRIPTION column, the data will be displayed as a new line after about 12-14 characters. It means one line only displays 12-14 characters.
IN PO form, the content in ITEM Description column looks like this:
PC - Pentium IV (512 RAM …xxxxxx)
In email (notes client), the content in ITEM Description column looks like this:
PC - Pentium
IV (512 RAM
…xxxxxxxxxx)
Second Problem
when i send the table content using fax, the content of the table is printed in only 1 column (as I have 6 column in total).
It can print out the 6 table column with the width i set, but the data of each column is printed in only 1 column (in 2nd column, therefore, the data is over-written)
Subject: RichText Table and Fax Printing Problem (in Notes Client)
This is the codes taken from Domino Designer 6: A Developer’s Handbook (REDBOOK)
Example 15-9 Partial code of agent “Rich Text Creation\1. Fill in table”
(some parts have been modified)
Sub Initialize
Dim ses As New NotesSession
Dim rtf As NotesRichTextItem
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Set doc = session.DocumentContext
Dim richStyle As NotesRichTextStyle
Set richStyle = session.CreateRichTextStyle
Dim rtpStyles As NotesRichTextParagraphStyle
Set rtpStyles=ses.CreateRichTextParagraphStyle
'Setup text styles used in the document.
Dim columnHeaderStyle As NotesRichTextStyle
Set columnHeaderStyle =ses.CreateRichTextStyle()
columnHeaderStyle.Bold =True
columnHeaderStyle.Fontsize =10
columnHeaderStyle.NotesFont =rtf.GetNotesFont("Gill Sans",True)
Dim dataStyle As NotesRichTextStyle
Set dataStyle =ses.CreateRichTextStyle()
dataStyle.Bold =False
dataStyle.Fontsize =10
dataStyle.NotesFont =FONT_ROMAN
'Define an array of paragraph styles,which will
'set the width and alignment of each table column.
Dim i As Integer
Dim columnStyles(0 To 3)As NotesRichTextParagraphStyle
For i =0 To 3
Set columnStyles(i)=ses.CreateRichTextParagraphStyle
columnStyles(i).LeftMargin =0 'position relative to cell border.
columnStyles(i).FirstLineLeftMargin =0
Next
columnStyles(0).RightMargin =3.5 *RULER_ONE_CENTIMETER
columnStyles(1).RightMargin =1.5 *RULER_ONE_CENTIMETER
columnStyles(1).Alignment =ALIGN_RIGHT
columnStyles(2).RightMargin =2.5 *RULER_ONE_CENTIMETER
columnStyles(2).Alignment =ALIGN_RIGHT
columnStyles(3).RightMargin =2 *RULER_ONE_CENTIMETER
columnStyles(3).Alignment =ALIGN_RIGHT
Dim headerColor As NotesColorObject
Dim dataColor As NotesColorObject
Set headerColor =ses.CreateColorObject
Call headerColor.SetRGB(198,255,148)
Set dataColor =ses.CreateColorObject
Call dataColor.SetRGB(207,243,255)
' Display form header before displaying the table content
Set rtf = doc2.CreateRichTextItem( "Body" )
Call rtf.AppendText ("some text here")
Call rtf.AddNewline (2)
' Header - Purchase Order
richStyle.Bold = True
richStyle.FontSize = 18
Call rtf.AppendStyle(richStyle)
rtpStyle.Alignment = ALIGN_CENTER ' set the header to be center-aligned
call rtf.AppendParagraphStyle(rtpStyle)
Call rtif.AppendText ("PURCHASE ORDER")
' Body of Purchase Order
richStyle.Bold = False
richStyle.FontSize = 10
Call rtf.AppendStyle(richStyle)
rtpStyle.Alignment = ALIGN_LEFT ' set the content back to be left aligned
Call rtf.AppendParagraphStyle(rtpStyle)
Call rtf.AddNewline (2)
Call rtf.AppendText( wkbody1 )
Call rtf.AddNewline (2)
Call rtf.AppendText( plainText )
Call rtf.AddNewline (1)
'create an empty table,1+the number of data rows,4 columns,
'of fixed widths defined in the columnStyles array.
Call rtf.AppendTable(2 +Ubound(sampleData),4,,,columnStyles)
'create navigator to position the text insertion point within table cells.
Dim nav As NotesRichTextNavigator
Set nav =rtf.CreateNavigator()
'Get an object describing the table.
Dim table As NotesRichTextTable
nav.FindLastElement RTELEM_TYPE_TABLE
Set table =nav.GetElement
'Set table to use different color for the top and left column.
table.Style =TABLESTYLE_LEFTTOP
table.SetColor headerColor
table.SetAlternateColor dataColor
rtf.AppendStyle columnHeaderStyle 'this will be in effect until changed.
nav.FindNextElement RTELEM_TYPE_TABLECELL
rtf.BeginInsert nav
rtf.AppendText "Sample ID"
rtf.EndInsert
nav.FindNextElement 'defaults to last thing searched for
rtf.BeginInsert nav
rtf.AppendText "Density"
rtf.EndInsert
nav.FindNextElement
rtf.BeginInsert nav
rtf.AppendText "Melting Point"
rtf.EndInsert
nav.FindNextElement
rtf.BeginInsert nav
rtf.AppendText "Hardness"
rtf.EndInsert
'Next,place the data into the cells.
Dim column
rtf.AppendStyle dataStyle
For i =0 To Ubound(sampleData)
column =Split(sampleData(i),",")
For k =0 To 3
nav.FindNextElement
rtf.BeginInsert nav
rtf.AppendText(column(k))
rtf.EndInsert
Next
Next
i removed these 4 lines then everything works great,
rtpStyle.Alignment = ALIGN_LEFT ' set the content to be left aligned
call rtf.AppendParagraphStyle(rtpStyle)
rtpStyle.Alignment = ALIGN_CENTER ' set the content to be center aligned
call rtf.AppendParagraphStyle(rtpStyle)
probably i think i placed the codes at the wrong part (i'm new to lotus script) or perhaps, I miss out some codes after those 4 lines. Hope someone could help to correct my codes