width - 让标题仅与居中表格上的表格一样宽
问题描述
我将 XSL-FO 与 Antennahouse FO 格式化程序一起使用。
如何使元素fo:caption
中的 info:table-and-caption
只运行与 dos 一样宽fo:table
?
本质上,我正在寻找这个 HTML 的 FO 等价物:
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Image with Caption – CENTERED</title>
</head>
<body>
<div style="border:2px solid blue;">
<table style="border:1px solid green; margin-left:auto; margin-right:auto;">
<caption style="caption-side:bottom; text-align:left; border:1px solid red;"><p style="font-size:9pt;">Sourceline (left edge should match up with table's left edge, and line breaking should occur at right edge of table)</p></caption>
<tr>
<td><p><- The table runs only this wide. -></p></td>
</tr>
</table>
</div>
<p>BLUE = wrapper-DIV</p>
<p>GREEN = table</p>
<p>RED = caption</p>
</body>
</html>
看起来像这样:
我拥有的 XSL-FO 代码是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master margin-bottom="58px" margin-left="120px" margin-right="120px" margin-top="50px" master-name="content-page" page-height="11in" page-width="8.5in">
<fo:region-body margin-bottom="44px" margin-top="50px" region-name="xsl-region-body" />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="content-page">
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:table-and-caption border="2px solid blue" text-align="center">
<fo:table-caption border="1px solid red" caption-side="bottom">
<fo:block font-size="8pt" text-align="left">Sourceline (left edge should match up with table's left edge, and line breaking should occur at right edge of table)</fo:block>
</fo:table-caption>
<fo:table border="1px solid green">
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block><- The table runs only this wide. -></fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-and-caption>
</fo:block>
<fo:block>BLUE = fo:table-and-caption</fo:block>
<fo:block>GREEN = fo:table</fo:block>
<fo:block>RED = fo:caption</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
呈现如下:
如何强制(在 XSL-FO 中)表格标题仅与表格一样宽(这可能是任意复杂的,包括fo:table-footer
表格或单元格上的表格边框),并从其关联表格的左边缘开始(就像在 HTML 渲染中一样)?
解决方案
推荐阅读
- c++ - C++ — `algorithm` 库和命名空间 `std`
- python - Python为什么要导入内置
- javascript - JavaScript/Node js 导入导出模块(在 JavaScript 文件中使用导出的 node Js 模块)
- php - 使用 Lumen/Laravel 在微服务架构中的应用程序之间进行数据交换
- python - 如何避免无限的本地错误来创建大字符串?
- c# - 将 JSON 对象反序列化为 C# 对象映射
- prestashop - 如何更改时事通讯 prestashop 中的占位符?
- jquery - How to fix a custom range slider progress not following input range thumb?
- freepascal - Rotate Function for Component Drawed with Canvas Lazarus
- flutter - List which contains 10000 items, how to insert this list in cloud_firestore