Page 1 of 1

Column width calculation

Posted: Tue Nov 15, 2011 7:05 am
by infrax

Code: Select all

<table rows="1" cols="10" borderhspacing="0" cellhspacing="0" cellhpadding="35" color="clNone">
	<row valign="top">
		<cell width="400">
			<utext>Column1</utext>
		</cell>
		<cell width="800">
			<utext>Column2</utext>
		</cell>
		<cell width="3000">
			<utext>Column3</utext>
		</cell>
		<cell width="1000">
			<utext>Column4</utext>
		</cell>
		<cell width="500">
			<utext>Column5</utext>
		</cell>
		<cell width="1000">
			<utext>Column6</utext>
		</cell>
		<cell width="700">
			<utext>Column7</utext>
		</cell>
		<cell width="1000">
			<utext>Column8</utext>
		</cell>
		<cell width="1500">
			<utext>Column9</utext>
		</cell>
		<cell width="500">
			<utext>Column10</utext>
		</cell>
	</row>
</table>
<table rows="1" cols="2" borderhspacing="0" cellhspacing="0" cellhpadding="35" color="clNone">
	<row valign="top">
		<cell width="XXXX" />
		<cell width="800">
			<utext>SubColumn5</utext>
		</cell>
	</row>
</table>
I have 2 tables (in XML). Table1 has 10 columns, table2 has 2 columns. I want that exactly under Column5 there is SubColumn5. So start position of SubColumn5 = start position of Column5.
But I can't get the accurate position. I think this should be calculated (se XXXX in table2):
XXXX = Column1_width + Column2_width + ... + Column4_width + (cellhspacing + cellhpadding)* (4*2) - (cellhspacing_table2 + cellhpadding_table2)*2

But if used this on other columns, the calculation is not right. Subcolumn is started slightly before or after the above column.

What's wrong in my calculation?