How to format pdf or excel with itextsharper from Asp.net Control -


i want generate report in pdf,excel format. have used asp.net repeater control data binding. using itextsharp. rendered, page control pdf , excel format.

code:

stringwriter sw2 = new stringwriter(); htmltextwriter hw2 = new htmltextwriter(sw2); this.rptbillreport.rendercontrol(hw2);  paragraph report = new paragraph(); using (stringreader sr2 = new stringreader(sw2.tostring())) {     //parse , collection of elements     list<ielement> elements2 = itextsharp.text.html.simpleparser.htmlworker.parsetolist(sr2, null);     foreach (ielement val2 in elements2)     {         //add elements paragraph         report.add(val2);     } }  document pdfdoc = new document(itextsharp.text.pagesize.a4,                          30f, 30f, 30f, 0.0f);  pdfwriter.getinstance(pdfdoc, response.outputstream); pdfdoc.open(); //htmlparser.parse(sr);  pdfdoc.add(report);  pdfdoc.close(); response.write(pdfdoc); response.end(); 

my question here is:
how format report, adding border , other style in both pdf , excel? not showing on current report.

thanks, added stylesheet this:

 stylesheet styles= new stylesheet();             styles.loadtagstyle("#rptbillreport", "height", "30px");             styles.loadtagstyle("#rptbillreport", "font-weight", "bold");             styles.loadtagstyle("#rptbillreport", "font-family", "cambria");             styles.loadtagstyle("#rptbillreport", "font-size", "20px");             styles.loadtagstyle("#rptbillreport", "background-color", "white");          htmlworker htmlparser = new htmlworker(pdfdoc);         htmlparser.setstylesheet(styles);          pdfwriter.getinstance(pdfdoc, response.outputstream);         pdfdoc.open();         htmlparser.parse(sr);         pdfdoc.close(); 

it worked.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -