We use Radgrids throughout our application - with each page tied to a base class that handles OnPdfExporting for all grids.
After a lot of fussing I have sort of figured out how to format the grid. (working code snippet below). The problem is that this one routine handles many dozen different grids - and it appears to make every column the exact same width in the PDF. Is there any way (code example would be great) to dynamically size the PDF columns based on their content - without having to handle each specific grid individually?
After a lot of fussing I have sort of figured out how to format the grid. (working code snippet below). The problem is that this one routine handles many dozen different grids - and it appears to make every column the exact same width in the PDF. Is there any way (code example would be great) to dynamically size the PDF columns based on their content - without having to handle each specific grid individually?
Protected
Overloads
Sub
grid_pdfExport(
ByVal
source
As
Object
,
ByVal
e
As
GridPdfExportingArgs)
e.RawHTML = e.RawHTML.Replace(
"<br>"
,
"<br/>"
)
e.RawHTML = Regex.Replace(e.RawHTML,
"</?(div).*?>"
,
""
)
e.RawHTML = Regex.Replace(e.RawHTML,
"</?(a).*?>"
,
""
)
e.RawHTML = e.RawHTML.Replace(
"width: 100%; table-layout: auto;"
,
"width:100% ; border: 1px solid #666; border-collapse: collapse; margin: 0;"
)
e.RawHTML = e.RawHTML.Replace(
"<th scope="
"col"
">"
,
"<th scope="
"col"
" style="
"font-weight: normal; color: #fff; background-color: #333; border: 1px solid #f1f1f1; white-space: normal; padding: 2px 3px; vertical-align: bottom; line-height: 18px; text-align: left; font-family: arial; font-size: 8px; "
">"
)
e.RawHTML = e.RawHTML.Replace(
"<td>"
,
"<td style="
"font-weight: normal; color: #000; background-color: #fff; border: 1px solid #f1f1f1; white-space: normal;border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; border-right: 1px solid #f1f1f1; border-left: 1px solid #f1f1f1; padding: 2px 5px; vertical-align: top; text-align: left; font-family: arial; font-size: 8px; "
">"
)
End
Sub