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

Issue With Export Data From Grid

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 27 Sep 2012, 04:46 PM
Dear
i have some issue with Export data from grid to PDF file & CSV file
with PDF: when i export date it come all data not formatted and all data come above some
and it is look like that

================================================
and about CSV file
it is come with Birth date only and all another fields is empty without any data

my code look like
(ASP):
                     <telerik:RadButton ID="RadBtn_ExportPDF" runat="server" Text="ExportPDF"
                        onclick="RadBtn_ExportPDF_Click" >
                    </telerik:RadButton>
                     <telerik:RadButton ID="RadBtn_ExportExcel" runat="server" Text="ExportExcel"
                         onclick="RadBtn_ExportExcel_Click">
                    </telerik:RadButton>
                    <telerik:RadButton ID="RadBtn_ExportCSV" runat="server" Text="ExportSCV"
                        onclick="RadBtn_ExportCSV_Click">
                    </telerik:RadButton>

and in (CS):
protected void RadBtn_ExportPDF_Click(object sender, EventArgs e)
    {
        ConfigureExport();
        MainGride.MasterTableView.ExportToPdf();
    }

    protected void RadBtn_ExportExcel_Click(object sender, EventArgs e)
    {
        ConfigureExport();
        MainGride.MasterTableView.ExportToExcel();
    }

    protected void RadBtn_ExportCSV_Click(object sender, EventArgs e)
    {
        ConfigureExport();
        MainGride.MasterTableView.ExportToCSV();
    }

    public void ConfigureExport()
    {
        MainGride.ExportSettings.ExportOnlyData = true;
        MainGride.ExportSettings.IgnorePaging =true;
    }
and in item command :

if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||
            e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName )
        {
            ConfigureExport();
        }
i need to your help in that to make data formatted well in Export PDF and to get all data in Export CSV file

Regard
Ahmed Salem

1 Answer, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 27 Sep 2012, 05:13 PM
Hello,

Please check below link.
PDF specific settings and events

You must have to set some needed style for each cell.
EX:
e.Item.Style["width"] = "100px"
item.Style["width"] = "100px";


Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or