【发布时间】:2018-03-03 01:30:51
【问题描述】:
我已将代码添加到 itext sharp 以换行连续文本。这里例如一个网址。 这些 css 在 Web 浏览器中工作时工作正常,但是当我导出为 pdf 时,url 不换行。
我无法找到确切的问题。
在线和pdf视图的参考行为图片:
有没有办法用css包装url
.background-color-dark-blue {
background-color: #485679;
}
.color-light {
color: #fff !important;
}
.white-space-pre-wrap a {
word-break: break-all !important;
word-wrap: break-word;
word-wrap: break-word !important;
}
.break-all {
word-break: break-all;
word-wrap: break-word;
}
.url-style a {
/*font-size: 14px;*/
line-height: 1.3;
color: #2a99d4;
font-weight: 700;
text-decoration: none;
margin-top: 0px !important;
}
<table>
<colgroup>
<col class="col-3">
<col class="col-4">
<col class="col-5">
</colgroup>
<thead>
<tr class="background-color-dark-blue ">
<th class="color-light">
Document Name</th>
<th class="color-light">
Document Description</th>
<th class="color-light">
Location/Link</th>
</tr>
</thead>
<tbody>
<tr class="bg-color-lighter">
<td class="va-top">FATF 40 Recommendations</td>
<td class="va-top">Global standard for AML/CFT published by the Financial Action Task Force </td>
<td class="review-report-url-fix padding-left-5 break-all va-top">
<div class="break-all va-top">
<a id="SiteContentPlaceHolder_AppendicesReviewControl_ReferenceDocumentListView_ReferenceDocumentLink_0" title="http://www.fatf-gafi.org/publications/fatfrecommendations/
http://www.fatf-gafi.org/publications/fatfrecommendations/documents/risk-based-approach-banking-sector.html" class="url-style white-space-pre-wrap" href="http://www.fatf-gafi.org/publications/fatfrecommendations/%0d%0a%20http://www.fatf-gafi.org/publications/fatfrecommendations/documents/risk-based-approach-banking-sector.html" target="_blank">http://www.fatf-gafi.org/publications/fatfrecommendations/
http://www.fatf-gafi.org/publications/fatfrecommendations/documents/risk-based-approach-banking-sector.html</a>
</div>
</td>
</tr>
<tr class="bg-color-dashboard-table">
<td class="va-top">Risk Based Approach Guidance for Legal Professionals</td>
<td class="va-top">Guidance on the AML/CFT Risk Based Approach for lawyers and the legal profession</td>
<td class="review-report-url-fix padding-left-5 va-top">
<div class="break-all va-top">
<a id="SiteContentPlaceHolder_AppendicesReviewControl_ReferenceDocumentListView_ReferenceDocumentLink_1" title="http://www.fatf-gafi.org/publications/fatfrecommendations/documents/riskbasedapproachguidanceforlegalprofessionals.html" class="url-style white-space-pre-wrap" href="http://www.fatf-gafi.org/publications/fatfrecommendations/documents/riskbasedapproachguidanceforlegalprofessionals.html" target="_blank">http://www.fatf-gafi.org/publications/fatfrecommendations/documents/riskbasedapproachguidanceforlegalprofessionals.html</a>
</div>
</td>
</tr>
</tbody>
</table>
【问题讨论】:
-
只是为了确定:您使用哪个 iText 版本? 5.5.x 与
XmlWorker或 7.0.x 与HtmlConverter? -
我刚刚在 iText 支持系统中查看了最近一张工单的详细信息,您就是举报此问题的同一位客户。我负责这个问题的同事会通过 JIRA 给你一个解决方案,我们不会在 Stack Overflow 上发布解决方案。但是,一旦您从我们这里获得该解决方案,您就可以将该解决方案复制到 Stack Overflow。
-
我使用的是 Itext 7.0 版