2017-06-20 37 views
2

我嘗試使用文件XSL-FO生成PDF時出現問題。 我的XSL:在生成過程中使用塊容器導致XSL-FO錯誤PDF

`

fo:block-container position="absolute" absolute-position="absolute" top="49mm" left="24mm" width="165mm" height="30mm" > 
<fo:block> 
     <fo:table> 
       <fo:table-column column-width="79mm"/> 
       <fo:table-column column-width="80mm"/>` 

       <fo:table-body> 
        <fo:table-row height="10mm"> 
         <fo:table-cell xsl:use-attribute-sets="box" number-rows-spanned="2">        
          <fo:block> 

       <xsl:attribute name="font-weight">bold</xsl:attribute> 
       <xsl:attribute name="text-align">center</xsl:attribute> 
       <xsl:value-of select="NewDataSet/Interface/dossier_num"/> <xsl:value-of select="NewDataSet/Dossier/no_dossier"/> 
       </fo:block> 
          <fo:block> 
           <fo:table> 
            <fo:table-column />         
            <fo:table-body> 
        <fo:table-row> 
              <fo:table-cell> 
               <fo:block font-size="8pt"> 
                <xsl:attribute name="text-align">left</xsl:attribute> 
                <xsl:value-of select="NewDataSet/Interface/code_produit"/><xsl:text>: </xsl:text> 
                <xsl:value-of select="NewDataSet/Table/code_produit"/> 
               </fo:block> 
              </fo:table-cell> 
        </fo:table-row> 
             <fo:table-row> 
              <fo:table-cell> 
               <fo:block font-size="8pt"> 
                <xsl:attribute name="text-align">left</xsl:attribute> 
                <xsl:value-of select="NewDataSet/Interface/modele"/><xsl:text>: </xsl:text> 
                <xsl:value-of select="NewDataSet/Table/modele"/> 
               </fo:block> 
              </fo:table-cell> 
        </fo:table-row> 
        <fo:table-row> 
              <fo:table-cell> 
               <fo:block font-size="8pt"> 
                <xsl:attribute name="text-align">left</xsl:attribute> 
                <xsl:value-of select="NewDataSet/Interface/provenance"/><xsl:text>: </xsl:text> 
                <xsl:value-of select="NewDataSet/Table/mag_depot"/> 
               </fo:block>            
              </fo:table-cell> 
             </fo:table-row> 
             <fo:table-row> 
              <fo:table-cell> 
         <fo:block font-size="8pt"> 
                <xsl:attribute name="text-align">left</xsl:attribute> 
                <xsl:value-of select="NewDataSet/Interface/numero_serie"/><xsl:text>: </xsl:text> 
                <xsl:value-of select="NewDataSet/Table/serie"/> 
               </fo:block> 
              </fo:table-cell> 
        </fo:table-row> 
        <fo:table-row> 
              <fo:table-cell> 
         <fo:block font-size="8pt"> 
                <xsl:attribute name="text-align">left</xsl:attribute> 
                <xsl:value-of select="NewDataSet/Interface/garantie"/><xsl:text>: </xsl:text>       
          <xsl:choose> 
          <xsl:when test="/NewDataSet/Table/sous_garantie='true'"><xsl:value-of select="NewDataSet/Interface/oui"/></xsl:when> 
          <xsl:otherwise><xsl:value-of select="NewDataSet/Interface/non"/></xsl:otherwise> 
          </xsl:choose>            
               </fo:block>            
              </fo:table-cell> 
             </fo:table-row> 
             <fo:table-row> 
              <fo:table-cell> 
         <fo:block font-size="8pt"> 
                <xsl:attribute name="text-align">left</xsl:attribute> 
                <xsl:value-of select="NewDataSet/Interface/marque"/><xsl:text>: </xsl:text> 
                <xsl:value-of select="NewDataSet/Table/marque"/> 
               </fo:block> 
              </fo:table-cell>            
             </fo:table-row> 
             <fo:table-row>           
              <fo:table-cell> 
               <fo:block font-weight="bold" text-align="right"> 
                <xsl:value-of select="NewDataSet/Table/nom"/><xsl:text> </xsl:text> 
                <xsl:value-of select="NewDataSet/Table/prenom"/> 
               </fo:block>            
              </fo:table-cell> 
             </fo:table-row> 
            </fo:table-body> 
           </fo:table> 
          </fo:block> 
         </fo:table-cell>   
      <fo:table-cell> 
       <fo:table> 
       <fo:table-column column-width="40mm"/> 
       <fo:table-column column-width="40mm"/> 

       <fo:table-body> 
        <fo:table-row height="14mm"> 
        <fo:table-cell display-align="center"> 
         <fo:block font-weight="bold" text-align="center"> 

         <xsl:value-of select="NewDataSet/Dossier/no_dossier"/> 

         </fo:block> 
         <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of> 
         </fo:block> 
        </fo:table-cell> 
        <fo:table-cell display-align="center"> 
         <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Dossier/no_dossier"/> 

         </fo:block> 
         <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of> 
         </fo:block> 
        </fo:table-cell> 
        </fo:table-row > 
        <fo:table-row height="14mm">         
        <fo:table-cell display-align="center"> 
        <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Dossier/no_dossier"/> 

        </fo:block> 
        <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of> 
        </fo:block> 
        </fo:table-cell> 
        <fo:table-cell display-align="center"> 
        <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Dossier/no_dossier"/> 
        </fo:block> 
        <fo:block font-weight="bold" text-align="center"> 
         <xsl:value-of select="NewDataSet/Table/code_produit"></xsl:value-of> 
        </fo:block> 
        </fo:table-cell> 
       </fo:table-row> 
       </fo:table-body> 
      </fo:table> 
      </fo:table-cell> 
        </fo:table-row> 
       </fo:table-body> 
      </fo:table> 
`</fo:block> 
</fo:block-container> 

`

我有這樣的錯誤:對類型「org.apache型 'org.apache.fop.layout.BlockArea' 的 不可能投對象。 fop.layout.AreaContainer

當我嘗試在使用相同dll(apachefop.net)的其他項目中生成時,我沒有錯誤。 如何更換此節點?我怎麼解決這個問題 ?

謝謝

回答

1

你有fo:table作爲孩子fo:表格單元格。將該表格封裝在一個塊中。

+0

你好,不,我可以刪除fo:block-container中的所有內容,我有同樣的問題。但是,當我刪除塊容器時,問題消失。 –