Home       About Genii       Products       Downloads       News & Events       Support       Weblog   
July, 2009
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
July, 2009
June, 2009
May, 2009
April, 2009
March, 2009
February, 2009

Show all 75 months


Search the weblog

Ben Langhinrichs
E-mail address - Ben Langhinrichs

Photograph of Ben Langhinrichs



©2003-2009 Genii Software Ltd. All rights reserved. The rights to all logos, images, etc. are owned by their respective owners.

The views expressed in this weblog are mine alone, but since I am President and Owner, they necessarily also reflect the views of Genii Software, Ltd.
Genii Weblog
Genii Weblog

Getting started with tables

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.

What has been said:

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

Give me trial Midas ! Thank !

Have your say:

Name *:
E-mail:
e-mail addresses will not be displayed on this site
Notify me of other comments

Comment *:


<HTML is not allowed>
Linking: Add links as {{http://xxx|title}}, and they will be activated once approved
Blocked? Unable to post a comment? Please read this for a possible explanation...

Copyright © 1996-2009 Genii Software Ltd. All Rights Reserved. Some images courtesy of BigFoto.com  Nedstat