You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Nikolay Borisov <n....@gmail.com> on 2017/11/29 19:14:25 UTC

Aligning elements

Hello, 


I'm struggling to make fop align my elements the way I want them to be. I have the following layout: 

    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="Times-cyr">                                                                               
      <fo:layout-master-set>                                                    
          <fo:simple-page-master master-name="simpleA4" page-height="29.7cm"    
              page-width="21cm" margin-top="2cm" margin-bottom="2cm"            
              margin-left="2cm" margin-right="2cm">                             
              <fo:region-body margin-top="2.1cm"/>                              
              <fo:region-before region-name="xsl-region-before" extent="1cm"/>  
          </fo:simple-page-master>                                              
      </fo:layout-master-set>                                                   
                                                                                
      <fo:page-sequence master-reference="simpleA4">                                                                      
        <fo:flow flow-name="xsl-region-body">                                   
            <fo:block padding="5pt" border-style="solid">                       
                <fo:block >                                                     
                            <fo:block space-after="5pt">                        
                                <fo:inline >                                    
                                    Text Caption 1 N:</fo:inline>               
                                <fo:inline-container width="10em">              
                                    <fo:block border="solid thin" text-align="right">text 1</fo:block>
                                </fo:inline-container>                          
                            </fo:block>                                         
                                                                                
                            <fo:block space-after="5pt">                        
                                <fo:inline>                                     
                                    Short1 N:</fo:inline>                       
                                <fo:inline-container  width="10em">             
                                    <fo:block border="solid thin" text-align="right">text 2</fo:block>
                                </fo:inline-container>                          
                            </fo:block>                                         
                                                                                
                </fo:block>                                                                                                                                                                            
            </fo:block>                                                         
        </fo:flow>                                                              
      </fo:page-sequence>                                                       
     </fo:root>                                        


And I'd like to make the 2 inlines that contains "text 1" and "text 2" to be aligned on the same side edge. Currently due to "Short1 N" text being shorter than "Text caption 1N" then the 2 boxes are not aligned. I tried various things such as setting a margin-right on the fo:inline elements before the inline-containers. I tried playing with space-after (though I see it's not fully implemented yet according to the compliance page). I also tried using position=relative and righ/left attributes of the inline-container tags, again to no avail. I'm completely lost how am I supposed to achieve this and any help is going to be much appreciated. 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Aligning elements

Posted by ruud grosmann <r....@gmail.com>.
On 29/11/2017, Nikolay Borisov <n....@gmail.com> wrote:
> Hello,
>
>
> I'm struggling to make fop align my elements the way I want them to be. I
> have the following layout:
>


hello Nikolay,
I don't know what effect exactly you're wanting to get,
but you can try using tables or experiment with the effect of this:

 <fo:block space-after="5pt" text-align="right">
     <fo:inline>
               Short1 N:</fo:inline>
     <fo:inline-container  width="10em">
 <fo:block border="solid thin">text 2</fo:block>
</fo:inline-container>
</fo:block>


regards, Ruud

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org