Mombu the Computer Design Forum sponsored links

Go Back   Mombu the Computer Design Forum > Computer_Design > Iterate thru selected rows of a table
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 5th August 00:52
External User
 
Posts: 1
Default Iterate thru selected rows of a table


Hi!

I carefully read this topic, and I'm not quite sure to have well understand everything.

In your posts, I understood that you couldn't do anything on merged cells. Is that right?

I'd like to merge cells on a row, and then on a column.
To finally have something like columnspan = 3 and rowspan = 2 for example.

Is there a way I could do that?

Thanks a lot.
Anne Laure JALLON
  Reply With Quote


  sponsored links


2 5th August 00:52
peter_kahrel
External User
 
Posts: 1
Default Iterate thru selected rows of a table


To merge the first and second cells in the first row:

myTable.rows[0].cells.itemByRange(0,1).merge()


and to merge the second, third, and fourth cells in the second column:

myTable.columns[1].cells.itemByRange(1,3).merge()


Peter
  Reply With Quote
3 5th August 00:52
External User
 
Posts: 1
Default Iterate thru selected rows of a table


Thanks peter,

Imagine, I have a table with 3 columns (0 to 2) and 3 rows (0 to 2)

In fact what I'd like to do is
myTable.rows[0].cells.itemByRange(0,1).merge()
myTable.rows[1].cells.itemByRange(0,1).merge()
myTable.rows[2].cells.itemByRange(0,1).merge()

The cells available are 1:1, 1:2, 1:3, 3:1, 3:2, 3:3, because the 2:x have been merged with the 1:x

and then, I try to merge again, on an other direction :
myTable.columns[0].cells.itemByRange(0,2).merge()

now, the first cell(1:1) has properties like Colspan = 2 and rowspan=3
the other cells available are 3:1, 3:2, 3:3.
cells 1:x and 2:x have been merged with 1:1

Is it clearer?
I would like to merge cells vertically which are already merged horizontally.
  Reply With Quote
4 5th August 00:52
peter_kahrel
External User
 
Posts: 1
Default Iterate thru selected rows of a table


Anne-Laure,

It depends on where you get your coordinates from. If, as in your example, you always end up with a rectangle of merged cells, i.e. if you know the coordinates of the top-left and bottom-right cells of the rectangle, you can use someting like this:

// coordinates of the top-left cell
start = { c : 0, r : 0 } // column, row

// coordinates of the bottom-right cell
stop = { c : 1, r : 2 }

// merge cells in each row
for( i = start.r; i <= stop.r; i++ )
myTable.rows[i].cells.itemByRange( start.c, stop.c ).merge();

// merge cells in column
myTable.columns[start.c].cells.itemByRange( start.r, stop.r ).merge();


If, on the other hand, you have a table with merged cells but you don't know which, and want to merge cells downwards as long as there are merged cells below the one you've found, then you'd have to iterate through the table's cells and work from there.

Peter
  Reply With Quote
5 5th August 00:52
External User
 
Posts: 1
Default Iterate thru selected rows of a table


Thank you so much...
Anne-Laure
  Reply With Quote
6 5th August 00:52
robert tkaczyk
External User
 
Posts: 1
Default Iterate thru selected rows of a table


for me - the best way to work with cells is addressing them by (COL:ROW)

Set myCell = myTable.Cells.Item("2:5")
which mean - second column, fifth row

you don't need to care about number of cells in row or in column
you only need to be "inside" Table.Columns.Count and Table.Rows.Count

robin

--
http://www.adobescripts.com
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666