trichview.com

trichview.support




Re: Creating tables with no rows or cells


Return to index


Author

Message

Jaap-Willem van den Berg

Posted: 03/03/2005 17:41:14


What i was thinking is that you can use the colspan attribute to

calculate the amount of cells. I think it is faster then processing each

row.

For example if you have the folowing first row:

<row>

   <td colspan="2">bla</td>

   <td>bla</td>

   <td colspan="3">bla</td>

   <td>bla</td>

</row>

then you calculate the amount of cells: 2 + 1 + 3 + 1


If i'm right it is not possible that another row has more cells (or the

table is corrupt). As is think about it, all rows (when rowspans and

colspans are expanded) must have exactly the same amount of cells.


How do you load the css?


Greetings,

Jaap-Willem van den BErg



Martin Holmes wrote:

> Hi there,

>

> That's the solution I'd actually implemented, but I realized that it's

> very common to have the first row using colspan > 1 to provide a large

> heading, so the first row gives a false account of the number of cells

> per row. However, what I think I'll do is count the cells in each row,

> then use the largest number.

>

> What I'm doing is very similar to what you had to do; I'm reading XHTML

> (which is XML) using the XDOM libraries, and reconstructing a document

> from it. It's hard, but it's going to be cool when I get it working. I'm

> going to be able to use XHTML as my document storage format, with CSS

> handling all the styles.

>

> Cheers,

> Martin

>

> Jaap-Willem van den Berg wrote:

>

>> I had the same kind of problem when i generated RVXML files to be

>> imported into rv. It is difficult (though posible) when generating xml

>> with xsl-templates to know by forehand how many rows and cells you

>> will end up with. So i could not specify the amount of rows and rols

>> for a table element.

>>

>> What i did is that i changed the rvxml import tool so that it counted

>> the amount of cells in the first row, a table always has at least one

>> row. With these values you can create a table. Subsequently you can

>> add a row for each row element that is encountered.

>>

>> This worked for rvxml because each row has the same amount of cells

>> (when colspan or rowspan is used, empty cell must be added). This is

>> not the case for xhtml.But you can count the values of the colspan

>> attributes (if the are present) and the amound of td's without

>> colspan-attributes. This gives you the amount of cells each row in the

>> table must have.

>>

>> I agree that it would be nice as it would be possible to create a

>> table with no rows or cols, but maybe the solution above can help you

>> in the mean time.

>>

>> Greeting,

>> Jaap-Willem van den Berg

>>

>> Martin Holmes wrote:

>>

>>> Hi there,

>>>

>>> I'm working on building tables from an XHTML structure. What I really

>>> need to do is to create a table with no rows or cells, then add each

>>> row and cell as I go along; this is because cells may be merged

>>> (colspan or rowspan > 0), so it's not really possible to know how

>>> many cells there will be in each row. What I'd like to do is this:

>>>

>>> -Create a table with no rows or cells

>>>

>>> -For each row in my source XHTML:

>>>

>>>     -Add a row with no cells

>>>

>>>     -For each cell in the XHTML row

>>>

>>>         -Add a cell to my row, with the appropriate colspan/rowspan

>>> settings read from the XHTML

>>>

>>> The problem is that the help for TRVTableItemInfo.CreateExCreateEx

>>> says "<Row Count> and <Column Count> must be > 0", and

>>> TRVTableItemInfo.Create "creates new table with one row and one column".

>>>

>>> Is there a way to create an empty table? Is there any risk in

>>> creating a table with one row, then deleting that row?

>>>

>>> Cheers,

>>> Martin





Powered by ABC Amber Outlook Express Converter