Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs







Recent posts

Thu 29 Apr 2021

Archive a Notes DB off-line w/ Field data and active content



Tue 20 Apr 2021

Archive a Notes DB off-line in 4 easy steps



Thu 18 Mar 2021

Preservation of all the tiny details


May, 2021
SMTWTFS
      01
02 03 04 05 06 07 08
09 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31

Search the weblog





























Genii Weblog

Getting started with tables

Wed 20 Aug 2003, 11:48 PM



by Ben Langhinrichs
This "Getting started..." series of articles will show simple code snippets to demonstrate how to use common features of the Midas Rich Text LSX.  These are not meant to be full fledged samples, for which you could go to the Midas Samples page, but rather small bits of code to show how to get started.  These articles will also appear in the Reference section of the Midas Help db in somewhat altered form.


The Midas Rich Text LSX lets you create and modify tables in a number of ways.  The most common tasks are creating a table, accessing cell values, and adding rows.  Below are some quick code snippets to show these tasks.  Additional information can be found in the Working with table properties reference in the Midas Help db and in information about the individual properties and methods which relate to tables, rows and columns.

Creating a table and starting to use it
Call rtitem.ConnectBackend(doc.Handle, "Body", True)
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.AppendTable(11, 2, "TableWidth=Fit_To_Margins")
Set rtchunk = rtitem.DefineChunk("Table 1")

Setting cell values
Call rtitem.ConnectBackend(doc.Handle, "Body", True)
Set rtchunk = rtitem.DefineChunk("Table 1")
Call rtchunk.SetText("Row 1; Column 1", "Salesperson")
Call rtchunk.SetText("Row 1; Column 2", "Quota")
For i = 1 to 10
   Call rtchunk.SetText("Row " & Cstr(i+1) & "; Column 1", salesperson(i))
   Call rtchunk.SetText("Row " & Cstr(i+1) & "; Column 2", Cstr(quota(i)))
Next i
Set rtchunk = rtitem.DefineChunk("Table 1; Row 1")
rtchunk.Font = "Bold Blue"

Getting cell values
Call rtitem.ConnectBackend(doc.Handle, "Body", True)
Set rtchunk = rtitem.DefineChunk("Table 1; Row 1")
Do
   Messagebox rtchunk.GetText("Column 1") & "," & rtchunk.GetText("Column 2")
Loop Until Not rtchunk.GetNextTarget

Adding rows
Call rtitem.ConnectBackend(doc.Handle, "Body", True)
Set rtchunk = rtitem.DefineChunk("Everything")
Call rtchunk.AppendTable(1, 2, True, "Salesperson", "Quota")
Set rtchunk = rtitem.DefineChunk("Table 1")
For i = 1 to 10
   Call rtchunk.AppendRow(0, False, salesperson(i), Cstr(quota(i)))
Next i

Finding out how many rows and columns are in a table
Call rtitem.ConnectBackend(doc.Handle, "Body", True)
Set rtchunk = rtitem.DefineChunk("Table 1")
rows = rtchunk.GetCount("Row")
cols = rtchunk.GetCount("Row 1; Column")

Copyright 2003 Genii Software Ltd.

What has been said:


39.1. Alexander Zinoviev
(11/25/2003 03:36 AM)

Give me trial Midas ! Thank !