问题描述
我正在使用“jspdf-html2canvas”和一个包含大量文本的文本字段,位于页面的右侧。我尝试了太多要列出的东西,试图让它在多行上换行,但没有任何效果。这是当前的代码:
<div id="page" >
<div className="page page-1">
<br />
<table>
<tbody>
<tr>
<th>EIA Ref</th>
</tr>
<tr>
<td>{this.state.PolicyOwnerTitle}</td>
</tr>
</tbody>
</table>
</div>
<div className="page page-2" >
<br />
<table >
<tr >
<td>{this.state.Beneficiaries}</td> //this is the one!
</tr>
</table>
</div>
public documentPrint2 = (e) => {
const pages = document.getElementsByClassName('page');
html2PDF(pages,{
jsPDF: {
unit: 'px',format: 'a4',orientation: 'p',},html2canvas: {
imageTimeout: 15000,logging: true,useCORS: false,windowWidth: '1000px',margin: {
margin: {
top: 0,right: 0,bottom: 0,left: 0,imageType: 'image/jpeg',imageQuality: 1,output: this.state.PPName+'.pdf',});
}
这是正在发生的事情:
有人知道我如何包装字段吗?
更新:我可以将文本放入 html 中的 a 中,这样文本将在包装在框中时出现,但是当生成 pfg 时,它仍然在一行中显示文本。
进一步更新:如果我只在 html 中输入文本(例如一段很长的文本),它工作正常。问题是如果我使用 {this.state.Beneficiaries}
我还有什么选择??!!!
解决方法
解决了。只需将 SharePoint 中的列更改为纯文本即可。不知道为什么它用富文本或增强文本来做到这一点。