I have a RadGrid on an aspx page with a HTML table above it with some customer information. I am able to export the HTML table and prepend it to the export by using a memory stream. But, I cannot get it to work when exporting to PDF.
protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
StringBuilder customHTML = new StringBuilder();
if (e.ExportType == ExportType.Excel)
{
customHTML.Append("<
table
style
=
'font-size: 11px; font-family:Verdana;width:500px;'
>");
customHTML.Append("<
tr
><
td
><
strong
>Volunteer:</
strong
></
td
><
td
style
=
text
-align:left;>" + _volunteer + "</
td
>
</
tr
>");
customHTML.Append("</
table
>");
e.ExportOutput = e.ExportOutput.Replace("<
body
>", String.Format("<
body
>{0}", customHTML));
MemoryStream gridMemoryStream = new MemoryStream(new ASCIIEncoding().GetBytes(e.ExportOutput));
gridMemoryStream.Close();
}
if (e.ExportType == ExportType.Pdf)
{
// How do I add HTML to the PDF Export? The Excel Export doesn't work
}