Hi,
I am trying to export PDF from my RadGrid and its exporting successfully. But i am facing some design issues in the exported PDF file.
1. All the text are coming with Hyperlinks in the exported PDF.
2. Set the Forecolor and width, which are not getting reflected in the exported PDF.
Below is my c# code
Please advise.
Thanks
Ranjith
I am trying to export PDF from my RadGrid and its exporting successfully. But i am facing some design issues in the exported PDF file.
1. All the text are coming with Hyperlinks in the exported PDF.
2. Set the Forecolor and width, which are not getting reflected in the exported PDF.
Below is my c# code
protected void btnExportToPDF_Click(object sender, ImageClickEventArgs e) { ApplyStylesToPDFExport(RadGrid1.MasterTableView); RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.FileName = "Test"; RadGrid1.MasterTableView.ExportToPdf(); }private void ApplyStylesToPDFExport(GridTableView view) { GridItem headerItem = view.GetItems(GridItemType.Header)[0]; foreach (TableCell cell in headerItem.Cells) { switch (cell.Text) { case "A": cell.Width = Unit.Pixel(5); // Tried like this. Not reflecting break; case "B": cell.Style["width"] = "15px"; // Tried like this. Not reflecting break; } cell.Style["font-family"] = "Verdana"; cell.Style["font-bold"] = "true"; cell.Style["text-align"] = "left"; cell.Style["vertical-align"] = "middle"; cell.Style["font-size"] = "8px"; cell.ForeColor = System.Drawing.Color.Black; // Tried like this. Not reflecting } GridItem[] dataItems = view.GetItems(GridItemType.Item); 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"] = "left"; cell.Style["font-size"] = "6px"; cell.Style["text-decoration"] = "none"; // Tried like this. Not reflecting cell.Style["ForeColor"] = "#000"; } } dataItems = view.GetItems(GridItemType.AlternatingItem); 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"] = "6px"; cell.Style["text-decoration"] = "none"; cell.ForeColor = System.Drawing.Color.Black; } } }Please advise.
Thanks
Ranjith