2017-07-27 12 views
2

我想我的XSL-FO文档中创建这种背景:如何为一行中的3个单元格创建增加的背景颜色?

Gradually increasing color for background

我模糊了敏感信息,但希望它仍然不够明显,这应该是一个灰色的颜色变从细胞到细胞增加。

这是我的代码背后:

<!-- table header --> 
      <fo:table table-layout="fixed" width="100%" background-color="#FFFFFF"> 
       <fo:table-body> 
        <fo:table-row> 
         <fo:table-cell margin-left="55pt" padding-after="10pt"> 
          <fo:block-container xsl:use-attribute-sets="boldtext"> 
           <fo:block> 
            1st column header 
           </fo:block> 
          </fo:block-container> 
         </fo:table-cell> 
         <fo:table-cell padding-left="30pt" padding-after="10pt"> 
          <fo:block-container xsl:use-attribute-sets="boldtext"> 
           <fo:block> 
            2nd column header 
           </fo:block> 
          </fo:block-container> 
         </fo:table-cell> 
         <fo:table-cell padding-left="15pt" padding-after="10pt"> 
          <fo:block-container xsl:use-attribute-sets="boldtext"> 
           <fo:block> 
            3rd column header 
           </fo:block> 
          </fo:block-container> 
         </fo:table-cell> 
        </fo:table-row> 
       </fo:table-body> 
      </fo:table> 
+0

创建一个三角形并在表格后面使用的SVG。如果你想让它像那样破碎,请在中间的单元格左右两边使用白色边框。 –

回答

1

如果使用RenderX你可以使用自己的扩展规模的背景图片。这个解决方案就是这样。它会根据行数和/或尺寸完全缩放到表格中。在你的例子中,还不清楚表中还有什么。

<fo:table table-layout="fixed" width="100%" background-image="tri.svg" background-position="bottom left" background-repeat="no-repeat" rx:background-content-width="scale-to-fit" rx:background-content-height="scale-to-fit" rx:background-scaling="non-uniform"> 
      <fo:table-body > 
       <fo:table-row> 
        <fo:table-cell> 
         <fo:block-container > 
          <fo:block> 
           1st column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell border-left="5pt solid white" border-right="5pt solid white"> 
         <fo:block-container > 
          <fo:block> 
           2nd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell> 
         <fo:block-container> 
          <fo:block> 
           3rd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
       </fo:table-row> 
       <fo:table-row> 
        <fo:table-cell> 
         <fo:block-container > 
          <fo:block> 
           1st column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell border-left="5pt solid white" border-right="5pt solid white"> 
         <fo:block-container > 
          <fo:block> 
           2nd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell> 
         <fo:block-container> 
          <fo:block> 
           3rd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
       </fo:table-row> 
       <fo:table-row> 
        <fo:table-cell> 
         <fo:block-container > 
          <fo:block> 
           1st column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell border-left="5pt solid white" border-right="5pt solid white"> 
         <fo:block-container > 
          <fo:block> 
           2nd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell> 
         <fo:block-container> 
          <fo:block> 
           3rd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
       </fo:table-row> 
       <fo:table-row> 
        <fo:table-cell> 
         <fo:block-container > 
          <fo:block> 
           1st column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell border-left="5pt solid white" border-right="5pt solid white"> 
         <fo:block-container > 
          <fo:block> 
           2nd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell> 
         <fo:block-container> 
          <fo:block> 
           3rd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
       </fo:table-row> 
       <fo:table-row> 
        <fo:table-cell> 
         <fo:block-container > 
          <fo:block> 
           1st column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell border-left="5pt solid white" border-right="5pt solid white"> 
         <fo:block-container > 
          <fo:block> 
           2nd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
        <fo:table-cell> 
         <fo:block-container> 
          <fo:block> 
           3rd column header 
          </fo:block> 
         </fo:block-container> 
        </fo:table-cell> 
       </fo:table-row> 
      </fo:table-body> 
     </fo:table> 

这导致了这个:

enter image description here

如果您正在使用FOP,目前尚不清楚,我认为这样的扩展存在,你可能会需要的大小SVG的表,如果众所周知。

+0

凯文,也许我不明白,因为我是新手,对不起。我只是想让你或下一个人知道什么是我工作的确切代码(因为只是通过复制和粘贴,它没有给我我需要的结果!),而且我不能在评论中输入我的代码。但下次我不会那么做。 – Meredydd

+0

@Meredydd您应该能够接受答案(绿色复选标记)。你问了这个问题,所以有两件事 - 提出一个有用的答案并接受答案。如果您希望添加其他有用的信息,您可以在评论中编辑问题,甚至编辑您的问题,以便对答案进行具体编辑。 –

相关问题