This is a migrated thread and some comments may be shown as answers.

Export PDF & Excel

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Gunderson
Top achievements
Rank 1
David Gunderson asked on 31 May 2011, 07:30 PM
2 Issues,
1. When I export to a pdf file it does not center the text of my columns under their headings, they are off a bit.  They are centered in the grid but not in the PDf Export.

2. When exporting to a Excel file, there seems to be 3 buttons that export along with the header that they are in, i am assuming its the export buttons I turned on, is there a way to shut this off and only export the actuall data in grid.

Thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Jun 2011, 07:35 AM
Hello David,

One suggestion is to align the text in ItemDataBound event and it will reflect when you are exporting to pdf. The following documentation explains more about this.
PDF export.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            TableCell cell = item["ColumnUniqueName"];
            cell.Style.Add("text-align", "center");
        }
    }

In order to hide buttons when exporting to excel set ExportOnlyData as true. Hope this helps you.

Thanks,
Princy.
Tags
Grid
Asked by
David Gunderson
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or