[CLOSED] Import/ Export Excel from/to Grid Panel (Urgent Pls!!!)

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Import/ Export Excel from/to Grid Panel (Urgent Pls!!!)

    Hello there,

    My requirement is export data from the grid panel and import data to the grid panel.

    I've achieved export data and save to the local using the following example:

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

    But when I open the exported excel, I've got the following error message.

    The file you are trying to open,XXXX,is in different format than specified by the file extension
    May I know how to prevent that error while opening the exported excel file.

    Because of that, I can't read the imported data using Microsoft.Jet.OLEDB.4.0 in the import function.

    May I know is there any sample for import function too?Click image for larger version. 

Name:	XLSError.jpg 
Views:	26 
Size:	38.3 KB 
ID:	6739

    Thanks in advance.
    Last edited by Daniil; Aug 16, 2013 at 6:43 AM. Reason: [CLOSED]
  2. #2
    Hello!

    Please, this thread: http://forums.asp.net/t/1922090.aspx...file+extension
    Attached Thumbnails Click image for larger version. 

Name:	1.PNG 
Views:	33 
Size:	39.8 KB 
ID:	6740  
  3. #3
    Hello Badialy,

    I already found out that solution before I post this thread.

    Please check the following for the function that I use for Exporting data.

    It would be pleasure if you could provide me how do I implement your provided solution in my function in details.

      protected void SubmitData(object sender, StoreSubmitDataEventArgs e)
            {
                XmlNode xml = e.Xml;
                this.Response.Clear();
                this.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                this.Response.AddHeader("Content-Disposition", "attachment; filename=ExportCommissionData.xls");
                XslCompiledTransform xtExcel = new XslCompiledTransform();
                xtExcel.Load(Server.MapPath("Excel.xsl"));
                xtExcel.Transform(xml, null, Response.OutputStream);
                this.Response.End();
            }
    Quote Originally Posted by Baidaly View Post
    Last edited by Daniil; Aug 13, 2013 at 3:59 AM. Reason: QUOTE tags => CODE tags
  4. #4
    Hi,

    Please try this
    this.Response.AddHeader("Content-Disposition", "attachment; filename=ExportCommissionData.xlsx");
    instead of
    this.Response.AddHeader("Content-Disposition", "attachment; filename=ExportCommissionData.xls");
  5. #5
    Hello Daniil,

    I'm still getting the same error as before.

    Thanks.

    Quote Originally Posted by Daniil View Post
    Hi,

    Please try this
    this.Response.AddHeader("Content-Disposition", "attachment; filename=ExportCommissionData.xlsx");
    instead of
    this.Response.AddHeader("Content-Disposition", "attachment; filename=ExportCommissionData.xls");
  6. #6
    Confirm, it doesn't help on my side as well.

    I think the most actual answer in that thread is this one:
    you are sending html content as your download but telling the client that you sent xls.
    This does get excel to open and load the content, and excel can read in the html data but...
    excel does know that what it's reading (html) is not a real spreadsheet. So excel will warn you of this as a standard security precaution.
    if you dont want excel to show that warning, then you'd need to transmit a real spreadsheet for your download data...
    one way to convert your data into a real spreadsheet is to use a free component like NPOI : http://npoi.codeplex.com/
    Unfortunately, we have no an example.
  7. #7
    Hello Daniil,

    Finally, I've accomplished importing excel (in xml).

    I've created handler as in following example:

    http://forums.ext.net/showthread.php...xcel-into-Grid

    Though I have the imported data in json string, when I'm loading to the store

    1)

    Success="#{gridExcel}.getStore().loadData(result);"
    But, I've got the javascript error messsage as

    Microsoft JScript runtime error: Object doesn't support property or method 'getStore'
    2) Then I've used store name instead of grid panel

    Success="#{sExcel}.loadData(result);"
    Then it loads blank data.

    Can you help me for this?





    Quote Originally Posted by Daniil View Post
    Confirm, it doesn't help on my side as well.

    I think the most actual answer in that thread is this one:


    Unfortunately, we have no an example.
    Last edited by canusr1; Aug 15, 2013 at 6:07 AM.
  8. #8
    Please try:
    Success="alert(result);"
    and post here an alert box's content.
  9. #9
    Return [Object].

    Click image for larger version. 

Name:	Message.jpg 
Views:	8 
Size:	12.3 KB 
ID:	6765
  10. #10
    Please try with:
    Success="alert(Ext.encode(result));"
Page 1 of 2 12 LastLast

Similar Threads

  1. Export grid panel data to excel
    By sumesh in forum 1.x Help
    Replies: 1
    Last Post: Sep 23, 2013, 9:07 AM
  2. Export to excel: Grid Panel with multiple pages.
    By breakyoheart in forum 2.x Help
    Replies: 0
    Last Post: Aug 02, 2012, 8:09 PM
  3. Replies: 1
    Last Post: May 28, 2012, 5:17 AM
  4. Export grid panel data to excel
    By sumesh in forum 1.x Help
    Replies: 0
    Last Post: May 19, 2012, 6:01 AM
  5. [CLOSED] Import Excel into Grid
    By mcfromero in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 13, 2012, 2:22 PM

Posting Permissions