1. #61
    Ext User
    Join Date
    Jan 2008
    Posts
    76
    Vote Rating
    0
    alaska is on a distinguished road

      0  

    Default


    Just a note! did not work with Ext.grid.RowNumberer() im my tests

  2. #62
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    57
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Feel free to make it work.

  3. #63
    Ext User krzak's Avatar
    Join Date
    May 2008
    Location
    Poland
    Posts
    62
    Vote Rating
    0
    krzak is on a distinguished road

      0  

    Default


    Quote Originally Posted by alaska View Post
    Just a note! did not work with Ext.grid.RowNumberer() im my tests
    hm... it work for me with RowNumberer()... something else might break you tests.

  4. #64
    Ext User
    Join Date
    Jan 2008
    Posts
    76
    Vote Rating
    0
    alaska is on a distinguished road

      0  

    Default


    im using NoahK17 version, ill try the original, and report

  5. #65
    Ext User
    Join Date
    Apr 2008
    Location
    PARIS
    Posts
    9
    Vote Rating
    0
    aproust94 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mankz View Post
    It's all in the first post: This needs a browser that supports data URLs. FF, Opera and IE8 will support this.
    Thank you mankz. I wrote something wrong about ie7. I know that's not work. But in all case the utf-8 issue is not due to the kind of browser. Maybe the encoding. I'd try many things, but nothing works.

    If you got an idea ?

    Al
    http://www.123messagepro.com convert your text into vocal message with background music !!

  6. #66
    Ext User
    Join Date
    Apr 2008
    Location
    PARIS
    Posts
    9
    Vote Rating
    0
    aproust94 is on a distinguished road

      0  

    Thumbs up Another solution to get Grid to excel with FF, IE6, IE7, etc

    Another solution to get Grid to excel with FF, IE6, IE7, etc


    Well, after reading many threads about downloading and more, I found a solution bases on this thread and jrh's message (#34) [URL="http://extjs.com/forum/showthread.php?t=23937&page=4"].
    First of all, for utf8 issue, I don't use Base64 encoding. Except for data url.
    So to get more compatibility with major browsers, I use this following code when I create a button (top toolbar). If the browser support data url, I use this way else I create a downloader :
    PHP Code:
                                            id'grid-excel-button',
                        
    iconCls'icon-excel',
                        
    textEXPORT_EXCEL_BUTTON,
                        
    handler: function(){
                            var 
    exportContent IssueListingEditorGrid.getExcelXml();
                            if (!
    Ext.isIE6 || !Ext.isIE7 || !Ext.isSafari || !Ext.isSafari2 || !Ext.isSafari3) {
                                
    document.location='data:application/vnd.ms-excel;base64,' Base64.encode(exportContent);
                            } else {
                                if (!
    Ext.fly('frmDummy')) {
                                    var 
    frm document.createElement('form');
                                    
    frm.id 'frmDummy';
                                    
    frm.name id;
                                    
    frm.className 'x-hidden';
                                    
    document.body.appendChild(frm);
                                }
                                
    Ext.Ajax.request({
                                    
    url'export/excel.php',
                                    
    method 'POST',
                                    
    formExt.fly('frmDummy'),
                                    
    callback: function(osr){
                                        
    alert(r.responseText);
                                    },
                                    
    isUploadtrue,
                                    
    params: { exexportContent }
                                });
                            }
                        } 
    Your PHP code should be like this one:

    PHP Code:
    header("Pragma: public");
    header("Expires: 0"); // set expiration time
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: application/force-download");
    header('Content-type: application/vnd.ms-excel');
    header("Content-Disposition:attachment;filename=export");
    echo 
    $_REQUEST['ex']; 
    Hope this helps someone

    Al
    http://www.123messagepro.com convert your text into vocal message with background music !!

  7. #67
    Sencha User
    Join Date
    Sep 2007
    Location
    Tulsa, Oklahoma
    Posts
    178
    Vote Rating
    1
    ckr is on a distinguished road

      0  

    Thumbs up


    Great work Animal! Works like a charm.


    For others using - FYI
    One item I ran into was the length of the title of my grid. The grid title is used as the worksheet title, and it seems that Excel will only let you have 31 characters. You will get a warning when opening the data link saying that a string is too long. Excel will truncate the title, but the error message might be a bit bothersome. So anyone having a long grid title will need adjust accordingly. It is easily fixed.
    Thanks!
    Chuck

  8. #68
    Ext User
    Join Date
    May 2008
    Posts
    21
    Vote Rating
    0
    miihiir is on a distinguished road

      0  

    Default


    Quote Originally Posted by aproust94 View Post
    Well, after reading many threads about downloading and more, I found a solution bases on this thread and jrh's message (#34) [url="http://extjs.com/forum/showthread.php?t=23937&page=4"].
    First of all, for utf8 issue, I don't use Base64 encoding. Except for data url.
    So to get more compatibility with major browsers, I use this following code when I create a button (top toolbar). If the browser support data url, I use this way else I create a downloader :
    PHP Code:
                                            id'grid-excel-button',
                        
    iconCls'icon-excel',
                        
    textEXPORT_EXCEL_BUTTON,
                        
    handler: function(){
                            var 
    exportContent IssueListingEditorGrid.getExcelXml();
                            if (!
    Ext.isIE6 || !Ext.isIE7 || !Ext.isSafari || !Ext.isSafari2 || !Ext.isSafari3) {
                                
    document.location='data:application/vnd.ms-excel;base64,' Base64.encode(exportContent);
                            } else {
                                if (!
    Ext.fly('frmDummy')) {
                                    var 
    frm document.createElement('form');
                                    
    frm.id 'frmDummy';
                                    
    frm.name id;
                                    
    frm.className 'x-hidden';
                                    
    document.body.appendChild(frm);
                                }
                                
    Ext.Ajax.request({
                                    
    url'export/excel.php',
                                    
    method 'POST',
                                    
    formExt.fly('frmDummy'),
                                    
    callback: function(osr){
                                        
    alert(r.responseText);
                                    },
                                    
    isUploadtrue,
                                    
    params: { exexportContent }
                                });
                            }
                        } 
    Your PHP code should be like this one:

    PHP Code:
    header("Pragma: public");
    header("Expires: 0"); // set expiration time
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: application/force-download");
    header('Content-type: application/vnd.ms-excel');
    header("Content-Disposition:attachment;filename=export");
    echo 
    $_REQUEST['ex']; 
    Hope this helps someone

    Al
    Hey Al,

    I am trying to use your code, however, no success. It's doing nothing. Is it working for anyone else?

    It does not give any error, but does not do anything as well.

    Thanks.

    Mihir

  9. #69
    Ext User
    Join Date
    Apr 2008
    Posts
    1
    Vote Rating
    0
    Marcelo Delgado is on a distinguished road

      0  

    Talking gwt-ext gridpanel to excel

    gwt-ext gridpanel to excel


    Hi Animal I think this is great ! I was looking over Internet a lot but I did not find nothing like this. My problem is that I am using gwt-ext in my application and I would like to have this functionallity in it. I really dont know how to include this in my application, can you give me some tips about this or point me where to go.

    Any help it would be great

    Thanks

    Marelo

  10. #70
    Ext User
    Join Date
    Jul 2008
    Posts
    1
    Vote Rating
    0
    iwagon is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    AH, thanks for that! I'll do conditional method creation and update post 1.
    Правильнее будет:
    encode : (typeof btoa == 'function') ? function(input) { return btoa(utf8Encode(input)); } : function (input) {

Thread Participants: 142

  1. alexb (1 Post)
  2. galdaka (3 Posts)
  3. ghyster (1 Post)
  4. Condor (1 Post)
  5. TopKatz (1 Post)
  6. Jul (1 Post)
  7. mystix (3 Posts)
  8. Foggy (2 Posts)
  9. bloon (1 Post)
  10. fshort (1 Post)
  11. antimatter15 (1 Post)
  12. cocinerox (1 Post)
  13. tobiu (1 Post)
  14. ajaxE (2 Posts)
  15. andreyz (1 Post)
  16. devnull (4 Posts)
  17. mjlecomte (4 Posts)
  18. kevinwu8 (1 Post)
  19. rakesh (1 Post)
  20. hendricd (2 Posts)
  21. gelleneu (1 Post)
  22. isaac (1 Post)
  23. huling (1 Post)
  24. ckr (1 Post)
  25. roopa (1 Post)
  26. loveyeah (1 Post)
  27. zhfxu_cs (1 Post)
  28. Mthor (1 Post)
  29. johnlicy (1 Post)
  30. thoreking (2 Posts)
  31. csqjean (1 Post)
  32. mankz (1 Post)
  33. vietschv (1 Post)
  34. verbi (1 Post)
  35. sanjshah (2 Posts)
  36. mask_hot (1 Post)
  37. calavera (1 Post)
  38. vsmike (1 Post)
  39. vizcano (1 Post)
  40. lakehouse (1 Post)
  41. alaska (2 Posts)
  42. radtad (3 Posts)
  43. jmcneese (1 Post)
  44. Rafael (4 Posts)
  45. calvouze (1 Post)
  46. Joyfulbob (1 Post)
  47. angeldimitrov (2 Posts)
  48. Jack_S (2 Posts)
  49. g13013 (2 Posts)
  50. DamienValentine (5 Posts)
  51. Marcelo Delgado (1 Post)
  52. NoahK17 (8 Posts)
  53. anujg (1 Post)
  54. aproust94 (3 Posts)
  55. pokerking400 (1 Post)
  56. Ronhead (1 Post)
  57. krzak (3 Posts)
  58. cvieira (1 Post)
  59. Efex (5 Posts)
  60. gthe (2 Posts)
  61. miihiir (2 Posts)
  62. pops (1 Post)
  63. emredagli (12 Posts)
  64. larsa (2 Posts)
  65. maggiesnyder (3 Posts)
  66. sam.zhang (1 Post)
  67. kristalgic (1 Post)
  68. wiznia (3 Posts)
  69. frpucci (1 Post)
  70. tinakonda (1 Post)
  71. tBSTAR (1 Post)
  72. tdg2008 (1 Post)
  73. iwagon (1 Post)
  74. psarunkumar (1 Post)
  75. kimmking (1 Post)
  76. sKuD24 (1 Post)
  77. MartinL (2 Posts)
  78. BitPoet (2 Posts)
  79. snoir (3 Posts)
  80. naranda (1 Post)
  81. zhw511006 (1 Post)
  82. bobjbain (1 Post)
  83. korto (1 Post)
  84. wp.joju (1 Post)
  85. hastiok (6 Posts)
  86. dtondo (4 Posts)
  87. Dumas (1 Post)
  88. vvreddy@12 (4 Posts)
  89. TheBim (1 Post)
  90. whodat (2 Posts)
  91. Skunkerbr (2 Posts)
  92. stevenhzj (4 Posts)
  93. Naokai (1 Post)
  94. wayned@escc (2 Posts)
  95. MuadDib-DK (1 Post)
  96. jsundquist (1 Post)
  97. hardc0re (2 Posts)
  98. hzwei (4 Posts)
  99. Galileo_Galilei (1 Post)
  100. SantaBarbarian (4 Posts)
  101. stevieke (1 Post)
  102. megmefleg (1 Post)
  103. Boccara Jonathan (1 Post)
  104. Surinder singh (2 Posts)
  105. KrullWarKing (1 Post)
  106. brandnewdrew (1 Post)
  107. MrRoyce (1 Post)
  108. Spongerusher (1 Post)
  109. teraphy (2 Posts)
  110. Pekka Karalahti (3 Posts)
  111. Sergii (1 Post)
  112. Cassio11 (1 Post)
  113. myth (1 Post)
  114. spor (6 Posts)
  115. StagnantIce (2 Posts)
  116. shailendra (2 Posts)
  117. ext_user1 (1 Post)
  118. kenny_mk (1 Post)
  119. mpacheco (1 Post)
  120. Centurus (1 Post)
  121. andyfly (1 Post)
  122. darmandovargas@gmail.com (1 Post)
  123. zjuthhy (3 Posts)
  124. robshim (3 Posts)
  125. Tod (1 Post)
  126. bipen (2 Posts)
  127. alisyah (1 Post)
  128. Monz87 (1 Post)
  129. alssst (1 Post)
  130. aggie (1 Post)
  131. bradelsky (1 Post)
  132. lagrezd (1 Post)
  133. ma1986 (1 Post)
  134. Sabareesh (2 Posts)
  135. top_1 (1 Post)
  136. Vasanthoo7 (1 Post)
  137. garrek99 (2 Posts)
  138. opik (1 Post)
  139. zaburo (1 Post)
  140. shankar8rajah1 (1 Post)
  141. tdobberphul (4 Posts)
  142. jramis (1 Post)