LOTUSSCRIPT /COM/OLE のクラス
例:AppendTable メソッド
1. 次のエージェントは、リッチテキストアイテムでのユーザーの入力内容に応じて、基本的な表またはタブで区切った表を作成します。
%INCLUDE "lsconst.lss"
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim doc As New NotesDocument(db)
Call doc.AppendItemValue("From", session.UserName)
Call doc.AppendItemValue _
("Subject", Inputbox("Subject?"))
Dim rti As New NotesRichTextItem(doc, "Body")
Call rti.AppendText("Paragraph of text")
Call rti.AddNewLine(2)
Dim rows As Integer, columns As Integer
rows = 4
columns = 3
Dim tabs() As String
If Messagebox("Do you want a tabbed table?", _
MB_YESNO + MB_ICONQUESTION, "Tabbed?")= IDNO Then
Call rti.AppendTable(rows, columns)
Else
Redim tabs(1 To rows)
For i = 1 To rows
tabs(i) = "Row " & i
Next
Call rti.AppendTable(rows, columns, tabs)
End If
Call doc.Save(True, False)
End Sub
2. 次のビューアクションは、4 つの行と 3 つの列で構成された基本的な自動幅の表を作成し、配置します。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
REM Create document with Body rich text item
Dim doc As New NotesDocument(db)
Call doc.ReplaceItemValue("Form", "Main topic")
Call doc.ReplaceItemValue("Subject", "Table 4 x 3")
Dim body As New NotesRichTextItem(doc, "Body")
REM Create table in Body item
rowCount% = 4
columnCount% = 3
Call body.AppendTable(rowCount%, columnCount%)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = body.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 4 Step 1
For iColumn% = 1 To 3 Step 1
Call body.BeginInsert(rtnav)
Call body.AppendText("Row " & iRow% & ", _
Column " & iColumn%)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
REM Save document and refresh view
Call doc.Save(True, False)
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
End Sub
3. 次のビューアクションは、4 つの行と 3 つの列で構成された左余白が 1.5 インチ (デフォルトは 1 インチ) の基本的な自動幅の表を作成し、配置します。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
REM Create document with Body rich text item
Dim doc As New NotesDocument(db)
Call doc.ReplaceItemValue("Form", "Main topic")
Call doc.ReplaceItemValue("Subject", "Table 4 x 3")
Dim body As New NotesRichTextItem(doc, "Body")
REM Create table in Body item
rowCount% = 4
columnCount% = 3
Call body.AppendTable(rowCount%, columnCount%,, _
RULER_ONE_INCH * 1.5)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = body.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 4 Step 1
For iColumn% = 1 To 3 Step 1
Call body.BeginInsert(rtnav)
Call body.AppendText("Row " & iRow% & ", _
Column " & iColumn%)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
REM Save document and refresh view
Call doc.Save(True, False)
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
End Sub
4. 次のビューアクションは、4 つの行と 3 つの列で構成された基本的な表を作成し、配置します。各列の幅は 1.5 インチで固定します。表の左余白は 1.5 インチです。
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
REM Create document with Body rich text item
Dim doc As New NotesDocument(db)
Call doc.ReplaceItemValue("Form", "Main topic")
Call doc.ReplaceItemValue("Subject", "Table 4 x 3")
Dim body As New NotesRichTextItem(doc, "Body")
REM Create table in Body item
rowCount% = 4
columnCount% = 3
Dim styles(1 To 3) As NotesRichTextParagraphStyle
For i% = 1 To 3 Step 1
Set styles(i%) = session.CreateRichTextParagraphStyle
styles(i%).LeftMargin = 0
styles(i%).FirstLineLeftMargin = 0
styles(i%).RightMargin = RULER_ONE_INCH * 1.5
Next
Call body.AppendTable _
(rowCount%, columnCount%,, RULER_ONE_INCH * 1.5, styles)
REM Populate table
Dim rtnav As NotesRichTextNavigator
Set rtnav = body.CreateNavigator
Call rtnav.FindFirstElement(RTELEM_TYPE_TABLECELL)
For iRow% = 1 To 4 Step 1
For iColumn% = 1 To 3 Step 1
Call body.BeginInsert(rtnav)
Call body.AppendText("Row " & iRow% & ", Column " & iColumn%)
Call body.EndInsert
Call rtnav.FindNextElement(RTELEM_TYPE_TABLECELL)
Next
Next
REM Save document and refresh view
Call doc.Save(True, False)
Dim ws As New NotesUIWorkspace
Call ws.ViewRefresh
End Sub
関連項目
AppendTable メソッド
用語集
フィードバック
ヘルプ
または
プロダクトユーザビリティ
ヘルプの使い方
すべてのヘルプ項目
用語集