Loading ...
Sorry, an error occurred while loading the content.

Re: align text left, center and right on same line

Expand Messages
  • hakan.lindestaf@epani.com
    Thanks, it works, but I was hoping it could have been done without the width specified. Problems can maybe occur when the center text is longer than 33 % of
    Message 1 of 7 , Mar 1, 2001
    • 0 Attachment
      Thanks, it works, but I was hoping it could have been done without
      the width specified. Problems can maybe occur when the center text is
      longer than 33 % of the width, but the other texts are short?

      /Hakan


      --- In XSL-FO@y..., MURAKAMI Shinyu <murakami@n...> wrote:
      > hakan.lindestaf@e... wrote:
      > > I'm fairly new to XSL-FO, but I seem to get how it works. But
      there
      > > is one thing that I can't seem to solve. I'm using Antenna XSL
      > > Formatter and I'm trying to have a page header like this:
      > > Left Text Center Text Right
      Text
      > >
      > > I found some examples here that suggested leaders, that works,
      but
      > > not perfectly. For example the position of the center text is
      based
      > > on the length of the left and right texts, and I want it exactly
      in
      > > the middle.
      > >
      > > The example in the XML Bible on the net suggested multiple
      fo:inline
      > > which I thought made sense, but it doesn't work, everything is
      > > aligned to left (or withever alignment comes first).
      >
      > the XML Bible...
      > http://www.ibiblio.org/xml/books/bible/updates/15.html#Inlines
      >
      > This example is wrong: text-align property cannot apply to
      fo:inline!!
      >
      > You can use fo:inline-container instead of fo:inline :
      >
      > <fo:block>
      > <fo:inline-container inline-progression-dimension="33.3%">
      > <fo:block text-align="start">
      > Left Text
      > </fo:block>
      > </fo:inline-container><fo:inline-container inline-progression-
      dimension="33.3%">
      > <fo:block text-align="center">
      > Center Text
      > </fo:block>
      > </fo:inline-container><fo:inline-container inline-progression-
      dimension="33.3%">
      > <fo:block text-align="end">
      > Right Text
      > </fo:block>
      > </fo:inline-container>
      > </fo:block>
      >
      > Or use fo:table :
      >
      > <fo:table table-layout="fixed" inline-progression-
      dimension="100%">
      > <fo:table-column column-width="33.3%"/>
      > <fo:table-column column-width="33.3%"/>
      > <fo:table-column column-width="33.3%"/>
      > <fo:table-body>
      > <fo:table-row>
      > <fo:table-cell>
      > <fo:block text-align="start">
      > Left Text
      > </fo:block>
      > </fo:table-cell>
      > <fo:table-cell>
      > <fo:block text-align="center">
      > Center Text
      > </fo:block>
      > </fo:table-cell>
      > <fo:table-cell>
      > <fo:block text-align="end">
      > Right Text
      > </fo:block>
      > </fo:table-cell>
      > </fo:table-row>
      > </fo:table-body>
      > </fo:table>
      >
      >
      > Hope this helps,
      >
      > Shinyu Murakami
    • MURAKAMI Shinyu
      ... Well, try the following:
      Message 2 of 7 , Mar 1, 2001
      • 0 Attachment
        hakan.lindestaf@... wrote:
        > Thanks, it works, but I was hoping it could have been done without
        > the width specified. Problems can maybe occur when the center text is
        > longer than 33 % of the width, but the other texts are short?

        Well, try the following:

        <fo:table table-layout="fixed" inline-progression-dimension="100%">
        <fo:table-column column-width="0%"/>
        <fo:table-column column-width="100%"/>
        <fo:table-column column-width="0%"/>
        <fo:table-body>
        <fo:table-row>
        <fo:table-cell>
        <fo:block text-align="start" wrap-option="no-wrap">
        Left Text
        </fo:block>
        </fo:table-cell>
        <fo:table-cell>
        <fo:block text-align="center">
        Center Text
        </fo:block>
        </fo:table-cell>
        <fo:table-cell>
        <fo:block text-align="end" wrap-option="no-wrap">
        Right Text
        </fo:block>
        </fo:table-cell>
        </fo:table-row>
        </fo:table-body>
        </fo:table>


        Shinyu Murakami
      • hakan.lindestaf@epani.com
        Thank you, that works exactly as I need! /Hakan ... without ... text is
        Message 3 of 7 , Mar 1, 2001
        • 0 Attachment
          Thank you, that works exactly as I need!

          /Hakan



          --- In XSL-FO@y..., MURAKAMI Shinyu <murakami@n...> wrote:
          > hakan.lindestaf@e... wrote:
          > > Thanks, it works, but I was hoping it could have been done
          without
          > > the width specified. Problems can maybe occur when the center
          text is
          > > longer than 33 % of the width, but the other texts are short?
          >
          > Well, try the following:
          >
          > <fo:table table-layout="fixed" inline-progression-dimension="100%">
          > <fo:table-column column-width="0%"/>
          > <fo:table-column column-width="100%"/>
          > <fo:table-column column-width="0%"/>
          > <fo:table-body>
          > <fo:table-row>
          > <fo:table-cell>
          > <fo:block text-align="start" wrap-option="no-wrap">
          > Left Text
          > </fo:block>
          > </fo:table-cell>
          > <fo:table-cell>
          > <fo:block text-align="center">
          > Center Text
          > </fo:block>
          > </fo:table-cell>
          > <fo:table-cell>
          > <fo:block text-align="end" wrap-option="no-wrap">
          > Right Text
          > </fo:block>
          > </fo:table-cell>
          > </fo:table-row>
          > </fo:table-body>
          > </fo:table>
          >
          >
          > Shinyu Murakami
        • hakan.lindestaf@epani.com
          Thank you very much, it s exactly what I wanted. /Hakan ... without ... text is
          Message 4 of 7 , Mar 1, 2001
          • 0 Attachment
            Thank you very much, it's exactly what I wanted.

            /Hakan



            --- In XSL-FO@y..., MURAKAMI Shinyu <murakami@n...> wrote:
            > hakan.lindestaf@e... wrote:
            > > Thanks, it works, but I was hoping it could have been done
            without
            > > the width specified. Problems can maybe occur when the center
            text is
            > > longer than 33 % of the width, but the other texts are short?
            >
            > Well, try the following:
            >
            > <fo:table table-layout="fixed" inline-progression-dimension="100%">
            > <fo:table-column column-width="0%"/>
            > <fo:table-column column-width="100%"/>
            > <fo:table-column column-width="0%"/>
            > <fo:table-body>
            > <fo:table-row>
            > <fo:table-cell>
            > <fo:block text-align="start" wrap-option="no-wrap">
            > Left Text
            > </fo:block>
            > </fo:table-cell>
            > <fo:table-cell>
            > <fo:block text-align="center">
            > Center Text
            > </fo:block>
            > </fo:table-cell>
            > <fo:table-cell>
            > <fo:block text-align="end" wrap-option="no-wrap">
            > Right Text
            > </fo:block>
            > </fo:table-cell>
            > </fo:table-row>
            > </fo:table-body>
            > </fo:table>
            >
            >
            > Shinyu Murakami
          • Nikolai Grigoriev
            Hakan, ... Yes, this results in the line wrap in the middle part. I see no way in XSL-FO to constrain the two lateral columns to be of the same width without
            Message 5 of 7 , Mar 1, 2001
            • 0 Attachment
              Hakan,

              > Thanks, it works, but I was hoping it could have been done without
              > the width specified. Problems can maybe occur when the center text is
              > longer than 33 % of the width, but the other texts are short?

              Yes, this results in the line wrap in the middle part. I see no way in XSL-FO to
              constrain the two lateral columns to be of the same width without specifying a
              fixed value for this width.

              There is one abusive way to achieve your desired effect :-). It's like this:

              <fo:list-block>
              <fo:list-item>
              <fo:list-item-label start-indent="0pt" end-indent="0pt">
              <fo:block text-align="start">Left Text</fo:block>
              </fo:list-item-label>
              <fo:list-item-body>
              <fo:list-block>
              <fo:list-item>
              <fo:list-item-label start-indent="0pt" end-indent="0pt">
              <fo:block text-align="center">Centered Text</fo:block>
              </fo:list-item-label>
              <fo:list-item-body start-indent="0pt" end-indent="0pt">
              <fo:block text-align="end">Right Text</fo:block>
              </fo:list-item-body>
              </fo:list-item>
              </fo:list-block>
              </fo:list-item-body>
              </fo:list-item>
              </fo:list-block>

              Some comments: this is a combination of two nested lists, having one item each
              (the second is embedded into the fo:list-item-body of the first). For each
              fo:list-item-label/fo:list-item-body, start-indent and end-indent are set to 0.
              Unlike tables, lists have indents counted from their parent reference area; so
              all the three text blocks _will actually overlay_ - all the three fo:blocks here
              have the same width, and are placed one over another. Then you can align text
              in each block to its respective side (note 'text-align' on blocks).

              The drawback is obvious: there's nothing to prevent pieces of text to overlap.
              Use at your own risk :-).

              This works at least in XEP and Antenna House. I admit this behaviour is really
              weird; yet it is conformant to the spec.

              Regards,
              Nikolai Grigoriev
              RenderX
            Your message has been successfully submitted and would be delivered to recipients shortly.