2017-12-15 4 views
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