Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tablehead breaks rowspan #279

Closed
Demosteneus opened this issue Nov 3, 2020 · 6 comments
Closed

Tablehead breaks rowspan #279

Demosteneus opened this issue Nov 3, 2020 · 6 comments
Assignees
Labels
Milestone

Comments

@Demosteneus
Copy link

Hi,

There is a problem with Tablehead in combination with rowspan.
In the provided zip, the Tablehead is commented out, so the produced PDF looks ok.
But when you uncomment the Tablehead, this somehow breaks the rowspan.

image

Tablehead and Rowspan.zip

@pgundlach pgundlach assigned Demosteneus and unassigned Demosteneus Nov 3, 2020
@pgundlach
Copy link
Member

There must be something fishy here. Could you somehow make a more minimal example? That would be very helpful. Thanks

@Demosteneus
Copy link
Author

Demosteneus commented Nov 3, 2020

data.xml

<table>
	<th>
		<td colspan="2" rowspan="1">H1</td>
		<td colspan="1" rowspan="1">H2</td>
		<td colspan="1" rowspan="1">H3</td>
	</th>
	<tr>
		<td colspan="1" rowspan="1">1</td>
		<td colspan="1" rowspan="1">2</td>
		<td colspan="1" rowspan="1">3</td>
		<td colspan="1" rowspan="1">4</td>
	</tr>
	<tr>
		<td rowspan="2" colspan="1">1</td>
		<td colspan="1" rowspan="1">2</td>
		<td colspan="1" rowspan="1">3</td>
		<td colspan="1" rowspan="1">4</td>
	</tr>
	<tr>
		<td colspan="1" rowspan="1">2</td>
		<td colspan="1" rowspan="1">3</td>
		<td colspan="1" rowspan="1">4</td>
	</tr>
</table>

layout.xml that prints correctly:

<Layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layoutschema-en.xsd" xmlns:sd="urn:speedata:2009/publisher/functions/en" xmlns="urn:speedata.de:2009/publisher/en" xmlns:xi="http://www.w3.org/2001/XInclude" version="4.1.14">
	<Record element="table">
		<PlaceObject>
			<Table width="170mm">
				<Columns>
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
				</Columns>
				<ForAll select="th">
					<Tr>
						<ForAll select="td">
							<Td rowspan="{@rowspan}" colspan="{@colspan}" border-left="1pt" border-right="1pt" border-top="1pt" border-bottom="1pt">
								<Paragraph>
									<Value select="string(.)"/>
								</Paragraph>
							</Td>
						</ForAll>
					</Tr>
				</ForAll>
				<ForAll select="tr">
					<Tr>
						<ForAll select="td">
							<Td rowspan="{@rowspan}" colspan="{@colspan}" border-left="1pt" border-right="1pt" border-top="1pt" border-bottom="1pt">
								<Paragraph>
									<Value select="string(.)"/>
								</Paragraph>
							</Td>
						</ForAll>
					</Tr>
				</ForAll>
			</Table>
		</PlaceObject>
	</Record>
</Layout>

image

layout.xml that prints wrongly (Has a tablehead added)

<Layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layoutschema-en.xsd" xmlns:sd="urn:speedata:2009/publisher/functions/en" xmlns="urn:speedata.de:2009/publisher/en" xmlns:xi="http://www.w3.org/2001/XInclude" version="4.1.14">
	<Record element="table">
		<PlaceObject>
			<Table width="170mm">
				<Columns>
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
				</Columns>
				<Tablehead>
				<ForAll select="th">
					<Tr>
						<ForAll select="td">
							<Td rowspan="{@rowspan}" colspan="{@colspan}" border-left="1pt" border-right="1pt" border-top="1pt" border-bottom="1pt">
								<Paragraph>
									<Value select="string(.)"/>
								</Paragraph>
							</Td>
						</ForAll>
					</Tr>
				</ForAll>
				</Tablehead>
				<ForAll select="tr">
					<Tr>
						<ForAll select="td">
							<Td rowspan="{@rowspan}" colspan="{@colspan}" border-left="1pt" border-right="1pt" border-top="1pt" border-bottom="1pt">
								<Paragraph>
									<Value select="string(.)"/>
								</Paragraph>
							</Td>
						</ForAll>
					</Tr>
				</ForAll>
			</Table>
		</PlaceObject>
	</Record>
</Layout>

image

@pgundlach pgundlach self-assigned this Nov 3, 2020
@pgundlach pgundlach added the Bug label Nov 3, 2020
@pgundlach pgundlach added this to the Version 4.2 milestone Nov 3, 2020
@pgundlach
Copy link
Member

Thanks, I'll have a look

@Demosteneus
Copy link
Author

Demosteneus commented Nov 11, 2020

Hi, I think there might be another issues involving rowspan, I will add it here in case you want to check it out.

data.xml

<Table>
	<Row>
		<Cell rowspan="1">11</Cell>
		<Cell rowspan="2">12-22</Cell>
		<Cell rowspan="1">13</Cell>
		<Cell rowspan="1">14</Cell>
	</Row>
	<Row>
		<Cell rowspan="1">21</Cell>
		<Cell rowspan="3">23-33-43</Cell>
		<Cell rowspan="1">24</Cell>
	</Row>
	<Row>
		<Cell rowspan="2">31-41</Cell>
		<Cell rowspan="1">32</Cell>
		<Cell rowspan="2">34-44</Cell>
	</Row>
	<Row>
		<Cell rowspan="1">42</Cell>
	</Row>
</Table>

layout.xml

<Layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layoutschema-en.xsd" xmlns:sd="urn:speedata:2009/publisher/functions/en" xmlns="urn:speedata.de:2009/publisher/en" xmlns:xi="http://www.w3.org/2001/XInclude" version="4.1.14">
	<Record element="Table">
		<PlaceObject>
			<Table width="170mm">
				<Columns>
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
					<Column width="42.5mm" align="center" />
				</Columns>
				<ForAll select="Row">
					<Tr>
						<ForAll select="Cell">
							<Td rowspan="{@rowspan}" border-left="1pt" border-right="1pt" border-top="1pt" border-bottom="1pt">
								<Paragraph>
									<Value select="string(.)"/>
								</Paragraph>
							</Td>
						</ForAll>
					</Tr>
				</ForAll>
			</Table>
		</PlaceObject>
	</Record>
</Layout>

Output:
image

Expected Output (done in Excel):
image

@pgundlach
Copy link
Member

Just to let you know: I am currently working on the first issue. The row spans and row heights are not calculated for the table head and foot separately. I'll then have a look at the other thing, which might be related.

@pgundlach
Copy link
Member

I have moved the second issue to #280

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants