2017-12-15 20 views
1

私はこのテキストの左側にアイコンを含むテキストを含むブロックを持っています。ブロックに1行のテキストしか含まれていない場合、アイコンはテキストブロックよりも高くなります。次のテキストブロックが同じ構造を有する場合、アイコンは互いに重なり合う。私はそれを避けようとしています。私はclear="both"を使ってみました - しかし、フロートの左右にのみ適用され、上または下には適用されません。浮動小数点は隣接するブロックと重なっています

どうすればアイコンが重なり合うのを避けることができますか?

<fo:block clear="both" start-indent="0mm" border="1pt solid black"> 
    <fo:float float="left" clear="both" > 
     <fo:block-container position="absolute" left="5mm" width="10mm" height="12mm" clear="both"> 
      <fo:block> 
       <fo:external-graphic src="Icon.pdf" width="10mm" height="10mm" content-width="scale-to-fit"/> 
      </fo:block> 
     </fo:block-container> 
    </fo:float> 

    <fo:block margin-left="25mm" clear="both"> 
     <fo:block> 
      <xsl:text>text is inserted here</xsl:text> 
     </fo:block> 
    </fo:block> 
</fo:block> 
<fo:block clear="both" start-indent="0mm" border="1pt solid black"> 
    <fo:float float="left" clear="both" > 
     <fo:block-container position="absolute" left="5mm" width="10mm" height="12mm" clear="both"> 
      <fo:block> 
       <fo:external-graphic src="Icon.pdf" width="10mm" height="10mm" content-width="scale-to-fit"/> 
      </fo:block> 
     </fo:block-container> 
    </fo:float> 

    <fo:block margin-left="25mm" clear="both"> 
     <fo:block> 
      <xsl:text>text is inserted here</xsl:text> 
     </fo:block> 
    </fo:block> 
</fo:block> 

答えて

2

アイコン画像の重複を避けるために、あなたの希望が、それはfoを使用することをお勧めされていない場合:@位置でブロックコンテナは=」絶対」それは地域のクラスを生成するので、 『XSL:絶対』は影響しません。主なテキストフローは@clear属性は有効ではありません。 要件が次の場合:

  1. テキストの左にアイコンイメージを置きます。
  2. アイコンイメージとテキストの同じシーケンス間のイメージ重複を避けます。

より単純なfo:list-blockフォーマットオブジェクトを使用し、アイコンイメージをfo:list-item-labelに配置し、テキストをfo:list-item-body/fo:blockに配置する方がよいでしょう。ここで は、上記ベースのサンプル実装です:

<fo:list-block provisional-distance-between-starts="25mm" provisional-label-separation="1mm"> 
    <fo:list-item relative-align="before" border="1pt solid black" space-before="1mm"> 
     <fo:list-item-label end-indent="label-end()"> 
      <fo:block> 
       <fo:external-graphic src="icon.png" width="10mm" height="10mm" content-width="scale-to-fit"/> 
      </fo:block> 
     </fo:list-item-label> 
     <fo:list-item-body start-indent="body-start()"> 
      <fo:block>text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here text is inserted here</fo:block> 
     </fo:list-item-body> 
    </fo:list-item> 
    <fo:list-item relative-align="before" border="1pt solid black" space-before="1mm"> 
     <fo:list-item-label end-indent="label-end()"> 
      <fo:block start-indent="0mm"> 
       <fo:external-graphic src="icon.png" width="10mm" height="10mm" content-width="scale-to-fit"/> 
      </fo:block> 
     </fo:list-item-label> 
     <fo:list-item-body start-indent="body-start()"> 
      <fo:block>text is inserted here text is inserted here</fo:block> 
     </fo:list-item-body> 
    </fo:list-item> 
    <fo:list-item relative-align="before" border="1pt solid black" space-before="1mm"> 
     <fo:list-item-label end-indent="label-end()"> 
      <fo:block start-indent="0mm"> 
       <fo:external-graphic src="icon.png" width="10mm" height="10mm" content-width="scale-to-fit"/> 
      </fo:block> 
     </fo:list-item-label> 
     <fo:list-item-body start-indent="body-start()"> 
      <fo:block>text is inserted here text is inserted here</fo:block> 
     </fo:list-item-body> 
    </fo:list-item> 
</fo:list-block> 

組版結果:

Formatting result via AH Formatter

+0

私の代わりにも作品リスト・ブロック、テーブルを使用して、同様の何かをしました。 position = "absolute"を取り除いたときのfo:floatの動作を確認したい。 – Hobbes

関連する問題