speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
296 stars 36 forks source link

[2.1.26] Creating a Rahmen enclosing TextBlock and Tabelle only surrounds Tabelle #34

Closed MDeutschmann-Imperia closed 9 years ago

MDeutschmann-Imperia commented 9 years ago

The following code produces a border that encloses the table, but not the contained text. Any ideas how to create such a bounding box without placing the text in the table.

    <ObjektAusgeben spalte="1" zeile="43" vreferenz="bottom">
        <Rahmen linienstärke="0.5pt">
            <Textblock>
                <Absatz>
                  <Wert>Headline</Wert>
                </Absatz>
            </Textblock>
            <Tabelle breite="42" padding="1mm" zeilenabstand="0mm" spaltenabstand="0pt" dehnen="max">
                <Spalten>
                    <Spalte breite="7" />
                    <Spalte breite="35" />
                </Spalten> 
                    <Tr>
                        <Td><Absatz><Wert>Zelle A</Wert></Absatz></Td>
                        <Td><Absatz><Wert>Zelle B</Wert></Absatz></Td>
                    </Tr>
            </Tabelle>
        </Rahmen>
    </ObjektAusgeben>
pgundlach commented 9 years ago

I am afraid, I might misunderstand your request.

Using empty table cells, you get the table with borders but without text inside:

<Tr>
  <Td></Td>
  <Td></Td>
</Tr>

table-border

MDeutschmann-Imperia commented 9 years ago

The Rahmen-element contains two elements: TextBlock+Tabelle. Both elements ("Headline" + Tabelle with "Zelle A" + "Zelle B" should be surrounded by "Rahmen"?!

pgundlach commented 9 years ago

This is a bug. The element / Frame is very new and currently not capable of drawing a frame around multiple objects.

You can use a "Gruppe" ("Group" - a scratch page), place the two objects inside the group and draw a frame around the contents of the group. See example below.

I'd use a table for everything that needs a frame around it.

If you know the dimensions of the object, you can always use ObjektAusgeben / Linie (PlaceObject / Rule) to draw your own frame. This has the (dis-)advantage (depends on what you need) of having a rule exactly at the grid-cell borders.

<?xml version="1.0"?>
<Layout xmlns:sd="urn:speedata:2009/publisher/functions/de"
  xmlns="urn:speedata.de:2009/publisher/de">

  <SetzeRaster nx="43" ny="44"/>

  <Datensatz element="data">

    <Gruppe name="test">

      <Inhalt>
        <ObjektAusgeben>
          <Textblock breite="42">
            <Absatz>
              <Wert>Headline</Wert>
            </Absatz>
          </Textblock>
        </ObjektAusgeben>

        <ObjektAusgeben zeile="2" spalte="1">
          <Tabelle breite="42" padding="1mm" zeilenabstand="0mm" spaltenabstand="0pt" dehnen="max">
            <Spalten>
              <Spalte breite="7"/>
              <Spalte breite="35"/>
            </Spalten>
            <Tr>
              <Td>
                <Absatz>
                  <Wert>Zelle A</Wert>
                </Absatz>
              </Td>
              <Td>
                <Absatz>
                  <Wert>Zelle B</Wert>
                </Absatz>
              </Td>
            </Tr>
          </Tabelle>
        </ObjektAusgeben>
      </Inhalt>
    </Gruppe>

    <ObjektAusgeben spalte="1" zeile="43" vreferenz="bottom" rahmenfarbe="black"
      rahmen="durchgezogen" gruppenname="test"/>

  </Datensatz>
</Layout>

gives

bildschirmfoto 2014-11-03 um 14 27 41

MDeutschmann-Imperia commented 9 years ago

Thanks for sharing that workaround! In my case "Rahmen" has the advantage of growing/shriking automatically when more or less text is read from data.xml. Constructing Border based on Single Lines is more complicated when respecting amount of dynamic text, isn't it?

pgundlach commented 9 years ago

Actually I won't consider this as a workaround (at least at the moment). Multiple objects in one PlaceObject (ObjektAusgeben) is officially not supported. If you need some frames, groups (Gruppe) and Tables are a good way to go.

Using single lines with absolute positioning can be a good option, if you need the grid alignment.