0
我试图在我的网页中使用itextsharp将包含数据的面板包含在标签和GridView中。但是,如果我不能将样式应用到GridView。使用itextsharp在PDF GridView中应用样式
你能帮我吗?
我使用css和html样式来设计我的GridView。
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "inline;filename=" + filename + ".pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
pnl_print.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
sr.Close();
hw.Close();
sw.Close();
如何在面板中添加样式到Gridview?
面板ID是pnl_print
GridView控件ID是GV1
你能帮助我吗?
我正在制作一个面板到PDF,面板包含GridView我只参照itextsharp中的面板。所以GridView是面板的子元素。如何在面板中添加样式到GridView –
是的,但是您正在使用itextsharp将面板添加到pdf,对吗?你需要使用上面的例子来添加样式到你用itextsharp创建的任何元素 –
你能详细解释一下吗,我是这个主题的新手,我已经添加了我的代码。 –