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
    Thank you, that works exactly as I need! /Hakan ... without ... text is
    Message 1 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 2 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 3 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.