1. #121
    Sencha User
    Join Date
    Jun 2008
    Posts
    157
    Vote Rating
    0
    wiznia is on a distinguished road

      0  

    Default


    It can produce the data without a button, but without it you can't download it, and it's not that easy to serve a file through the browser directly. That's why I use downloadify.js

  2. #122
    Sencha User
    Join Date
    Aug 2011
    Location
    Ankara
    Posts
    13
    Vote Rating
    0
    acteon is on a distinguished road

      0  

    Default


    In our case creating a button(xtype : button) with an empty href config attribute then changing its content on the fly with office xml might help ? namely data URL's but there will some compability issues (http://stackoverflow.com/questions/1...-which-version)


    Thanks for the code It saved a lot of effort for me .

  3. #123
    Sencha User
    Join Date
    Jun 2008
    Posts
    157
    Vote Rating
    0
    wiznia is on a distinguished road

      0  

    Default


    That was my previous approach, using data uri's, but it had 3 problems:
    - No support for some browsers (IE).
    - There's a limit for the data uri length. If trying to save a lot of data, some browsers crashed.
    - I was setting the data uri everytime the store loads, this probably could be avoided by adding a click event to the link, and setting the data uri there, and then allowing the event to continue regularly.

    Mainly because of the first 2 things I decided to add a button, and downloadify to avoid them.

  4. #124
    Ext JS Premium Member pavanextjs's Avatar
    Join Date
    Jul 2008
    Posts
    118
    Vote Rating
    2
    pavanextjs is on a distinguished road

      0  

    Default


    Hi Wiznia,

    I was trying to add your fixes from github, but no luck. I am not able to open the exported excel file in my code, but CSV works fine. Also, the excel file exported from the example given in the exporter download works fine from my local iis server.

    I can give you the code snippets & json data if you want to take a look. Please let me know, this is an important functionality in my app.

    Thanks in advance,
    Pavan.

  5. #125
    Sencha User
    Join Date
    Jun 2008
    Posts
    157
    Vote Rating
    0
    wiznia is on a distinguished road

      0  

    Default


    Like I said before the excel support is a little bit tricky with different versions of different programs in different platforms behaving differently.
    I ended up using the csv exporter which can be easily imported into any program in any version in any platform...
    The excel formatter that is in the master branch right now, sort of worked for me on openoffice on linux, and on office 2000 on mac and windows.

  6. #126
    Ext JS Premium Member pavanextjs's Avatar
    Join Date
    Jul 2008
    Posts
    118
    Vote Rating
    2
    pavanextjs is on a distinguished road

      0  

    Default


    OK, i see what you are saying. Thanks Wiznia for the inputs.

    When i debugged into it, i noticed the XML generated by the exporter has these 0"> extra tags, thought this might give you a clue in finding/fixing the issue.

    Below is the XML:

    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:o="urn:schemas-microsoft-com:office:office">
        <o:DocumentProperties>
            <o:Title>
                Workbook
            </o:Title>
        </o:DocumentProperties>
        <x:ExcelWorkbook>
            <x:WindowHeight>
                9000
            </x:WindowHeight>
            <x:WindowWidth>
                50000
            </x:WindowWidth>
            <x:ProtectStructure>
                false
            </x:ProtectStructure>
            <x:ProtectWindows>
                false
            </x:ProtectWindows>
        </x:ExcelWorkbook>
        <ss:Styles>
            <ss:Style ss:ID="Default">
                <ss:Alignment ss:Vertical="Top" ss:WrapText="1" />
                0">
                <ss:Alignment ss:Vertical="Top" ss:WrapText="1">
                </ss:Alignment>
                <ss:Font ss:FontName="arial" ss:Size="10" />
                0">
                <ss:Font ss:FontName="arial" ss:Size="10">
                </ss:Font>
                <ss:Interior />
                0">
                <ss:Interior>
                </ss:Interior>
                <ss:NumberFormat />
                0">
                <ss:NumberFormat>
                </ss:NumberFormat>
                <ss:Protection />
                0">
                <ss:Protection>
                </ss:Protection>
                0">
                <ss:Borders>
                    <ss:Border ss:Position="Top" ss:Color="#e4e4e4" ss:Weight="1" ss:LineStyle="Continuous"
                    />
                    <ss:Border ss:Position="Bottom" ss:Color="#e4e4e4" ss:Weight="1" ss:LineStyle="Continuous"
                    />
                    <ss:Border ss:Position="Left" ss:Color="#e4e4e4" ss:Weight="1" ss:LineStyle="Continuous"
                    />
                    <ss:Border ss:Position="Right" ss:Color="#e4e4e4" ss:Weight="1" ss:LineStyle="Continuous"
                    />
                </ss:Borders>
            </ss:Style>
            <ss:Style ss:ID="even">
                <ss:Interior ss:Pattern="Solid" ss:Color="#CCFFFF" />
                0">
                <ss:Interior ss:Pattern="Solid" ss:Color="#CCFFFF">
                </ss:Interior>
            </ss:Style>
            <ss:Style ss:ID="odd">
                <ss:Interior ss:Pattern="Solid" ss:Color="#CCCCFF" />
                0">
                <ss:Interior ss:Pattern="Solid" ss:Color="#CCCCFF">
                </ss:Interior>
            </ss:Style>
            <ss:Style ss:ID="evendate" ss:Parent="even">
                <ss:NumberFormat ss:Format="[ENG][$-409]dd-mmm-yyyy;@" />
                0">
                <ss:NumberFormat ss:Format="[ENG][$-409]dd-mmm-yyyy;@">
                </ss:NumberFormat>
            </ss:Style>
            <ss:Style ss:ID="evenint" ss:Parent="even">
                <ss:NumberFormat ss:Format="0" />
                0">
                <ss:NumberFormat ss:Format="0">
                </ss:NumberFormat>
            </ss:Style>
            <ss:Style ss:ID="evenfloat" ss:Parent="even">
                <ss:NumberFormat ss:Format="0.00" />
                0">
                <ss:NumberFormat ss:Format="0.00">
                </ss:NumberFormat>
            </ss:Style>
            <ss:Style ss:ID="odddate" ss:Parent="even">
                <ss:NumberFormat ss:Format="[ENG][$-409]dd-mmm-yyyy;@" />
                0">
                <ss:NumberFormat ss:Format="[ENG][$-409]dd-mmm-yyyy;@">
                </ss:NumberFormat>
            </ss:Style>
            <ss:Style ss:ID="oddint" ss:Parent="even">
                <ss:NumberFormat ss:Format="0" />
                0">
                <ss:NumberFormat ss:Format="0">
                </ss:NumberFormat>
            </ss:Style>
            <ss:Style ss:ID="oddfloat" ss:Parent="even">
                <ss:NumberFormat ss:Format="0.00" />
                0">
                <ss:NumberFormat ss:Format="0.00">
                </ss:NumberFormat>
            </ss:Style>
            <ss:Style ss:ID="title">
                <ss:Borders />
                0">
                <ss:Borders>
                </ss:Borders>
                <ss:Font />
                0">
                <ss:Font>
                </ss:Font>
                <ss:NumberFormat ss:Format="@" />
                0">
                <ss:NumberFormat ss:Format="@">
                </ss:NumberFormat>
                <ss:Alignment ss:WrapText="1" ss:Horizontal="Center" ss:Vertical="Center"
                />
                0">
                <ss:Alignment ss:WrapText="1" ss:Horizontal="Center" ss:Vertical="Center">
                </ss:Alignment>
            </ss:Style>
            <ss:Style ss:ID="headercell">
                <ss:Font ss:Bold="1" ss:Size="10" />
                0">
                <ss:Font ss:Bold="1" ss:Size="10">
                </ss:Font>
                <ss:Interior ss:Pattern="Solid" ss:Color="#A3C9F1" />
                0">
                <ss:Interior ss:Pattern="Solid" ss:Color="#A3C9F1">
                </ss:Interior>
                <ss:Alignment ss:WrapText="1" ss:Horizontal="Center" />
                0">
                <ss:Alignment ss:WrapText="1" ss:Horizontal="Center">
                </ss:Alignment>
            </ss:Style>
        </ss:Styles>
        <ss:Worksheet ss:Name="Workbook">
            <ss:Names>
                <ss:NamedRange ss:Name="Print_Titles" ss:RefersTo="='Workbook'!R1:R2"
                />
            </ss:Names>
            <ss:Table x:FullRows="1" x:FullColumns="1" ss:ExpandedColumnCount="4"
            ss:ExpandedRowCount="4">
                <ss:Column ss:AutoFitWidth="1" ss:Width="164" />
                <ss:Column ss:AutoFitWidth="1" ss:Width="164" />
                <ss:Column ss:AutoFitWidth="1" ss:Width="164" />
                <ss:Column ss:AutoFitWidth="1" ss:Width="164" />
                <ss:Row ss:Height="38">
                    <ss:Cell ss:StyleID="title" ss:MergeAcross="3">
                        <ss:Data xmlns:html="http://www.w3.org/TR/REC-html40" ss:Type="String">
                            <html:B>
                                <html:U>
                                    <html:Font html:Size="15">
                                        Workbook
                                    </html:Font>
                                </html:U>
                            </html:B>
                        </ss:Data>
                        <ss:NamedCell ss:Name="Print_Titles" />
                    </ss:Cell>
                </ss:Row>
                <ss:Row ss:AutoFitHeight="1">
                    <ss:Cell ss:StyleID="headercell">
                        <ss:Data ss:Type="String">
                            AlertId
                        </ss:Data>
                        <ss:NamedCell ss:Name="Print_Titles" />
                    </ss:Cell>
                    <ss:Cell ss:StyleID="headercell">
                        <ss:Data ss:Type="String">
                            Network
                        </ss:Data>
                        <ss:NamedCell ss:Name="Print_Titles" />
                    </ss:Cell>
                    <ss:Cell ss:StyleID="headercell">
                        <ss:Data ss:Type="String">
                            Message
                        </ss:Data>
                        <ss:NamedCell ss:Name="Print_Titles" />
                    </ss:Cell>
                    <ss:Cell ss:StyleID="headercell">
                        <ss:Data ss:Type="String">
                            Id
                        </ss:Data>
                        <ss:NamedCell ss:Name="Print_Titles" />
                    </ss:Cell>
                </ss:Row>
                <ss:Row>
                    <ss:Cell ss:StyleID="even">
                        <ss:Data ss:Type="String">
                            123
                        </ss:Data>
                    </ss:Cell>
                    <ss:Cell ss:StyleID="even">
                        <ss:Data ss:Type="String">
                            NICK
                        </ss:Data>
                    </ss:Cell>
                    <ss:Cell ss:StyleID="even">
                        <ss:Data ss:Type="String">
                            SpongeBob 60% delivery
                        </ss:Data>
                    </ss:Cell>
                    <ss:Cell ss:StyleID="even">
                        <ss:Data ss:Type="String">
                        </ss:Data>
                    </ss:Cell>
                </ss:Row>
                <ss:Row>
                    <ss:Cell ss:StyleID="odd">
                        <ss:Data ss:Type="String">
                            233
                        </ss:Data>
                    </ss:Cell>
                    <ss:Cell ss:StyleID="odd">
                        <ss:Data ss:Type="String">
                            MTV
                        </ss:Data>
                    </ss:Cell>
                    <ss:Cell ss:StyleID="odd">
                        <ss:Data ss:Type="String">
                            Sweet Sixteen 67% delivery
                        </ss:Data>
                    </ss:Cell>
                    <ss:Cell ss:StyleID="odd">
                        <ss:Data ss:Type="String">
                        </ss:Data>
                    </ss:Cell>
                </ss:Row>
            </ss:Table>
            <x:WorksheetOptions>
                <x:PageSetup>
                    <x:Layout x:CenterHorizontal="1" x:Orientation="Landscape" />
                    <x:Footer x:Data="Page &amp;P of &amp;N" x:Margin="0.5" />
                    <x:PageMargins x:Top="0.5" x:Right="0.5" x:Left="0.5" x:Bottom="0.8" />
                </x:PageSetup>
                <x:FitToPage />
                <x:Print>
                    <x:PrintErrors>
                        Blank
                    </x:PrintErrors>
                    <x:FitWidth>
                        1
                    </x:FitWidth>
                    <x:FitHeight>
                        32767
                    </x:FitHeight>
                    <x:ValidPrinterInfo />
                    <x:VerticalResolution>
                        600
                    </x:VerticalResolution>
                </x:Print>
                <x:Selected />
                <x:DoNotDisplayGridlines />
                <x:ProtectObjects>
                    False
                </x:ProtectObjects>
                <x:ProtectScenarios>
                    False
                </x:ProtectScenarios>
            </x:WorksheetOptions>
        </ss:Worksheet>
    </ss:Workbook>
    Thanks,
    Pavan

  7. #127
    Sencha User
    Join Date
    Jun 2008
    Posts
    157
    Vote Rating
    0
    wiznia is on a distinguished road

      0  

    Default


    That's odd. If you delete them manually then it opens correctly in excel??
    Maybe it has something to do with your data / grid config.... It seems like it's trying to export a column and doesn't know how.

  8. #128
    Ext JS Premium Member pavanextjs's Avatar
    Join Date
    Jul 2008
    Posts
    118
    Vote Rating
    2
    pavanextjs is on a distinguished road

      0  

    Default


    I tried that by manually removing those tags and excel couldn't open it. But the XML is successfully validated after manually removing those extra tags. I used this for XML validation.

    I am trying to export a "store" which has 3 fields in its model (all strings) and 2 rows of data.

    Store:
    Code:
    Ext.define('ASDF.AlertsStore', {
        extend: 'Ext.data.Store',
        requires: 'ASDF.DBAlert',
        model: 'ASDF.DBAlert',
        proxy: {
            type: 'ajax',
            url: 'data/Alerts.json',
            reader: {
                type: 'json',
                root: 'data.results'
            }
        }
    });
    Model:
    Code:
    Ext.define('ASDF.DBAlert', {
        extend: 'Ext.data.Model',
        idProperty: 'AlertId',
        fields: ['AlertId', 'Network', 'Message']
    });
    JSON Data:
    Code:
    {
        "data": {
            "success": true,
            "results": [{
                "AlertId": 123,
                "Network": 'NICK',
                "Message": 'SpongeBob  60% delivery'
            },
            {
                "AlertId": 233,
                "Network": 'MTV',
                "Message": 'Sweet Sixteen  67% delivery'
            }]
        }
    }
    Thanks,
    Pavan

  9. #129
    Sencha User
    Join Date
    Jun 2008
    Posts
    157
    Vote Rating
    0
    wiznia is on a distinguished road

      0  

    Default


    Can you paste the grid's code?

  10. #130
    Ext JS Premium Member pavanextjs's Avatar
    Join Date
    Jul 2008
    Posts
    118
    Vote Rating
    2
    pavanextjs is on a distinguished road

      0  

    Default


    Here it is...

    ExtJS Ver:4.1.0 Beta
    Browsers: FF10, IE9, Chrome16.0.912.77 m

    Code:
    //store
     var alertsStore = Ext.data.StoreManager.lookup('‚ÄčAlertsStore
    Code:
    ');
    //grid panel inside a border layout's center region Ext.create('Ext.grid.Panel', { title: 'Alerts', itemId: 'alerts-grid', layout: 'fit', store: alertsStore, columns: [{ header: 'Network', dataIndex: 'Network', width: 150 }, { header: 'Message', dataIndex: 'Message', flex: 1 }], tools: [{ type: 'refresh', tooltip: 'Refresh Alerts', handler: function (event, toolEl, panel) { // refresh logic _me.down('#alerts-grid').getStore().load({ callback: function (alerts) { _me.down('#alerts-grid').setTitle('Alerts (' + alerts.length + ')'); } }); } }], dockedItems: [{ xtype: 'toolbar', border: true, dock: 'top', items: [{ xtype: 'exporterbutton', //exportbutton text: 'Export Grid Data', store: alertsStore }] }] });

Thread Participants: 117

  1. dawesi (1 Post)
  2. feiji1983 (1 Post)
  3. isaac (1 Post)
  4. radtad (4 Posts)
  5. austin1030 (1 Post)
  6. pavanextjs (5 Posts)
  7. aragm (1 Post)
  8. terjeio (1 Post)
  9. il Sergio (2 Posts)
  10. edspencer (1 Post)
  11. nitingautam (2 Posts)
  12. edykstra (3 Posts)
  13. kalchas (4 Posts)
  14. pardha (1 Post)
  15. shelly (1 Post)
  16. talha06 (3 Posts)
  17. vaucer (1 Post)
  18. SMMJ_Dev (7 Posts)
  19. Ekambos (1 Post)
  20. vispiron (1 Post)
  21. sdruckerfig (4 Posts)
  22. jwcraig (1 Post)
  23. dbrin (1 Post)
  24. scaddenp (2 Posts)
  25. grisevich (1 Post)
  26. semialcruz (3 Posts)
  27. krishnarn1 (1 Post)
  28. mikih (1 Post)
  29. Teemac (3 Posts)
  30. jpcoppol (1 Post)
  31. ssuarez (4 Posts)
  32. trinitrotoluen (1 Post)
  33. aladdina (1 Post)
  34. Mental (3 Posts)
  35. nuskin (5 Posts)
  36. droessner (5 Posts)
  37. HIG (1 Post)
  38. jjerome (4 Posts)
  39. bee (2 Posts)
  40. RAD001 (8 Posts)
  41. RNL (1 Post)
  42. shawon (4 Posts)
  43. parkcity (4 Posts)
  44. carlosgoias (1 Post)
  45. Ewoq (7 Posts)
  46. skotamreddy (1 Post)
  47. another_i (5 Posts)
  48. neerajbherwal (1 Post)
  49. nimda13 (2 Posts)
  50. acteon (2 Posts)
  51. ma1986 (2 Posts)
  52. pierrocknroll (1 Post)
  53. Aranair (7 Posts)
  54. clarkbanks (1 Post)
  55. linyajun (1 Post)
  56. delusion (2 Posts)
  57. Jay Tanwar (2 Posts)
  58. supermarcos (6 Posts)
  59. mmuzamil (1 Post)
  60. amishra06 (1 Post)
  61. hundare (1 Post)
  62. Ecthelion (1 Post)
  63. balajivaikar (2 Posts)
  64. jarobi (1 Post)
  65. ferchotipin (2 Posts)
  66. sebas2515 (3 Posts)
  67. arpeggian (3 Posts)
  68. a_kanin (1 Post)
  69. MeDigital (1 Post)
  70. Vasanthoo7 (3 Posts)
  71. jeora (1 Post)
  72. BlackLine (1 Post)
  73. mrhomer (7 Posts)
  74. KostasP (2 Posts)
  75. rdominelli (4 Posts)
  76. pksiv (1 Post)
  77. yoisen (2 Posts)
  78. opms (1 Post)
  79. Oxii (1 Post)
  80. sarz (6 Posts)
  81. gabsoftware (3 Posts)
  82. 9josh (1 Post)
  83. ananthk (2 Posts)
  84. psnprasad (1 Post)
  85. alex9311 (2 Posts)
  86. Pedro2263 (1 Post)
  87. felix822 (2 Posts)
  88. mpasacrita@escholar.com (1 Post)
  89. Garry Hawkins (1 Post)
  90. jesus.balles (1 Post)
  91. chandrima31 (1 Post)
  92. this-is-sparta (1 Post)
  93. vitalz (7 Posts)
  94. Sheng_Yunzhou (2 Posts)
  95. xdengli (1 Post)
  96. sgscontact (1 Post)
  97. nitingogia@gmail.com (1 Post)
  98. Swetosuvro (1 Post)
  99. sudrak (1 Post)
  100. cdmein (1 Post)
  101. code4jhon (1 Post)
  102. felixfang (2 Posts)
  103. jayasingh1802 (2 Posts)
  104. abdul haq (3 Posts)
  105. luatbravo (1 Post)
  106. gilmaredo@gmail.com (1 Post)
  107. ricardo.lourival (1 Post)
  108. Sundarganesh Ramar (1 Post)
  109. madhavan281981 (1 Post)
  110. suvo (3 Posts)
  111. shankar8rajah1 (1 Post)
  112. benny_GI (1 Post)
  113. cojocarutudor (1 Post)
  114. arnoldvillasanta (4 Posts)
  115. tajashwin (1 Post)
  116. mangeshppatil (2 Posts)
  117. mukhriddin (1 Post)