Export to Excel

  1. #1

    Export to Excel

    I am trying to export data from a Store to an excel file. The store is not linked to a grid though (I just want to pull the data in from the DB and export it). I used the OnSubmitData to fire the code behind. It successfully creates an Excel file, but it is blank! I belive the xmlNode I am creating is blank. How can I get an XmlNode from a Store?

    Thanks,
    Jon
  2. #2
    Hi,

    The following sample demonstrates exporting data in several different formats.

    https://examples1.ext.net/#/GridPane...ort_Data_Ajax/

    Hope this helps.
    Geoffrey McGill
    Founder
  3. #3
    That is the example I have been working off of. However, it only shows how to get the XmlNode object from a gridpanel record, and I need to be able to extract one from the Store itself.
  4. #4
    Hi,

    You can use the Store's getRecordsValues method instead of the GridPanel's getRowsValues one.
  5. #5
    After some work, I managed to get the record to export to excel. However, it simply comes as a basic table. I tried editing the .xsl file, but I cannot find a good guide for styling the exported excel file. Could you please provide me with some information on how to customize the excel file? For instance, I would like to export the file with the fields as rows and the values as columns. Is this possible?

    Thank you,
    Jon
  6. #6
    Quote Originally Posted by JonC View Post
    After some work, I managed to get the record to export to excel. However, it simply comes as a basic table. I tried editing the .xsl file, but I cannot find a good guide for styling the exported excel file. Could you please provide me with some information on how to customize the excel file? For instance, I would like to export the file with the fields as rows and the values as columns. Is this possible?

    Thank you,
    Jon
    It would probably be best to use the Google to find the correct format required by Excel.
    Geoffrey McGill
    Founder
  7. #7
    I tried looking for a guide for editing the .xsl file on google, but I did not have any luck. I was hoping someone there had some expertise on it, or knew where I could find more information.
  8. #8
    I would look into:
    http://www.w3schools.com/xsl/xsl_languages.asp

    There is the "Next Chapter" button.
  9. #9

    Export data from server side with mask for a long running progress.

    I am using https://examples2.ext.net/#/GridPane...Data_PostBack/ from server side as an example and it works, my problem is that the xls file that I build take a few seconds, upto a minute or 2, so how can I display a mask or any progress to the user?

    [Html]
    <ext:Button ID="btnXls" Text="To Excel" runat="server" Icon="PageExcel" ToolTip="Search for unallocated documents From date To date"
                            ToolTipType="Qtip" AutoPostBack="true">
    </ext:Button>
    I would like to use the following, just for consistancy of the whole application:

    <ext:Button ID="btnXls" runat="server" Text="Search for unallocated documents From date To date">
                            <DirectEvents>
                                <Click OnEvent="btnXls_Click" Before="Ext.Msg.wait('Building report...', 'Report');"
                                    Failure="Ext.Msg.show({ 
                                    title   : 'Error', 
                                    msg     : 'Error during report building, 
                                    minWidth: 200, 
                                    modal   : true, 
                                    icon    : Ext.Msg.ERROR, 
                                    buttons : Ext.Msg.OK 
                                });">
                                </Click>
                            </DirectEvents>
    </ext:Button>
    , but as soon as I use the code above, I then can not use:

    Context.Response.AppendHeader("Content-Disposition", "inline;filename=" + System.IO.Path.GetFileName(TempFilename));
    Context.Response.ContentType = AS2.MIME.MimeType.Get_MIMETypeFromFile(TempFilename);
    Context.Response.AddHeader("Content-Length", (string)Microsoft.VisualBasic.FileLen(TempFilename));
    Context.Response.WriteFile(TempFilename);
    I have even tried https://examples2.ext.net/#/Miscella...r_Side_Update/, but it also give an error.
    I can build the report in a handler like https://examples2.ext.net/#/GridPane...it_to_Handler/, but I can not see how to pass multi parameters like below?

    ResourceManager1.AddScript("window.open('../Handler1.ashx?Type=Documents_Not_Received&UAType=" + dropDocumentType.SelectedItem.Text + "&FromDate=" + DateFrom.SelectedDate.ToString + "&ToDate=" + DateTo.SelectedDate.ToString + "&DepotID=" + DepotID + "&EmailAddress=" + (string)Session("EmailAddress") + "&SessionID=" + Session.SessionID + "','_blank')")
    Can you sugest which way to go?
    Last edited by Daniil; Nov 13, 2012 at 4:55 AM. Reason: Please use [CODE] tags
  10. #10
    Hi @Picman,

    Unfortunately, it is an AJAX downloading limitation - no success/failure events. So, no way to hide a mask.

    Here is a single approach we can suggest with AJAX downloading.
    http://forums.ext.net/showthread.php...ll=1#post83757

    Or you can try another ways to download files. For example, Flash.

Similar Threads

  1. Export to Excel
    By ChrisO in forum 2.x Help
    Replies: 1
    Last Post: Jun 21, 2012, 4:08 PM
  2. Excel Export in Grid
    By BLOZZY in forum 1.x Help
    Replies: 0
    Last Post: Oct 09, 2011, 11:37 AM
  3. Excel Export
    By maephisto in forum 1.x Help
    Replies: 1
    Last Post: May 13, 2011, 11:47 AM
  4. vb example of export to Excel
    By grosenbrock in forum 1.x Help
    Replies: 2
    Last Post: Aug 27, 2010, 6:22 PM
  5. Excel export problem
    By Nagaraj K Hebbar in forum 1.x Help
    Replies: 3
    Last Post: Aug 18, 2009, 5:36 PM

Tags for this Thread

Posting Permissions