unable to convert gridview to pdf

Posted by Kosaraju_Uma under ASP.NET on 5/13/2014 | Points: 10 | Views : 544 | Status : [Member] | Replies : 4
I am getting the following exception while parsing the string during HTMLWorker.ParseToList(sReader,new StyleSheet())

"Unable to cast object of type 'iTextSharp.text.html.simpleparser.CellWrapper' to type 'iTextSharp.text.Paragraph'."

Pls help




Responses

Posted by: Chandradev819 on: 5/13/2014 [Member] Starter | Points: 25

Up
0
Down
Hi

have u done like this post ?

http://www.aspsnippets.com/Articles/How-to-export-GridView-data-to-PDF-file-in-ASPNet.aspx

Thanks and Regards
Chandradev
My Blog

Kosaraju_Uma, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 5/13/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://forums.asp.net/t/1896550.aspx?Unable+to+cast+object+of+type+iTextSharp+text+html+simpleparser+CellWrapper+to+type+iTextSharp+text+Paragraph+

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kosaraju_Uma, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bandi on: 5/13/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://r4r.co.in/c1/01/tutorial/csharp/Export%20gridview%20to%20pdf%20in%20asp.net%20using%20c-Sharp.shrtml.shtml
http://www.codeproject.com/Questions/383958/Exporting-aspx-page-to-pdf

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kosaraju_Uma, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kosaraju_Uma on: 5/13/2014 [Member] Starter | Points: 25

Up
0
Down
I tried all possibilities but it doesnt work. I tried my code with a simple table and it works. Following isthe html rendered by rendercontrol:
<div>
<table cellspacing="0" cellpadding="4" id="ContentContainer_GridView1" style="border-collapse:collapse;">
<tr>
<th scope="col">
<span id="ContentContainer_GridView1_lblSNoText">SNo</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblTicketIdText">TicketId</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblClintName">Client</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblApplicationText">Application</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblTitleText">Title</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblCreationDtText">Creation Date</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblLastUpdationDtText">Updated Date</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblStartedByText">Started By</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblLastUpdateByText">Updated By</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblIsClosedText">Closed</span>
</th><th scope="col">
<span id="ContentContainer_GridView1_lblTimeSpentText">Timespent</span>
</th>
</tr><tr>
<td>
<span id="ContentContainer_GridView1_lblSno_0">1</span>
</td><td>
<a id="ContentContainer_GridView1_popup_0" title="PHDT26" class="popup" href="TicketDetailView.aspx?TicketId=26 &amp;AppId=10">PHDT26</a>
</td><td>
<span id="ContentContainer_GridView1_lblClint_0" title="ICIC">ICIC</span>
</td><td>
<span id="ContentContainer_GridView1_lblApplicaton_0" title="APP1">APP1</span>
</td><td>
<a href="../User/DisplayTicket.aspx?TicketId=26 &AppId=10">
<span id="ContentContainer_GridView1_lblTitle_0" title="sdsfdsfdsgfdgfd" style="color:Green;">sdsfdsfdsgfdgfd</span></a>
</td><td>
<span id="ContentContainer_GridView1_lblCreationDt_0" title="25-04-2014 19:20:39">25-04-2014 19:20:39</span>
</td><td>
<span id="ContentContainer_GridView1_lblUpdationDt_0" title="06-05-2014 12:59:53">06-05-2014 12:59:53</span>
</td><td>
<span id="ContentContainer_GridView1_lblStartedBy_0" title="client1">client1</span>
</td><td>
<span id="ContentContainer_GridView1_lblLastUpdateBy_0" title="Admin">Admin</span>
</td><td>
<span id="ContentContainer_GridView1_lblIsCloesed_0" title="Yes">Yes</span>
</td><td>
<span id="ContentContainer_GridView1_lblTimespan_0" title="156.00">156.00</span>
</td>
</tr><tr>
<td>
<span id="ContentContainer_GridView1_lblSno_1">2</span>
</td><td>
<a id="ContentContainer_GridView1_popup_1" title="PHDT27" class="popup" href="TicketDetailView.aspx?TicketId=27 &amp;AppId=10">PHDT27</a>
</td><td>
<span id="ContentContainer_GridView1_lblClint_1" title="ICIC">ICIC</span>
</td><td>
<span id="ContentContainer_GridView1_lblApplicaton_1" title="APP1">APP1</span>
</td><td>
<a href="../User/DisplayTicket.aspx?TicketId=27 &AppId=10">
<span id="ContentContainer_GridView1_lblTitle_1" title="exception" style="color:Blue;">exception</span></a>
</td><td>
<span id="ContentContainer_GridView1_lblCreationDt_1" title="08-05-2014 10:16:43">08-05-2014 10:16:43</span>
</td><td>
<span id="ContentContainer_GridView1_lblUpdationDt_1" title="08-05-2014 12:16:52">08-05-2014 12:16:52</span>
</td><td>
<span id="ContentContainer_GridView1_lblStartedBy_1" title="client1">client1</span>
</td><td>
<span id="ContentContainer_GridView1_lblLastUpdateBy_1" title="Admin">Admin</span>
</td><td>
<span id="ContentContainer_GridView1_lblIsCloesed_1" title="No">No</span>
</td><td>
<span id="ContentContainer_GridView1_lblTimespan_1" title="3.30">3.30</span>
</td>
</tr>
</table>
</div>

For the above html HTMLWorker.parse is failing

Kosaraju_Uma, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response