no headers export when format is biff

7 posts, 1 answers
  1. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 18 Sep 2013 Link to this post

    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>










  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Sep 2013 Link to this post

    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

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 19 Sep 2013 Link to this post

    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???












  5. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Sep 2013 Link to this post

    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
  6. Kevin
    Kevin avatar
    265 posts
    Member since:
    Jun 2011

    Posted 20 Sep 2013 Link to this post

    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.
  7. Spiros
    Spiros avatar
    15 posts
    Member since:
    May 2010

    Posted 16 Sep 2014 Link to this post

    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
     

  8. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 19 Sep 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017