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

border-collapse is off #260

Closed
pgundlach opened this issue Aug 3, 2020 · 7 comments
Closed

border-collapse is off #260

pgundlach opened this issue Aug 3, 2020 · 7 comments
Assignees
Labels
Milestone

Comments

@pgundlach
Copy link
Member

<data>
	<tr>
		<td rowspan="1">a</td>
		<td rowspan="1">b</td>
		<td rowspan="1">c</td>
	</tr>
	<tr>
		<td rowspan="2">1</td>
		<td rowspan="1">2</td>
		<td rowspan="2">3</td>
	</tr>
	<tr>
		<td rowspan="1">2</td>
	</tr>
</data>

layout:

<Layout
  xmlns:sd="urn:speedata:2009/publisher/functions/en"
  xmlns="urn:speedata.de:2009/publisher/en" >

  <SetGrid nx="9" height="12pt" />

  <Pageformat height="5cm" width="15cm" />

  <Record element="data">
    <PlaceObject column="1">
      <Table stretch="max" border-collapse="collapse" >
        <Columns>
          <Loop select="3">
            <Column width="1"/>
          </Loop>
        </Columns>
        <ForAll select="tr">
          <Tr break-below="yes">
            <ForAll select="td">
              <Td padding="2pt" rowspan="{ @rowspan }" border-right="6pt" border-left="6pt" border-top="6pt" border-bottom="6pt">
                <Paragraph>
                  <Value select="."/>
                </Paragraph>
              </Td>
            </ForAll>
          </Tr>
        </ForAll>
      </Table>
    </PlaceObject>
  </Record>
</Layout>

collapse

@pgundlach pgundlach added the Bug label Aug 3, 2020
@pgundlach pgundlach added this to the Version 3.10 milestone Aug 3, 2020
@pgundlach pgundlach self-assigned this Aug 3, 2020
@Demosteneus
Copy link
Contributor

Hi, I think this issue is the same I have after the fix for rowspan.
The bottom-border of the cells that span over several rows is a bit lower than other cells.

@pgundlach
Copy link
Member Author

Right. Actually your documents made me realise that there is something out of order. The only solution currently is not to use border-collapse="collapse". This seems to be a non trivial fix.

@Demosteneus
Copy link
Contributor

Yes, that works for me.

@Demosteneus
Copy link
Contributor

One more thing related to rowspan.
If there are rowspans in a table you cannot really use groups to assemble tables and check if the table still fits on the page, right?

I am getting this error where I have rowspan and used the model of assembling tables as shown in the speedata manual.

  <Error code='1'>[page 2] ...am Files\speedata-publisher\sw/lua/publisher\tabular.lua:839: attempt to perform arithmetic on a nil value
stack traceback:
	...ram Files\speedata-publisher\sw/lua/publisher\spinit.lua:45: in function 'call'
	...ram Files\speedata-publisher\sw/lua/publisher\spinit.lua:376: in function 'main_loop'
	...ram Files\speedata-publisher\sw/lua/publisher\spinit.lua:387: in main chunk
	[C]: in function 'require'
	[\directlua]:1: in main chunk</Error>

I think when you add new rows one by one, it cannot easily know how to rowspan.
I guess for this issue I need to write a workaround in the layout, right?

@pgundlach
Copy link
Member Author

@Demosteneus Do you have an example for that?

@Demosteneus
Copy link
Contributor

Attached you can see an example.
It's a bit of a mess...

The data.xml has 6 tables (copy-pasted, just for content), only table 4 has rowspan. So, at the moment it prints only first two table then it crashes.
If you delete table 4 from the data, it prints the remaining 5 tables correctly.

rowspan+table assembly.zip

@pgundlach
Copy link
Member Author

pgundlach commented Aug 4, 2020

@Demosteneus You have a logic error in your code. The table is typeset in one of the iterations with one row which has rowspan > 1 and therefore fails. (moretrs>0 in /text/table[4]/tgroup[1]/tbody[1]/tr[1]/td[1]). Next version has a better error message. You must always ensure that number of rowspan does not exceed the number of rows in the table.

.. so the answer to your question is: yes, you need to take extra steps if you add rowspan and build the table line by line.

@pgundlach pgundlach modified the milestones: Version 3.10, Version 4.2 Oct 3, 2020
@pgundlach pgundlach modified the milestones: Version 4.2, 4.4 Jan 7, 2021
@pgundlach pgundlach modified the milestones: Version 4.4, Later Jan 19, 2021
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