Closed emanuelemaz closed 2 years ago
For this specific case, i could do a temporary fix playing with XSLT.
If you are struggling with the same problem, try to place two adjacent tables, and wrap the values of the rows/cells with a switch case. The test attribute should be "position() mod 2 != 0" at the first and "position() mod 2 = 0" at the second. Also you have more freedom chosing the table borders.
MWE: <Layout xmlns="urn:speedata.de:2009/publisher/en" xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Pagetype name="page" test="true()">
<Margin left="15mm" right="15mm" top="15mm" bottom="15mm" />
<PositioningArea name="table">
<PositioningFrame width="10" height="15" row="1" column="1" />
<PositioningFrame width="10" height="15" row="1" column="11" />
</PositioningArea>
</Pagetype>
<SetGrid nx="20" ny="20"/>
<Record element="sheet">
<PlaceObject area="table">
<Table stretch="max" width="10">
<Tablehead>
<Tr minheight="1">
<Td>
<Paragraph>
<Value>Food</Value>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value>Qt</Value>
</Paragraph>
</Td>
</Tr>
</Tablehead>
<ForAll select="foodlist/food">
<Switch>
<Case test="position() mod 2 != 0">
<Tr minheight="1">
<Td>
<Paragraph>
<Value select="name"/>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value select="qt"/>
</Paragraph>
</Td>
</Tr>
</Case>
</Switch>
</ForAll>
</Table>
<Table stretch="max" width="10">
<Tablehead>
<Tr minheight="1">
<Td>
<Paragraph>
<Value>Food</Value>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value>Qt</Value>
</Paragraph>
</Td>
</Tr>
</Tablehead>
<ForAll select="foodlist/food">
<Switch>
<Case test="position() mod 2 = 0">
<Tr minheight="1">
<Td>
<Paragraph>
<Value select="name"/>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value select="qt"/>
</Paragraph>
</Td>
</Tr>
</Case>
</Switch>
</ForAll>
</Table>
</PlaceObject>
</Record>
Actual result (odd):
Actual result (even):
Thank you very much for the bug report. I apologise for not taking any action, I'll be back in the office beginning of Jan 2022.
Do you by any chance still have the data for the given layout?
The data.xml file (In the previous example I changed the tag names but the structure is the same):
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/styles/f.xsl"?>
<scheda>
<info>
<nome>Name</nome>
<cognome>Surname</cognome>
<data>17/12/2021</data>
</info>
<alimenti>
<alimento>
<nome>Pane</nome>
<quantita>2kg</quantita>
</alimento>
<alimento>
<nome>Latte</nome>
<quantita>3lt</quantita>
</alimento>
<alimento>
<nome>Marmellata</nome>
<quantita>1</quantita>
</alimento>
<alimento>
<nome>Farina</nome>
<quantita>1kg</quantita>
</alimento>
<alimento>
<nome>Fette biscottate</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Carne in scatola</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Succhi di frutta</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Olio di girasole</nome>
<quantita>1</quantita>
</alimento>
<alimento>
<nome>Fagioli in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Ceci in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Biscotti</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Parmigiano</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Marmellata</nome>
<quantita>1</quantita>
</alimento>
<alimento>
<nome>Farina</nome>
<quantita>1kg</quantita>
</alimento>
<alimento>
<nome>Fette biscottate</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Carne in scatola</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Succhi di frutta</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Olio di girasole</nome>
<quantita>1</quantita>
</alimento>
<alimento>
<nome>Fagioli in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Ceci in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Biscotti</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Parmigiano</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Fagioli in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Ceci in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Biscotti</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Parmigiano</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Biscotti</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Parmigiano</nome>
<quantita>4</quantita>
</alimento>
<alimento>
<nome>Fagioli in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Ceci in scatola</nome>
<quantita>2</quantita>
</alimento>
<alimento>
<nome>Biscotti</nome>
<quantita>3</quantita>
</alimento>
<alimento>
<nome>Parmigiano</nome>
<quantita>4</quantita>
</alimento>
</alimenti>
</scheda>
A slightly shorter version of all (to be used as a test case):
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Trace objects="yes" grid="yes"/>
<Pagetype name="page" test="true()">
<Margin left="15mm" right="15mm" top="15mm" bottom="15mm" />
<PositioningArea name="table">
<PositioningFrame width="10" height="15" row="1" column="1" />
<PositioningFrame width="10" height="15" row="1" column="11" />
</PositioningArea>
</Pagetype>
<SetGrid nx="20" ny="20"/>
<Record element="data">
<PlaceObject area="table">
<Table balance="yes" stretch="max">
<Tablehead>
<Tr minheight="1">
<Td>
<Paragraph>
<Value>T</Value>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value>T</Value>
</Paragraph>
</Td>
</Tr>
</Tablehead>
<Loop select="28">
<Tr minheight="1">
<Td>
<Paragraph>
<Value>A</Value>
</Paragraph>
</Td>
<Td>
<Paragraph>
<Value>A</Value>
</Paragraph>
</Td>
</Tr>
</Loop>
</Table>
</PlaceObject>
</Record>
</Layout>
This has two errors:
a) an additional page is being created b) balancing is not correct
Thank you very much for your helpful bug report! This is now fixed in version 4.7.2 which is available for download now.
I am working to a table spread across 2 columns which fit the entire page (margin excluded), and the balance property on the table overassign one item to the first column.
MWE: <Layout xmlns="urn:speedata.de:2009/publisher/en" xmlns:sd="urn:speedata:2009/publisher/functions/en">
Actual result:
I am using the 4.6.0 version.