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

no headers export when format is biff

6 Answers 61 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 18 Sep 2013, 05:13 PM
I am trying to use the biff format for excel as I do not get the goofy MS error when opening the sheet right away, however when using the biff format the headers do not show, how can I get the headers to show in the export to excel file?


<telerik:RadGrid ID="myRadGrid" runat="server" Width="98%" BorderWidth="1px" CellPadding="6" GridLines="None" BorderColor="#404040" Skin="Web20">
<ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" FileName="Inventory" Excel-Format="Biff" ></ExportSettings>










6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 19 Sep 2013, 09:33 AM
Hi Kevin,

I'm not clear about your requirement,if its column headers,please try the following code snippet,else please elaborate on your requirements and give full code.

ASPX:
<telerik:RadGrid ID="myRadGrid" runat="server" Width="98%" BorderWidth="1px" CellPadding="6"
    AutoGenerateColumns="false" GridLines="None" BorderColor="#404040" Skin="Web20"
    DataSourceID="SqlDataSource1">
    <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true"
        FileName="Inventory" Excel-Format="Biff">
    </ExportSettings>
    <MasterTableView CommandItemDisplay="Top" CommandItemSettings-ShowExportToExcelButton="true">
        <Columns>
            <telerik:GridBoundColumn UniqueName="OrderID" DataField="OrderID" HeaderText="OrderID" />
            <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" UniqueName="ShipCity" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Thanks,
Princy

0
Kevin
Top achievements
Rank 1
answered on 19 Sep 2013, 02:51 PM
Hi Princy thanks for the reply, here is my situation.

I am using the command Item Template for the export becuase this is how i have gotten around the update panels in a master page situation.

Protected Sub myRadGrid_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles myRadGrid.ItemCreated
       If Not IsExport Then
           If TypeOf e.Item Is GridCommandItem Then
               ScriptManager.GetCurrent(Page).RegisterPostBackControl(e.Item.FindControl("btnExport"))
           End If
 
 
If e.CommandName = "ExportToExcel" Then
           IsExport = True
           myRadGrid.Columns(0).Visible = False
           myRadGrid.Columns(1).Visible = False
       End If
 
 
 <telerik:RadGrid ID="myRadGrid" runat="server" Width="98%" BorderWidth="1px" CellPadding="6" GridLines="None" BorderColor="#404040" Skin="Web20">
                                       <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" FileName="Inventory" Excel-Format="Biff" ></ExportSettings>
                                       <MasterTableView AutoGenerateColumns="false" DataKeyNames="intRecId" Font-Size="9" CommandItemDisplay="Top" AllowPaging="true" PagerStyle-PageSizes="25, 50, 100">
                                           <HeaderStyle ForeColor="White" Font-Bold="true" HorizontalAlign="Center" />
                                           <ItemStyle HorizontalAlign="Center"/>
                                           <AlternatingItemStyle BackColor="#B0C4DE"  HorizontalAlign="Center" />
                                           <CommandItemTemplate>
                                               <table class="table100">
                                                   <tr>
                                                       <td align="right"><asp:Button ID="btnExport" runat="server" CommandName="ExportToExcel" Text="Export Excel" /></td>
                                                   </tr>
                                               </table>
                                           </CommandItemTemplate>


I would like to use the biff format becuase users do not get the windows error when they open the excel file right away.  the problem is that the column headers do not export with the biff format for some reason.  Maybe becuase of the way i export but like mentioned above only way i could get around use of updatepanel with master page to export the file with radgrid.  So do you know another way???












0
Accepted
Princy
Top achievements
Rank 1
answered on 20 Sep 2013, 05:49 AM
Hi Kevin,

I have noticed that you have set the HeaderStyle ForeColor to White,which when exported will also be in white,hence i guess that's why,the Headers are missing.Can you please try changing the color and see if it helps.

ASPX:
<HeaderStyle ForeColor="Black" Font-Bold="true" HorizontalAlign="Center" />

Thanks,
Princy
0
Kevin
Top achievements
Rank 1
answered on 20 Sep 2013, 12:46 PM
Hi Princy,

Thanks, thats pretty ironic since the color of the headers is white in Web20, if not changed.  It sfunny that it would export the column headers in the defualt color but not changing to white.  Thanks for the help.
0
Spiros
Top achievements
Rank 1
answered on 16 Sep 2014, 06:01 AM
I have a Hierarchical
grid which is filled from the database.

The following
code works fine when exporting to excel

          (On button Click Event)

           RadGrid1.ExportSettings.FileName
= "filename";

           
RadGrid1.ExportSettings.IgnorePaging = true;

           
RadGrid1.ExportSettings.ExportOnlyData = true;

           
RadGrid1.ExportSettings.OpenInNewWindow = true;

           
RadGrid1.MasterTableView.UseAllDataFields = true;

           
RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Excel;



           
RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;

           
RadGrid1.MasterTableView.DetailTables[0].HierarchyDefaultExpanded =
true;



           
RadGrid1.MasterTableView.HierarchyLoadMode = GridChildLoadMode.Client;

           
RadGrid1.MasterTableView.DetailTables[0].HierarchyLoadMode =
GridChildLoadMode.Client;



           
RadGrid1.MasterTableView.ExportToExcel();

But not for


           
RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Biff;

Any Idea ?

Thanks in advavce

Spiros
 

0
Kostadin
Telerik team
answered on 19 Sep 2014, 05:51 AM
Hello Spiros,

I am afraid that Biff export format does not support exporting of hierarchical grid. More information about limitation of this export format could be found at the following help article.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Kevin
Top achievements
Rank 1
Spiros
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or