Ben Langhinrichs

Photograph of Ben Langhinrichs
E-mail address - Ben Langhinrichs







Recent posts

Tue 7 Nov 2017

CoexLinks Migrate 4.10 released



Thu 2 Nov 2017

Time to Migrate



Thu 26 Oct 2017

Modernizing your Data


August, 2003
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


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Wed 20 Aug 2003, 11:48 PM
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 Refernce 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.