我一直在使用 itextsharp,它运行良好,直到我将编辑器更改为 Telerik MVC 编辑器,如果我输入特殊字符,例如<
或>
我收到以下错误:
你调用的对象是空的。
我的程序的工作方式是使用以下脚本从 SQL Server 表中读取建议列表:
string BPRecommendation = "<span style='font-size:10;'>";
for (int i = 0; i < this.selectedVisit.Recommendations.Count; i++)
{
if (i > 0) BPRecommendation += "<br />";
BPRecommendation += this.selectedVisit.Recommendations[i].FullName +
" (" + this.selectedVisit.Recommendations[i].UserType + "):<br />";
BPRecommendation += this.selectedVisit.Recommendations[i].Comments +
".<br /><br />";
}
BPRecommendation += "</span>";
List<IElement> htmlarraylist = iTextSharp.text.html.simpleparser.HTMLWorker
.ParseToList(new StringReader(BPRecommendation), null);
//add the collection to the document
for (int k = 0; k < htmlarraylist.Count; k++)
{
paragraph.Add((IElement)htmlarraylist[k]);
}
doc.Add(paragraph);