XSL-FO:边框由星号组成

时间:2014-05-27 10:17:39

标签: border xsl-fo

在XSL-FO中,可以使fo:block具有可以是实线或虚线等的边框。是否可以制作由星号(*)组成的边框?

*****************
*               *
*  some text    *
*               *
*****************

1 个答案:

答案 0 :(得分:0)

我一直用SVG图像作为背景。您可以改变角落,侧面,顶部和底部的图像均匀。基本上用一个中心单元格放置一个表格,然后放在中间单元格中,无论你想要什么。如果您的图案可能被切断,您可能需要稍微调整内部单元格。像这样:

            <fo:table>
                <fo:table-column column-width="1pt"/>
                <fo:table-column/>
                <fo:table-column column-width="1pt"/>
                <fo:table-body>
                    <!-- Put background behind this top row -->
                    <fo:table-row background-image="diamond.svg"
                        rx:background-content-height="scale-to-fit" background-repeat="repeat-x">
                        <fo:table-cell number-columns-spanned="3">
                            <fo:block line-height="1pt">
                                <fo:leader/>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <fo:table-row>
                        <!-- Put backround behind this left cell -->
                        <fo:table-cell background-image="diamond.svg"
                            rx:background-content-width="scale-to-fit"
                            background-repeat="repeat-y">
                            <fo:block>
                                <fo:leader/>
                            </fo:block>
                        </fo:table-cell>
                        <fo:table-cell>
                            <!-- Tweak height here -->
                            <fo:block-container margin-top="0.4pt" margin-bottom="0.4pt">
                                <fo:table text-align="center">
                                    <fo:table-column column-width="100%"/>
                                    <fo:table-body>
                                        <fo:table-row>
                                            <fo:table-cell text-align="center">
                                            <fo:block margin="18pt"> Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here. Put
                                            all your content in here. Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here. Put
                                            all your content in here. Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here. Put
                                            all your content in here. Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here. Put
                                            all your content in here. Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here. Put
                                            all your content in here. Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here. Put
                                            all your content in here. Put all your content in
                                            here. Put all your content in here. Put all your
                                            content in here. Put all your content in here.
                                            </fo:block>
                                            </fo:table-cell>
                                        </fo:table-row>
                                    </fo:table-body>
                                </fo:table>
                            </fo:block-container>
                        </fo:table-cell>
                        <!-- Put backround behind this right cell -->
                        <fo:table-cell background-image="diamond.svg"
                            rx:background-content-width="scale-to-fit"
                            background-repeat="repeat-y">
                            <fo:block>
                                <fo:leader/>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                    <!-- Put background behind this bottom row -->
                    <fo:table-row background-image="diamond.svg"
                        rx:background-content-height="scale-to-fit" background-repeat="repeat-x">
                        <fo:table-cell number-columns-spanned="3">
                            <fo:block line-height="1pt">
                                <fo:leader/>
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>

产生这样的东西:

enter image description here