转换时出现 Null 异常 html
Null exception while converting html
HtmlConverter converter = new HtmlConverter(mainPart);
var paragraphs = converter.Parse(textData);
解析时,当我将下面的 html 作为文本数据传递时,它显示空异常:
<div id='divgrid' style='float: left; width: 100%'>
<hr style='width: 100%; border: 5px solid;' />
<br />
<table id='tbl1' style='width: 100%; border:1px solid black; border-collapse:collapse;'>
<tr>
<td colspan='2' style='border:1px solid black; background-color: black; color: white; text-align: center'>
<h3>INFORMATION FROM CURRENT</h3>
</td>
</tr>
<tr>
<td style='border:1px solid black;'><b>Goal #: 1</b>
</td>
<td style='border:1px solid black;'><b>Specific Focus:</b> STAIRS</td>
</tr>
</table>
<br /><b>Current Level:</b> data here
<hr style='width:100%; border:.5px solid grey;' />
<br />2.0
<br />
<hr style='width:100%; border: 1px solid black;' /><b>Measurable Goal:</b> data here
<br />How will we know?
<hr style='width:100%; border:.5px solid grey;' />
<br />2.0
<br />
<hr style='width:100%; border: 1px solid black;' /><b>Benchmark/Objectives:</b> What they need to do to complete this goal?
<hr style='width:100%; border:.5px solid grey;' />
<br />2.0
<br />
<hr style='width:100%; border: 1px solid black;' />
<br />
</td>
</tr>
</table>
</div>
当我传递一些其他示例 html 数据时它起作用了。那我现在的html有什么问题?
您的 HTML 无效,文件末尾有额外的右括号:
</td></tr></table>
HtmlConverter converter = new HtmlConverter(mainPart);
var paragraphs = converter.Parse(textData);
解析时,当我将下面的 html 作为文本数据传递时,它显示空异常:
<div id='divgrid' style='float: left; width: 100%'>
<hr style='width: 100%; border: 5px solid;' />
<br />
<table id='tbl1' style='width: 100%; border:1px solid black; border-collapse:collapse;'>
<tr>
<td colspan='2' style='border:1px solid black; background-color: black; color: white; text-align: center'>
<h3>INFORMATION FROM CURRENT</h3>
</td>
</tr>
<tr>
<td style='border:1px solid black;'><b>Goal #: 1</b>
</td>
<td style='border:1px solid black;'><b>Specific Focus:</b> STAIRS</td>
</tr>
</table>
<br /><b>Current Level:</b> data here
<hr style='width:100%; border:.5px solid grey;' />
<br />2.0
<br />
<hr style='width:100%; border: 1px solid black;' /><b>Measurable Goal:</b> data here
<br />How will we know?
<hr style='width:100%; border:.5px solid grey;' />
<br />2.0
<br />
<hr style='width:100%; border: 1px solid black;' /><b>Benchmark/Objectives:</b> What they need to do to complete this goal?
<hr style='width:100%; border:.5px solid grey;' />
<br />2.0
<br />
<hr style='width:100%; border: 1px solid black;' />
<br />
</td>
</tr>
</table>
</div>
当我传递一些其他示例 html 数据时它起作用了。那我现在的html有什么问题?
您的 HTML 无效,文件末尾有额外的右括号:
</td></tr></table>