The Gridview to Excel Export Tool 3.0

My first Export to Excel 2003 and Excel 2007/2010

Walkthrough: Your first Export to Excel with the Gridview to Excel Export Tool Release 3.0

This walkthrough illustrates how to create a simple Web Site with the capability to export data to Excel.

The full process is made up of two main steps:

  • First step is the Web Site creation
  • Second step  is creating a simple Web Page with a sqldatasource, a gridview and the capability to export data to Excel 2007/2010..

Creating the Web Site

To create a new ASPX Web Site, perform following steps:

  1. Run Visual Studio Select File -> New Web Site. Choose Visual Basic and ASP.NET Web Site. Select either .Net Framewotk 3.5 or .Net Framewotk 4.0.
    Creating the new web site
  2. Press Ok. The Web Site will be created and Solution Explorer will show like next one:
    Solution Explorer Window
  3. In the Solution Explorer window right-click the Web Site and select "Add reference". Add a reference to the GEETMultiScheet30.dll you can find in the GEETbin folder inside the "Gridview To Excel Export Tool" normally C:\Program Files (x86)\Cefalà Ing. Ettore\GridviewExcelExportTool\3.0.0\GEETBin.
    Add the reference to the Gridview to Excel Export Tool
  4. Press Ok. After a few seconds next window will show up.
    The Solution Explorer Window after adding the reference to the Gridview to Excel Export Tool
    Double click the Default.aspx page and select the Design View.

Add the capability to Export data to Excel

Here we'll modify the default.aspx page in order to display some data with a Gridview and to export them to Excel by means of the "Gridview to Excel Export Tool". In this case a Gridview and a SqlDataSource will be used to feed the Export Tool. The tool offers anyway the chance to export data also from many other data sources.

Please follow next steps:

  1. From the Toolbox drop a Gridview web-control on the default.aspx design page surface.
    The Gridview
  2. Click the Gridview tag and select Configure datasource, select New. In the next form select the SQL Database icon and press OK
    Selecting the Data Source type
  3. In next form set the Sql Server machine name, set the appropriate authentication and select the AdventureWorks demo database.
    The Sql Server connection
  4. Press Ok. Then press Ok in next form to save the connection string in the web.config file. The Sql Server connection string
  5. Select "Create Sql Statement". Next window will popup.
    The SQL statement window
  6. Copy following text and paste it in the Sql Statement area.

    Then press Finish.
  7. Now your default.aspx page should look like this.
    The default.aspx page with gridview and sqldatasource
  8. Select the Gridview and set the "AllowPaging" property to true.
    Setting the AllowPaging property of the Gridview
  9. From the toolbox add a Button to the page, Set its Text property to Export to Excel 2007/2010, then double click it. The behind window code page will open.
  10. Copy the following text and replace all the text in the code page window.
  11. Your code page should now look like this:
    The code to export data to Excel
  12. Save All, press Ctrl-F5.The browser will open and will show next page:
    The form in the browser
  13. Press the "Export to Excel 2007" Button. Next window will popup:
    The popup window to choose whether to open the exported Excel file or to save it to disk.
  14. Press "Ok" to open the Excel sheet and following Excel 2007/2010 (xlsx) sheet will display:
    The final Excel export.

For any issue please write to support@gridviewtoexcel.com