I am trying to export the contents of my radgrid to a pdf file. I am using the default skin. Since I have 13 columns, the data is too long to fit on the page and is cut off. I was trying to update the size of the text initially and noticed that it was only working on every other row. I am assuming that this has something to do with the AlternatingItemStyle setting? Is there something special that I need to add to get this update to work on all rows in the radgrid? Please let me know if you need for me to provide you with any other information.
protected
void
listAllAcctsBtnExportToPDF_Click(
object
sender, EventArgs e)
{
ApplyStylesToPDFExport(rgListAllAccounts.MasterTableView);
rgListAllAccounts.MasterTableView.ExportToPdf();
}
//end of listAllAcctsBtnExportToPDF_Click
private
void
ApplyStylesToPDFExport(GridTableView view)
{
// Get access to the header of the grid
GridItem headerItem = view.GetItems(GridItemType.Header)[0];
// Apply some css style to the header
headerItem.Cells.Count.ToString();
foreach
(TableCell cell
in
headerItem.Cells)
{
cell.Style[
"font-family"
] =
"Verdana"
;
cell.Style[
"text-align"
] =
"left"
;
cell.Style[
"vertical-align"
] =
"middle"
;
cell.Style[
"font-size"
] =
"10px"
;
}
// Get access to the data of the grid
GridItem[] dataItems = view.GetItems(GridItemType.Item);
// Apply some css style to the data items
foreach
(GridItem item
in
dataItems)
{
foreach
(TableCell cell
in
item.Cells)
{
cell.Style[
"font-family"
] =
"Verdana"
;
cell.Style[
"text-align"
] =
"left"
;
cell.Style[
"vertical-align"
] =
"middle"
;
cell.Style[
"font-size"
] =
"10px"
;
cell.Style[
"background-color"
] =
"red"
;
}
}
}
//end of ApplyStylesToPDFExport