c# - Passing a string gives a different ourcome to passing a string variable -
i tried finding answer .
i have function supposed create formatted paragraph. when pass html string "<b>test</b>"
bold text in pdf expected.
however when pass string variable same value don't formatted text instead original string in pdf.
private paragraph createsimplehtmlparagraph(string text) { //our return object paragraph p = new paragraph(); //parsetolist requires streamreader instead of text using (stringreader sr = new stringreader(text)) { //parse , collection of elements list<ielement> elements = itextsharp.text.html.simpleparser.htmlworker.parsetolist(sr, null); foreach (ielement e in elements) { //add elements paragraph p.add(e); } } //return paragraph return p; }
thanks guys. checked variable @ runtime , in html format (eg: <
instead of <
). had use httputility.htmldecode function on variable , worked out perfectly.
Comments
Post a Comment