xsl-fo:fop使用table-header挂起

时间:2011-10-03 12:04:22

标签: xml pdf xsl-fo

我正在尝试使用Apache FOP版本0.94生成PDF。我想在我的模式中使用table-header,但是当我应用它时,fop挂起而没有任何消息。当我在表格体中粘贴代码时,一切正常。

     <?xml version="1.0" encoding="utf-8"?>
<x:stylesheet version="1.1" xmlns:x="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <x:output method="xml" encoding="utf-8" indent="yes" omit-xml-declaration="no"/>
  <x:template name="layout-master-set">
    <fo:layout-master-set>
      <fo:simple-page-master master-name="Portrait" margin-left="1mm" margin-right="1mm" margin-top="1mm" margin-bottom="1mm" page-width="210mm" page-height="297mm">
        <fo:region-body margin-left="15mm" margin-right="10mm" margin-top="10mm" margin-bottom="5mm"/>
        <fo:region-before border-style="none" border-width="thin" extent="15mm"/>
        <fo:region-after/>
      </fo:simple-page-master>
      <fo:simple-page-master master-name="Landscape" margin-bottom="1mm" margin-top="1mm" margin-left="1mm" margin-right="1mm" page-height="210mm" page-width="297mm">
        <fo:region-body margin-right="9mm" margin-left="15mm" margin-top="13mm" margin-bottom="6mm"/>
        <fo:region-before/>
        <fo:region-after/>
      </fo:simple-page-master>
    </fo:layout-master-set>
  </x:template>
  <x:template match="/">
    <fo:root>
      <x:call-template name="layout-master-set"/>
      <x:apply-templates select="data"/>
    </fo:root>
  </x:template>
  <x:template match="data">
    <fo:page-sequence font-family="Times"  master-reference="Landscape">
      <fo:flow flow-name="xsl-region-body">
        <fo:block font-size="9pt">
          <fo:table table-layout="fixed" width="100%" empty-cells="show">
            <fo:table-column column-number="1" column-width="9mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="2" column-width="70mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="3" column-width="16mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="4" column-width="14mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="5" column-width="14mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="6" column-width="11mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="7" column-width="11mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="8" column-width="8mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="9" column-width="10mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="10" column-width="13mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="11" column-width="17mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="12" column-width="20mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="13" column-width="11mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="14" column-width="21mm" border="black, solid, 0.3mm"/>
            <fo:table-column column-number="15" column-width="24mm" border="black, solid, 0.3mm"/>
            <fo:table-header>
              <fo:table-row font-size="8.5pt">
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center" >
                  <fo:block>Но-</fo:block>
                  <fo:block>мер</fo:block>
                  <fo:block>по</fo:block>
                  <fo:block>по-</fo:block>
                  <fo:block>рядку</fo:block>
                </fo:table-cell>
                <fo:table-cell number-columns-spanned="2" display-align="center" text-align="center">
                  <fo:block>Товар</fo:block>
                </fo:table-cell>
                <fo:table-cell number-columns-spanned="2" display-align="center" text-align="center">
                  <fo:block>Единица</fo:block>
                  <fo:block>измерения</fo:block>
                </fo:table-cell>
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center">
                  <fo:block>Вид</fo:block>
                  <fo:block>упаков-</fo:block>
                  <fo:block>ки</fo:block>
                </fo:table-cell>
                <fo:table-cell number-columns-spanned="2" display-align="center" text-align="center">
                  <fo:block>Количество</fo:block>
                </fo:table-cell>
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center">
                  <fo:block>Масса</fo:block>
                  <fo:block>брутто</fo:block>
                </fo:table-cell>
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center">
                  <fo:block>Кол-во</fo:block>
                  <fo:block>(масса</fo:block>
                  <fo:block>нетто)</fo:block>
                </fo:table-cell>
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center">
                  <fo:block>Цена,</fo:block>
                  <fo:block>руб. коп.</fo:block>
                </fo:table-cell>
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center">
                  <fo:block>Сумма без</fo:block>
                  <fo:block>учета НДС,</fo:block>
                  <fo:block>руб. коп.</fo:block>
                </fo:table-cell>
                <fo:table-cell number-columns-spanned="2" display-align="center" text-align="center">
                  <fo:block>НДС</fo:block>
                </fo:table-cell>
                <fo:table-cell number-rows-spanned="2" display-align="center" text-align="center">
                  <fo:block>Сумма с</fo:block>
                  <fo:block>учетом НДС,</fo:block>
                  <fo:block>руб. коп.</fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row font-size="8.5pt">
                <fo:table-cell column-number="2" display-align="center" text-align="center">
                  <fo:block>наименование,</fo:block>
                  <fo:block>характеристика, сорт, артикул</fo:block>
                  <fo:block>товара</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="3" display-align="center" text-align="center">
                  <fo:block>код</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="4" display-align="center" text-align="center">
                  <fo:block>наиме-</fo:block>
                  <fo:block>нование</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="5" display-align="center" text-align="center">
                  <fo:block>код по</fo:block>
                  <fo:block>ОКЕИ</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="7" display-align="center" text-align="center">
                  <fo:block>в</fo:block>
                  <fo:block>одном</fo:block>
                  <fo:block>месте</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="8" display-align="center" text-align="center">
                  <fo:block>мест,</fo:block>
                  <fo:block>штук</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="13" display-align="center" text-align="center">
                  <fo:block>ставка,</fo:block>
                  <fo:block>%</fo:block>
                </fo:table-cell>
                <fo:table-cell column-number="14" display-align="center" text-align="center">
                  <fo:block>сумма,</fo:block>
                  <fo:block>руб. коп.</fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>1</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>2</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>3</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>4</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>5</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>6</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>7</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>8</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>9</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>10</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>11</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>12</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>13</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>14</fo:block>
                </fo:table-cell>
                <fo:table-cell display-align="center" text-align="center">
                  <fo:block>15</fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-header>
            <fo:table-body>
              <fo:table-row text-align="center">
                <fo:table-cell number-columns-spanned="7" border-left="white, solid, 0.3mm" border-bottom="white, solid, 0.3mm" display-align="center" text-align="right">
                  <fo:block margin-right="1mm">Итого</fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block></fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block></fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block></fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>X</fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>
                    <x:value-of select='/data/requisites/req[@name="Total Summ wo NDS"]/@value'/>
                  </fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>X</fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>
                    <x:value-of select='/data/requisites/req[@name="Total NDS"]/@value'/>
                  </fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>
                    <x:value-of select='/data/requisites/req[@name="Total Summ"]/@value'/>
                  </fo:block>
                </fo:table-cell>
              </fo:table-row>
              <fo:table-row text-align="center">
                <fo:table-cell number-columns-spanned="7" border-left="white, solid, 0.3mm" border-bottom="white, solid, 0.3mm" display-align="center" text-align="right">
                  <fo:block margin-right="1mm">Всего по накладной </fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block></fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block></fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block></fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>X</fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>
                    <x:value-of select='/data/requisites/req[@name="Total Summ wo NDS"]/@value'/>
                  </fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>X</fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>
                    <x:value-of select='/data/requisites/req[@name="Total NDS"]/@value'/>
                  </fo:block>
                </fo:table-cell>
                <fo:table-cell>
                  <fo:block>
                    <x:value-of select='/data/requisites/req[@name="Total Summ"]/@value'/>
                  </fo:block>
                </fo:table-cell>
              </fo:table-row>
            </fo:table-body>
          </fo:table>
        </fo:block>
      </fo:flow>
    </fo:page-sequence>
  </x:template>
</x:stylesheet>

resulting document (when the table header moved to table body)

0 个答案:

没有答案