Well, here's an exporter that can export a grid, tree or simply a store to excel. It's a fork from another project, I adapted it to work with ExtJs 4, using the new class system and fixed a couple of bugs.
The Csv exporter isn't implemented and the example and compiled files are not updated (so don't use Exporter-all.js).
It exports all the data in the store loaded at that time. If a grid is used it uses the renderers and column configurations from it.
The download is made through a button and uses datauri, so it doesn't work in older ie versions.
I hope it's useful, if you find bugs or make improvements, just fork it and send me a pull request.
https://github.com/iwiznia/Ext.ux.Exporter

The exporter-all.js is not updated, so you have to include Exporter.js

Teemac

19 Jul 2011, 9:56 AM

Ran into the same problem as nuskin, but happened for me when I tried just including Exporter.js, when I included all the files, I was able actually get into the button class when adding the button but not sure what I need to set in the buttons config to get it to work. Tried the storeId, tried the store itself, and even tried the grid as the component. Any ideas?

wiznia

19 Jul 2011, 11:36 AM

I use it like this. If the exporterebutton is inside a grid or a tree it autodetects the store. You can use it in a grid without creating a new class, just add the 'uses' config and the exporterbutton in the dockedItems.

Thanks that worked except that in the button class setComponent function the columns don't have the .on function off them, seem like a simple array. Also the show and hide events never seemed to get fired. So I set it on the render and used the headerCt instead of columns, which seems to work but when I actually click the download, it navigates to data:application/vnd.ms-excel;base64,PD94bWwgdm....Lots more just like it, but doens't do anything more. As I haven't tried to use the data stuff before not sure what's it's supposed to do. I'm trying to make a simpler version of my grid to show as an example and see if it works, but wanted to see if you had ideas ahead of time, thanks again for any help you can provide.

Ext.Array.each(

this.component.headerCt.items.items, function(col) {

col.on(

"render", setLink, me);

});

Ewoq

20 Jul 2011, 1:25 AM

Hi all

I have the same problem as teemac, I think.

I get the same result from my app, as I get from the exporter example. When I click the button in both the example and my app, I get a part file from firefox and this only contains some column information plus some other values that doesn't appear in the grid.

I'm using the Exporter.js in my app, so that should be okay.

I made a small change to the Worksheet.js after line 150:

if(record.fields.get(name)) {
var value = record.get(name),
type = this.typeMappings[col.type || record.fields.get(name).type.type];
}I changed it because I have an empty column that it didn't like. But I don't think that is a problem.

Any suggestions?

wiznia

20 Jul 2011, 1:32 AM

The data is downloaded via a data uri. That's the "data:application/vnd.ms-excel;base64,PD94bWwgdm...." it should be prompting for a download. Which browser are you using?

Ewoq

20 Jul 2011, 2:07 AM

If you mean me, I'm using firefox 5.0.

I do get prompted for at download, but for a .part file. It ends up being a xls.part.xls file. Like in the example, it contains something like this in the first cell:

mmm, no idea. It seems like something is going wrong in the generation of the file... no idea what, maybe a "strange" character that isn't being escaped?

Ewoq

20 Jul 2011, 5:20 AM

What version of excel are you using? 2007?

It seems that all the information is present before the Base64 encoding, but using the xml without the encoding this produces an incorrect "sheet". So now I'm thinking that the xml format is wrong for my very old excel version (2003)...

Update: Seems I was using a very very old version of excel (2000!) and it worked as soon as I changed to excel 2003. So thanks for your replies wiznia:)

wiznia

20 Jul 2011, 8:01 AM

Great! I'm glad to help.

Teemac

20 Jul 2011, 8:59 AM

I'm using IE9 and get no prompt, is there possibly a browser setting that is preventing it?
To be clear it opens a new tab with the url set to the "data:application/vnd.ms-excel;base64,PD94bWwgdm..."

wiznia

20 Jul 2011, 9:13 AM

I haven't tested it on IE, until IE7 I think there was no support for data uri, but in IE8 and 9 there is... in theory it should work.

nuskin

20 Jul 2011, 4:34 PM

I include the Exporter.js file in the <header> tag <script type="text/javascript" src="./examples/ux/exporter/Exporter.js"></script> and put all other files under ext-4.0.2a\examples\ux\exporter and csvFormatter and excelFormatter sub-folders.

However, I still got the same error:
namespace is undefined
if (namespace === from...substring(0, from.length) === from) { ext-all-debug.js (line 3487)

This error is from ext-all-debug.js (line 3487) file.

Any idea?

wiznia

21 Jul 2011, 2:19 AM

mmm, which namespace is undefined? Are the files loading correctly?
You don't need to include the file in the head, just add it to the 'uses' config option.

Ewoq

21 Jul 2011, 5:07 AM

Again I have a similar problem...

I can only get the exporter to work if I put it in a /src/ux/ folder in my ext directory. I do not want it there.
I have tried moving it to another folder and changing the Ext.Loader.setPath to this new folder, but can't get it to work at all. Is that even the right way to do it?

Any thoughts?

wiznia

21 Jul 2011, 6:03 AM

You can put it wherever you want, but you have to specify it to the loader with the setPath method.

Ext.Loader.setPath('Ext.ux', './src/ux'); // All the Ext.ux.* classes will be searched in ./src/ux

Ext.Loader.setPath('Ext.ux.exporter', './something/exporter'); // Only the Ext.ux.exporter.* classes will be searched in ./something/exporter'

nuskin

21 Jul 2011, 10:29 AM

hi Wiznia,

I copied the array-grid example from ext-4.0.2a/examples/grid/ folder and made my own MyExcelExporter.html file under the same directory as the example itself. I added the dockedItems item to the grid object and added Ext.require(['Ext.ux.exporter.*', 'Ext.ux.exporter.excelFormatter.*', 'Ext.ux.exporter.csvFormatter.*']). Yes, I copied all other files to their perspective directories under ext-4.0.2a/examples/ux folder. However, I still get the same problem/error. I am new to this Extjs 4.0.2a framework. So, any help to get this excel-exporter working is really appreciated. Here are the source codes of my MyExcelExporter.html file:

Thanks Wizina and Teemac. I got it worked in Firfox 5.0, but it does not work in IE 7 or IE 8. For IE 7, it got stuck right away, nothing display at all, not even the array grid; for IE 8, the array grid and button show up, but when I click on the button for download or export, a new IE browser instance was launched but no data, just like Teemac discribed in IE 9.

mmm An error 500 makes no sense, the exporter doesn't talk to the server in any way. The store does, and the exporter uses its data, so maybe there's an error in the call to the server by the store.

edspencer

29 Jul 2011, 4:35 PM

Glad someone revived this old thing :) I haven't touched the code in a year or more. Would love to have this come into the framework but finding it hard to find staffing for it at the moment given everything else we need to do.

wiznia

30 Jul 2011, 9:56 AM

It's far from ready and it doesn't work with IE...
Besides there are a lot more important things to get fixed.

Ewoq

2 Aug 2011, 5:31 AM

I would like to help you with it wiznia, if you'd like?

wiznia

2 Aug 2011, 6:08 AM

IE support would be nice, although I don't know how to tackle it, since there's no support for data uris (which are being used right now). Besides if we can get rid of the datauris, maybe we can optimize a little bit the plugin. Now, it is generating the file every time a load is made on the store, so even if you don't click the export button, the file is being generated...
Apart from that I wasn't going to add mucho more functionality since the functionality provided works for me, so suggestions are welcome.

nimda13

19 Aug 2011, 2:15 AM

col.on is not a function col.on("show", setLink, me);
Button...2614604 (line 51)
Any idea?

@bee, when are you getting this error? When loading the data in the store? When you click the button?
Also, what is that error 3487? Is it the line number? In which file? Do you have the stacktrace?

clarkbanks

5 Sep 2011, 5:43 PM

Is there anyway to specify the name of the xls file being downloaded? In chrome it just downloads a file called 'download' which has to be renamed with an '.xls' extension to work.

wiznia

6 Sep 2011, 1:19 AM

Right now there's not a way of specifying the name of the file, I don't know if this is possible since it's a data uri. I think you need flash in order to do that, I found this library https://github.com/dcneiner/Downloadify that uses a flash component to serve the file. It would solve the IE incompatibility and add some nice features like choosing the name and events on download. It should't be difficult to integrate it with the exporter button. Right now I don't have time to do it, but you can fork my project and then add a pull request.

bee

7 Sep 2011, 11:29 AM

I got this error when loading my grid itself. That line no is of debug file I guess. Even I am not sure about this.

wiznia

8 Sep 2011, 5:47 AM

mmm, you'll have to do a little debugging by yourself and give me more info if you want some help...
Or post a complete example that fails.

SMMJ_Dev

9 Sep 2011, 7:10 PM

Thank you very much! I downloaded your Exporter-all.js file, went through and converted all the ExtJS3 code from your individual ExtJS4 updates. I modified the code so that exportGrid, exportStore, and exportTree do not return the encoded data. Then I updated the button to call the encode directly. So now, in my code, I make a call to exportGrid to get the data. I check the browser to see if it can use the data urls. If so, I do a redirect to the data url. Otherwise I send the non-encoded data to a java servlet so that browsers like IE7 can export the grid to excel :)

Everything worked great! I liked the format update to your code from ExtJS3 :)

wiznia

12 Sep 2011, 11:51 AM

great!!! did you forked it in gIthub? Send my a pull request and I'll add It.

ma1986

13 Sep 2011, 5:03 PM

i load the <script src="../toexcel/Exporter-all.js" type="text/javascript"></script>
but firebug find a erro like Ext.reg is not a function in "Ext.reg('exportbutton', Ext.ux.Exporter.Button)" why? i uses Ext4.0

can you help me thank you

ma1986

13 Sep 2011, 9:45 PM

dear wiznia (http://www.sencha.com/forum/member.php?40722-wiznia)

I have get the excel successfully,thank you.however ,my grid has the Subtotal,how can i export excel with the Subtotal. i know the store don't have Subtotal field .but how i can do it? thanks
like this:
name price
one 10
two 20
Subtotal: 30
three 15
...

I think a methd that can i load a new store which is not the store of grid ? i don't know it will be work or not

SMMJ_Dev

14 Sep 2011, 2:41 PM

Ok, I have created the fork and pull I think :)

SMMJ_Dev

14 Sep 2011, 2:48 PM

I have also added a check on the exportGrid function to not export any action columns. This was messed up before. The columns were not lining up correctly.

semialcruz

16 Sep 2011, 8:33 AM

Same here, can anyone help me with this ?

Firebug Error:

Uncaught TypeError: Object #<Object> has no method 'reg'

SMMJ_Dev

17 Sep 2011, 8:00 AM

The code has not gotten my updates yet if you are using ExtJS4, try this code to see if it works for you:

This should be the only file you include below. It is my recommended update for Exporter-all.js. I have not personally tried the export button. I have only used the code for the export function, so let me know if it works for you.

/**
* @class Ext.ux.Exporter.Button
* @extends Ext.Button
* @author Nige White, with modifications from Ed Spencer, with modifications from iwiznia.
* Specialised Button class that allows downloading of data via data: urls.
* Internally, this is just a link.
* Pass it either an Ext.Component subclass with a 'store' property, or just a store or nothing and it will try to grab the first parent of this button that is a grid or tree panel:
* new Ext.ux.Exporter.Button({component: someGrid});
* new Ext.ux.Exporter.Button({store: someStore});
* @cfg {Ext.Component} component The component the store is bound to
* @cfg {Ext.data.Store} store The store to export (alternatively, pass a component with a getStore method)
*/
Ext.define("Ext.ux.exporter.Button", {
extend: "Ext.Button",
alias: "widget.exporterbutton",
initComponent: function(config) {
var me=this;
config = config || {};

if (this.id == undefined) throw new Error("An ID must be provided to Style");

this.preparePropertyStrings();
},

/**
* Iterates over the attributes in this style, and any children they may have, creating property
* strings on each suitable for use in the XTemplate
*/
preparePropertyStrings: function() {
Ext.each(this.attributes, function(attr, index) {
this.attributes[index].propertiesString = this.buildPropertyString(attr);
this.attributes[index].children = attr.children || [];

did anyone able to get this working??
I am getting this error on FF and IE8

'Downloadify' is undefined

any idea ???

wiznia

29 Sep 2011, 2:09 AM

Ouch, I've been updating this yesterday and didn't have time to comment it in the documentation. I changed the downloading mechanism from data-uris to a flash based solution.
The reason for that was:
1) Some browsers didn't support data uris.
2) There was a limit (I don't know exactly the number) on the size of the data uris that made the browsers crash when set.
So, now it's based on downloadify, which is flash. So you need to include downloadify.min.js (supplied) and configure on the button, the paths to the
swf and the image, this are the defaults:

When I have a little time I will update the docs. Oh, and don't use the exporter-all.js since it's not updated I need to write a build script so it generates the minified version.
Let me know if you encounter problems.

RAD001

29 Sep 2011, 7:59 AM

Hi Wiznia,

I did include the downloadify.min.js but then it complained about 'swfobject'
So I downloaded the downloadify and included the swfobject as well

now I am not getting any error on both ie8 and ff but I don't see the button on the toolbar...
am I missing something here????

wiznia

29 Sep 2011, 5:08 PM

i'll try to put an example to clarify things, for now, here's what you need to do:
- include swfobject2 (not incñuded)
- include downloadify.min.hs
- create an exporterButton with the appropriate configuration pointing to the image and the swf.
- require with ext loader the Ext.ux.Exporter class.
- don't you use the exporter-all file since it's outdated.

don't forget to download the new code aince I updated it yesterday.
I promise to put an example project and update the documentation, just give me some time.

rad001, you have to point the exporter button to the correct image and the downloadIfy swf fIle. look at the exporter button code for the appropriate names of the confIg and remember that paths are relative to your page, not the js file.

RAD001

3 Oct 2011, 6:50 AM

Hi wiznia,

thanx for the tip, now I got the button to show up and it's clickable. BUT now when I click on it nothing happens.

Please help me out.

Am I missing something?? is it working for you?

wiznia

3 Oct 2011, 7:30 AM

Is there a message in the console? Like a js error or something?
Try debugging it, put breakpoints in the Button.js.
Put one in the setDownloadify function, one inside the filename function config that is passed to Downloadify.create, and one in the data function config.
Let me know what results you get....

RAD001

3 Oct 2011, 7:46 AM

Hi Wiznia,

I am not getting any error msg on console, when I debug the button js
Filename and data is getting set as null after Downloadify.create in button.js

inside the filename function config that is passed to downloadify.create the Ext.ux.expoerter.Exporter is undefined, same in data function config.

wiznia

3 Oct 2011, 9:41 AM

I don't quite understand what you say.
I get that the Downloadify.create is getting called.
Then you need to set a breakpoint INSIDE the data function and see if the value that function is returning is correct. This code should be called when you click the download button.
As for the Ext.ux.expoerter.Exporter being undefined, it doesn't make sense, unless you typed it exactly as posted, which has a typo "expoerter".

RAD001

3 Oct 2011, 10:12 AM

Hi Wiznia,

sorry for the unclear post and typo.

Yes the Downloadify.create getting called when I click on the button and I set a break point inside the data function and filename function.
In both functions the 'Ext.ux.exporter.Exporter' is undefined therefor null is getting set for filename and data.

Strange... if it was undefined, then both functions should have thrown an error.
As for the manual require, it shouldn't be necessary, do you have a call to?:
Ext.Loader.setConfig({enabled: true});

Anyway, I'm glad you got it working.

jjerome

6 Oct 2011, 2:05 PM

Wiznia,

All the work you have done on this is great. It is appreciated by all. I have been reading through this thread and trying to ger this working with one of our grids. I have all the JS's loading, I have the swfObject.js loaded, I can see the image in the toolbar. When I click on the image in the toolbar I never go into the "filename" function in button.js. The Downloadify.create runs but I never go into the filename function. Also, it "does" go into the "data" function but Ext.ux.exporter.Exporter.exportAny(self.component, self.formatter, config) returns a "TypeError".

self.formater is undefined but self.component is my grid and config appears to be looking at the column set up. We are using multiline heading for the grid so I am not sure if that will cause a problem or not.

Should I be going into the filename function before the data function? I never hit filename. Any ideas?

Thanks,
Jason Jerome

wiznia

7 Oct 2011, 4:18 AM

Can you post the line number (and trace if possible) of the error?
Also, the config of the button and grid would be usefull.
You can also try to configure the button with the option "formatter" (it accepts "csv" or "excel" as values). This shouldn't be necessary as the excel formatter is the default, so if you can post me the error in more detail I can see if there's an error in the plugin.

supermarcos

10 Oct 2011, 7:28 AM

Hi, everybody!

I have the extjs 4.0.2 framework and I'm trying export a grid to an excel file, but I can't.
Allways I read the "Uncaught TypeError: Cannot set property 'Exporter' of undefined" error and the "Uncaught TypeError: Cannot call method 'substring' of undefined", too... I supuse I have a bad path for the Exporter-all.js file, but I'm not sure now...
Where I should to put this file?
What's the path tham I must include in my index.html header (<script... src=xxxxxx>)?
I must to put a require call in my view?
The sample that is included in the zip file that you can dowload references extjs 3, not extjs 4... then, this plug-in is suported in extjs 4 version??

A lot of thanks.

wiznia

10 Oct 2011, 8:54 AM

The exporter-all and examples are outdated, I will update them and the documentation when I have some spare time...
- You should use the Ext.Loader to load the Ext.ux.exporter.Exporter (Exporter.js file), then the loader will load all the other necessary files.
- Include the exporterbutton for in a toolbar of the gridpanel.
That should be all...

But the do not load and throw me an exception like this:
Uncaught TypeError: Cannot call method 'substring' of undefined
In ext-debug.js file, in line 5981...

What happen?
Thank you so much.

wiznia

11 Oct 2011, 2:02 AM

Try posting a backtrace or something... I can't know where it's failing only with the line of the ext-all.js
If you remove the exporterbutton it works?

supermarcos

11 Oct 2011, 2:26 AM

Hi, wiznia

Yes, If I remove the exportbutton from the grid the error does not appear...
Exists any other way to call any export method without an exportbutton or any way to create an exportbutton not directly in the grid?

What do you need when you said "backtrace"? (sorry if the question is a quite stupid question...)

Thanks a lot!

wiznia

11 Oct 2011, 2:49 AM

You need the button, because it's using a flash library to make the download possible from the browser without using data uris. (I think I didn't mention that to you... sorry I forgot since I just added it). So you need to include the swfobject2 library (not included). And configure the button with:
{
xtype: "exporterbutton",
swfPath: '/flash/downloadify.swf', // this file is included
downloadImage: '/images/ext_reports/download.png', // this one too
width: 62, // mantain the width and height
height: 22,
downloadName: "download" // this is the name of the file
formatter: "excel" // Or "csv"
}

Backtrace is the full trace of the exception, in the firebug console you can open the error and see the trace...

supermarcos

11 Oct 2011, 3:04 AM

Hi, again, wiznia
:-)

Thank you so much for your help...
Well, I don't know nothing about swfobject2... where I can find it to download it?

I'm trying another way to put a button... Now I trying to put a standard ext button in my toolbar and then capture the click event, like this:
alerta: function() {
var gridPanel= Ext.ComponentQuery.query('actividadeslist')[0]; //button.up('gridpanel');
var dataURL='data:application/vnd.ms-excel; base64,'+Ext.ux.exporter.Exporter.exportGrid(gridPanel);
window.location.href=dataURL;
},

One just needs to download the attachment and extract it to the webapps or other directory of the webserver.

Invoke the app using the following url:
http://localhost:8080/exportTest/index.html

( (http://localhost:8080/exportTest/index.html)where localhost is the address and 8080 is the port on which webserver is listening for requests).

The plugin is located in exportTest\extJS402a\examples\ux\exporter

wiznia

11 Oct 2011, 6:47 AM

I'm glad you got it working, but I think you are using an outdated version. I moved away from data-uris and used a flash component for the export because of 3 problems:
- IE doesn't support data uris.
- You cant specify the name of the file and the extension you get is a .part
- There's a limit on the ammount of data you can post in a data-uri, so when big data was exported, the browser plainly crashed.

So I incorporated downloadify (included) which uses the swfobject2 library (http://lmgtfy.com/?q=swfobject2) and is a flash solution.

parkcity

11 Oct 2011, 10:58 AM

I have updated the package to exportTest2.zip . This package works well. It uses extJS from CDN.
Deploy it in your server and invoke using the app using the following:

http://host:port/exportTest2/index.html

supermarcos

12 Oct 2011, 10:50 PM

Hi, parkcity

Your work is excellent !!
But I have a little issue... How can I do to save/download the export result like a file?
When I put the "exporterbutton" in my toolbar it appears, but it does not do nothing when I click it (and does not say nothing in the javascript console... no error, at least...), then I put a button with this code:

Thank you for your help. Ok, yes, I have defined the columns in the grid, the problem was the config 'store'... I have defined it in the exporterbutton definition and it is not necesary... without it all works well, but, I have a little problem:
I need to make my own style in the button, so, I need to use a standard button and then call (when the user does click) the print method... but I don't know how can I do that...
What is the method in the exporter.js that I must call in the click event of the my button??
Can you help me, please?
I try to call the printAny / printStore / printGrid method of the exporter.js file, but it does not work (but does not throw any exception...).
I use this code (I supousse that only that must not be enough):

1) We are using multiline column headings and csvformater.js "format:" config.columns is only picking up 3 of our 7 columns. store.model.prototype.fields.items does reference all 7 of the columns. Our columns are like this:
Facility ....Admission .....Discharges
...........Daily MTD YTD ..Daily MTD YTD
abc fac .....5 ...10 100 ....4 ...8 ..95
(ignore the ... I just put them to aide in spacing)
As you can see there are actually 7 columns but Config.columns is only picking up the "Facility, Admissions, Discharges".

I changed the code to use store.model.prototype.fields.items to get the column cound but now I am not getting the headings I want. I am getting the fields name instead.

2) csvformater.js "geCell:" attempts to call the column renderer. Our renderer function blows up because we are expecting more parameters then your col.renderer(record.get(name), null, record). I added some additional parms to your call to pass which column we are working with.

Note: csv formatter should have the separator set to "," in my opinion instead of ";"

mmuzamil

18 Oct 2011, 8:14 AM

Wiznia,

First of all great work, I really liked your work. It has made export from Grid to excel very easy. But I have few questions regarding this plug-in. I'll appreciate if you can respond to them.

1. I have a grid with paging toolbar, and I want to export data of all pages to Excel/CSV. Can I do that using this plug-in?

2. Is it possible to export data of a column in a different format as compared to what is used on UI e.g in a column, I am displaying product code with a hyperlink but In my exported file the hyperlink may not make sense. So can i export data of that column in plain text?

3. I used this plug-in on a grid which had first column of type 'actioncolumn', which had icons for edit and delete. When I exported data from this grid in Excel format, it generated the column headers appropriately in the excel file but instead of leaving first column blank (or copying HTML for delete/edit icons), it copied text of 2nd column in this. Actually all data of my grid got shifted on the left i.e. data of 3rd column was copied to 2nd, 4th to 3rd and so on. Is it a know issue or am I doing something wrong?

Thanks in advance

jjerome

18 Oct 2011, 8:18 AM

To resolve my first problem above I changed the exportGrid function in exporter.js. If a column has a groupheader I now pick up the multiple headings (and combine them) and also pick up the sub column data. I had to remove the array filter code you were using and to it a bit more manually. (note: since both CSV and EXCEL type use this function it fixes it for both.

Sorry, I forgot, you also have to include the downloadify.min.js (https://github.com/iwiznia/Ext.ux.Exporter/blob/master/downloadify.min.js) in your page

ssuarez

29 Nov 2011, 7:48 AM

Thank you so much Winzia! I've got it working now!

I needed to add the swfobject.js as well.

wiznia

29 Nov 2011, 8:58 AM

Yes. I need to update the help and add a working example....

edykstra

11 Dec 2011, 11:33 AM

Hello Wiznia,

Some questions:

1. Why is exporter-all.js included if it is outdated and we are not to use it?
2. How to I force CSV export?
3. The store has pagination applied. Is it possible for export to over-ride the limit value so that pagination is ignored and the entire data set is downloaded?
4. What is 'downloadify'?
5. Where is the latest code? GitHub? Is it current?
6. I am using Chrome, and I get a download prompt, but the data will not open in Open Office as an Excel file. It seems to think it is a CSV with a single cell.

Thanks

wiznia

12 Dec 2011, 3:59 AM

1. exporter-all.js is not included, if you have it, you have an old version.
2. Configure the button with the 'formatter: "csv"'.
3. Right now, the exporter only exports what's loaded in the store. You could load the store with all the rows to export everything...
4. https://github.com/dcneiner/Downloadify It's a flash library that allows the generation and downloading of a file on the browser. It's better than a data-uri.
5. https://github.com/iwiznia/Ext.ux.Exporter
6. That's odd. I'm using libreOffice and it opens correctly... open the file with a text editor to see if it has all your data.

edykstra

12 Dec 2011, 4:57 AM

I'm not sure where I went wrong, but the Readme file clearly states to use exporter-all.js. It also references the ExtJS3 version of Exporter, and references a non existent example file.

Please update the Readme, so that others are not first confused like I was.

Thanks.

wiznia

12 Dec 2011, 7:35 AM

Like I said several times in this post, the readme is not updated and the examples are missing. I don't have the time right now to update it. You are welcome to create an example and readme in a fork and send me a pull request so I include it in the project.

edykstra

12 Dec 2011, 7:51 AM

I think that the main confusion is a result of the current state being defined in so many places, including this post.

I see the most recent update at GitHub states; "Removed example and exporter-all since they were outdated." For the exact same logic, you should remove the Readme too. Relying on someone to find this post in addition to the GitHub project is unreasonable.

Although I would like to provide an example, clearly I can't get it working so I can't provide an example.

Does anyone else subscribed to this post have an example?

Wiznia, I appreciate the effort to provide this user extension, and that you don't have time right now. But, neither do the people who want to use the extension. For others, at the very least, please add a line in the Readme that states it is out of date.

Thanks

wiznia

12 Dec 2011, 8:05 AM

ok, updated.

amishra06

13 Dec 2011, 10:21 AM

Hi Wiznia,

I needed the csv/excel download feature and implemented as mentioned in the post. But I get error as mentioned below:

Uncaught TypeError: Cannot call method 'substring' of undefined.

When I expand this error (I am using chrome developer tool) I see several lines of messages basically function call mostly pointing to
7th line of ext-all.js except one line which points to my app js file where I have defined the grid.

Is it because I am using grouped column headers its not able to get the store columns correctly ?

Ashish

wiznia

13 Dec 2011, 3:25 PM

It could be the grouped column headers, I never tried this plugin in such a grid. Does it work on a regular grid?

shawon

20 Dec 2011, 1:54 AM

ssuarez i m facing the problem as yours. I wonder where can i find that "swfobject.js" file???

balajivaikar

20 Dec 2011, 11:56 AM

shawon, swfobject.js is bundled with downloadify zip file, also you can manually download it from
here http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip
(http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip)

sebas2515

21 Dec 2011, 1:16 PM

i don't know where is gonna placed the exporter.js
file in my mvc architecture proyect's

30221

HIG

22 Dec 2011, 1:53 AM

1?need server-side(flash player bug)
2?check your file path

sebas2515

22 Dec 2011, 8:45 AM

thanks. it worked nice

sebas2515

23 Dec 2011, 7:14 AM

Hi HIG,

can you help me to learn to customize the template of the excel report that generete exporter pluggin?

balajivaikar

23 Dec 2011, 6:52 PM

I'm having a datagrid with multi level of headers, and these header-text and row data for these headers are not getting exported to excel. Could anyone help me out ?

isaac

29 Dec 2011, 3:52 PM

I have tried both the example downloads as well as tried to use this in my grid. The sw is working great. But MS Office for Mac 2011 cannot open the xls file (which I rename to xlsx, since xls is binary format) It complains about the format of the file being incorrect. OpenOffice on my linux box will open the downloaded file. But open office and office 2011 on my mac will not. Also, google docs will produce an error when trying to import the xlsx. I think the resulting xlsx file being generated is invalid. But I'm not sure how to proceed.

wiznia

30 Dec 2011, 2:55 AM

Yeah, there are problems with different versions and programs, that's why I ended up using the csv exporter, which is included.
For multi-header grids, I never tried it and it's probably not working right now, pull requests are wellcome in the github project.

Vasanthoo7

19 Jan 2012, 10:38 AM

HI Wiznia, this is a great post. I got everything through with the set up and when I tried to download the file as excel, it downloads it.

When I open the excel file I get the following error.

The file you are trying to open 'download.xls' is in a different format than specified by the extension, Verify that the file is not corrupted. I am using EXTJS4. Can you please help me out with this.

wiznia

19 Jan 2012, 11:21 AM

As I said, there seems to be problems with different versions and programs to open the xls.Try it first with the csv exporter to see if the data gets exported correctly

Vasanthoo7

19 Jan 2012, 12:20 PM

Hi Wiznia, Thanks for the quick reply. the CSV export works well except a few issues:

The first column in the header is taking this character: &#160;

Also the date columns are showing as ####### as the value for start and end date.

===

If you could also point me in the right direction for uploading excel or csv file onto a grid using EXTJS 4. that would be great.

wiznia

20 Jan 2012, 3:01 AM

What is the config for the first column? It should be using the column text or name properties. As for the dates, is the xtype of the column "datecolumn"? Do you have a format specified?
I don't know if it's possible to upload an excel or csv to a grid. You should probably receive the file server side and then serve it to the grid.

Vasanthoo7

24 Jan 2012, 12:45 PM

HI Wiznia, Thank you for replying. I was able to do it successfully with CSV, now the excel, really need to get it working as a excel, It is downloading a excel file, when i open the excel with notepad i see the Grid data in the notepad.

When i open as Excel, it gives me the following error:

The file you are trying to open is in a difffernt format than specified by the extension. Verify that the file is from a trusted source before opening the file. Do you want to open the file now.

When i click on yes, I still am nt able to open the file.

wiznia

25 Jan 2012, 2:26 AM

mmm, you can try the fixes that are in this pull request:
https://github.com/iwiznia/Ext.ux.Exporter/pull/3
If it works I can merge it with the main branch.

acteon

26 Jan 2012, 6:53 AM

I think exporter should not require Button since exporter works without it .

wiznia

27 Jan 2012, 2:55 AM

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

acteon

27 Jan 2012, 9:04 AM

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/1765342/which-browsers-support-data-uris-and-since-which-version)

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

wiznia

27 Jan 2012, 9:22 AM

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.

pavanextjs

6 Feb 2012, 8:25 AM

Hi Wiznia,

I was trying to add your fixes from github (https://github.com/iwiznia/Ext.ux.Exporter/pull/3), 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.

wiznia

6 Feb 2012, 10:51 AM

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.

pavanextjs

7 Feb 2012, 8:15 AM

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.

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.

pavanextjs

7 Feb 2012, 9:16 AM

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 (http://validator.w3.org/check) for XML validation.

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

mmmm, I can't find anything worng with the code. I know it had some problems with custom columns, and with the groupheader plugin, but yours is pretty straightforward.... Try debugging it.

pavanextjs

8 Feb 2012, 8:38 AM

OK i will try to debug it.

droessner

23 Feb 2012, 8:43 AM

wiznia,

Thanks for porting this plugin. Iv'e had it installed for a couple of months now and it's been working great. I just recently noticed that there seems to be an issue with this plugin when using Ext.History. However, this seems to be an issue only in Internet Explorer (I'm using IE8). It looks like when the button is rendered, the title of my page is changed to my title + the history link. I added the plugin to the history example, and after the button is rendered the page looks as follows (notice the title).

32070

When I click on the button, the title is changed again. See below:

32071

I've done a little debugging and as far as I can tell it may be swfobject.js that is causing this title change. I'm a little hesitant on changing swfobject so I figured I'd ask if this is something that you've come across and/or if you have any suggestions on what changes I could make to fix this issue.

Any help is appreciated!

Thanks,
Danny

wiznia

24 Feb 2012, 3:05 AM

I have no idea what could be changing the title... It only happens when you use Ext.History?
I doubt it's a swfobject issue, since it's widely used, but I really don't know what could be causing the issue... sorry.

droessner

24 Feb 2012, 5:18 AM

I actually just created a simple grid (without any of the Ext.History stuff) and added the exporter button and then just added "#text" to the end of my url and it still happened. I guess I'll keep digging, thanks anyway!

BlackLine

24 Feb 2012, 5:28 AM

Hi, wiznia.
I'm using your plugin and it works fine, thank you!

But I have a question about button - can I use there a simple button, without underlying png-image?
Could you tell me what code I should change to do it?

wiznia

24 Feb 2012, 6:24 AM

droessner, it only happens in IE? Can you post an example code?

BlackLine, you can't use a simple ext button, because the png is there to allow the download of the file (via downloadify). In previous versions a regular button was used, and a data-uri link but there's no support for data-uri in older browsers and there's a limit on the size of the data-uri that made browsers crash when the file was too large.

droessner

24 Feb 2012, 6:41 AM

Yes, I've only seen this issue come up in IE. I'm using IE8. Here is a really simple example. When you run this just add "#text" to the end of the url and load the page. When I initially load the page it adds "#text" to the title. When I click on the button it changes the title to just "#text"

How this works if i use a Ext Js Chart. The 'exporterbutton' have to be inside the chart implementation? But how i put a button or toolbar to the Chart?

wiznia

27 Feb 2012, 9:26 AM

The button can be configured in 3 ways:
1) By putting it inside a gridpanel or treepanel (no extra config needed).
2) By passing a 'component' config option with an ext component that responds to getStore method.
3) By passing a 'store' config option.

I haven't used it with a chart, but I guess that if you provide the store of the chart it should work.

droessner

1 Mar 2012, 12:56 PM

I have no idea what could be changing the title... It only happens when you use Ext.History?
I doubt it's a swfobject issue, since it's widely used, but I really don't know what could be causing the issue... sorry.

Just a quick follow-up for this. I debugged and it looks like it's happening in swfobject but I assume that the bug itself is because of Internet Explorer. I narrowed it down to the exact line that changes the title when it is rendered. When swfobject sets aa.outerHTML the title of the document changes. I just put some listeners on the exporter component to change the title back so I don't have to mess with swfobject.

RNL

1 Mar 2012, 10:41 PM

Hello,

Is it possible to download all the records if it has pagination??
It only include the current page..

thx

wiznia

2 Mar 2012, 2:39 AM

droessner, glad you found a workaround, not very pretty, but if it works...
RNL, the export only has the loaded records, I thought it would be too dangerous to ask the server for all the data, since there may be millions of records...

mmm, I don't remember quite well, but for some reason I commented out the part that filtered the actioncolumns... although I don't know what xtype the column of the checkboxselectionmodel is...
Your solution seems pretty much right, there it's filtering all the hidden columns.
Put a breakpoint in there and look at what xtype should be and filter it.

Aranair

13 Mar 2012, 11:19 PM

Hi Wiznia, Thanks for the quick reply. the CSV export works well except a few issues:

The first column in the header is taking this character:

Also the date columns are showing as ####### as the value for start and end date.

===

If you could also point me in the right direction for uploading excel or csv file onto a grid using EXTJS 4. that would be great.

I think I am facing the same problem with the output.
I believe that may be because of the checkbox column, which I have no idea how to avoid :/
Is there anyway I can get it to bypass the checkbox/first column?

-Nevermind, solved it. I just disabled the checkboxcolumn instead for that download section. Btw Wiznia thanks for the work!

Also, I was just wondering if you have any intentions to make the excel formatter work? Currently, my data is getting correctly rendered in CSV format but it seems that whenever I use excel formatter, none of my programs can open it :/

wiznia

14 Mar 2012, 2:34 AM

There are a lot of problems with the excel formatter and different versions and platforms of excel or other spreadsheet programs. For now, I'm using the csv which is easily imported into any program.

Aranair

14 Mar 2012, 3:02 AM

Yeah.. I removed some code and changed some stuff and it could work for excel 2010. But, it broke compatibility with OpenOffice unless I change it to xlsx manually lol. I believe most of the problems are just in the tags:/

wiznia

14 Mar 2012, 3:29 AM

Ok, if you find a solution, make me a pull request on github...

Aranair

15 Mar 2012, 12:49 AM

we decided to just cater to excel users heh and leave openoffice with csv instead lol.

Btw, have you got downloadify to work on firefox/safari? The buttons aren't showing up at all for me in those browsers. The script isn't even there if i inspect the elements heh.

wiznia

15 Mar 2012, 2:46 AM

Yes, it's working on all browsers. Do you have all the paths configured?

Aranair

15 Mar 2012, 7:29 AM

Yes, it's working on all browsers. Do you have all the paths configured?

jeesh, this is embarrassing to say even, found out I didn't have the flash plugin on firefox heh =.=

Then again, there lies the inert problem of using a flash downloader I guess haha.

Jay Tanwar

21 Mar 2012, 4:59 AM

Hi,
Nice work wiznia.
I have a query..
Does it work on Sencha Touch 2.0..?

wiznia

21 Mar 2012, 6:41 AM

I have't tried it, but it should. On the other hand, it uses downloadify to download the file, which is flash, so it would work only on devices that support flash.

Added the 'uses' config:
uses:[ 'Ext.ux.exporter.Exporter'],
Another Issue is. As you said, if requires flash. Then it will not work in iOS (iPhone and iPad) devices?
So do we have any other solution available for iOS devices?

wiznia

22 Mar 2012, 2:57 AM

mmm, are the files actually loaded? Where is the error thrown?
As for iOS, I don't know how could you do it, maybe there's some html5 way to serve a download from a webpage, but I don't know.

kalchas

31 Mar 2012, 2:51 AM

Many thanks,
it's a terrific component, it works flawlessly.
I tried to put the exportbutton in a docking toolbar of another panel and in the configuration I put
component: Ext.getCmp('gridpanel')
or I put
store: Ext.getCmp('gridpanel').getStore().

Neiither of them has worked.

Thanks,
Harry

rdominelli

4 Apr 2012, 12:07 PM

Since upgrading to 4.1 (which fixed a whole bunch of IE issues I am receiving an error when loading the output of this plugin.
Excel 2010 Message says problems came up in the following areas during load, with a listbox containing the word Style and a reference to a log file in temporary internet files. The log file contains

OK loading the output into an xml editor I see the issue, in the style section for much of the style information a given tag will be outputted x2 for example
<ss:Alignment ss:Vertical="Top" ss:WrapText="1"/> 0"><ss:Alignment ss:Vertical="Top" ss:WrapText="1"/>
<ss:Font ss:FontName="arial" ss:Size="10"/> 0"><ss:Font ss:FontName="arial" ss:Size="10"/>

In each case the first occurrence has that orphaned 0">

In my grid I have alternating rows turned on but no other formatting except what comes by default. seeing if turning it off fixes the issue.

Aranair

4 Apr 2012, 5:22 PM

Since upgrading to 4.1 (which fixed a whole bunch of IE issues I am receiving an error when loading the output of this plugin.
Excel 2010 Message says problems came up in the following areas during load, with a listbox containing the word Style and a reference to a log file in temporary internet files. The log file contains

Those are happening because Excel has changed some syntax for their XML stuff I think. You can go through their documentation and manually edit the excelformatter and get it to work for a specific version of excel. But otherwise you're stuck with csvformatter

rdominelli

5 Apr 2012, 5:15 AM

Actually I do not think this is an excel 2010 thing. Prior to upgrading to 4.1 excel would give a warning but would open the file.

Since upgrading to 4.1, the xml produced by the formatter is no longer valid xml. For example

I also went through this kind of issues, its definitely failing on some where in the formatter, but that doesn't throws an error. Best is you have debug through the formatter, dig it down and see from which point it failing. I resolved that way.

Mental

17 Apr 2012, 12:11 AM

It seems that this error is in Swf file, I have used flash with debuging and firefox gave this error.

34105

Mental

17 Apr 2012, 1:07 AM

I found why I have this problem, it happens because I didn't set fields for the store and Exporter was not able to send fields to swf.

shawon

10 May 2012, 1:55 AM

Hi Everybody,

I need a help its very urgent, exproter was working fine on my environment, thanks for the very good work. But the problem is my clients environment doesn't allows swf, so that in their environment its not working.

Can anyone help me with bypassing the swf to format grid to xcel? Its very urgent...

Thanks in advance..

yoisen

15 May 2012, 1:11 AM

:((,I always have the error when I display the button: ext-debug.js:4486 (http://localhost:8099/App/static/extjs-4.1/ext-debug.js)
Uncaught TypeError: Cannot call method 'substring' of undefined

I am in the same situation. Did you figure out if you can use exporter without using swf?

- Srinivas

yoisen

16 May 2012, 4:49 PM

I now export excel from server.That is reliable

mrhomer

17 May 2012, 1:19 AM

I have implemented the export button but when I click on it nothing happened, and I don't have any error. What can be wrong please help

opms

21 May 2012, 10:03 AM

hi parkcity
Awesome work...........i tried implementing it, but nothing happens when i click on the exporter button in the toolbar..........i have defined headers and dataindexes for the grid ...................no errors too...........my code is.....

Can somebody make a pull request on github? Does the fix also works in Ext 4.0?

mrhomer

4 Jun 2012, 6:34 AM

Can I use a button that is not on the grid panel with this plugin and a store that is not shown in grid on the page?

wiznia

4 Jun 2012, 7:31 AM

Yes, you can put the button anywhere.
The config goes as follows:
- if the store config is sent, it will use that.
- if the component config is sent, it will use the store of that component (and if it's a grid the colModel).
- if none of those configurations is found, it will use the first gridpanel that's a container of the button itself, and if it's not found a treepanel.

If none of those work, it will probably throw an error (I haven't tried it), the exporter needs a store to function.

mrhomer

4 Jun 2012, 10:44 PM

Yes, you can put the button anywhere.
The config goes as follows:
- if the store config is sent, it will use that.
- if the component config is sent, it will use the store of that component (and if it's a grid the colModel).
- if none of those configurations is found, it will use the first gridpanel that's a container of the button itself, and if it's not found a treepanel.

If none of those work, it will probably throw an error (I haven't tried it), the exporter needs a store to function.

You have to specify the store OR the component, not both. If it's a grid it's better to specify the component, because it uses the column model of the grid to format the output.

mrhomer

5 Jun 2012, 1:25 AM

Nothing happens on the click of the button. I have no error what could be the problem ?

wiznia

5 Jun 2012, 1:49 AM

Try debugging it....

mrhomer

5 Jun 2012, 2:00 AM

Nothing :( I am using ExtJs 4 MVC maybe that is the problem or pls give me an example

droessner

5 Jun 2012, 4:39 AM

The swfobject.js has some try/catch blocks in it that don't do anything on an error. It's possible that an error is occurring somewhere in there and it is not being caught by the debugger.

mrhomer

6 Jun 2012, 3:07 AM

Can I add a action to the button ?

trinitrotoluen

8 Jun 2012, 11:02 PM

Can somebody make a pull request on github? Does the fix also works in Ext 4.0?

I'm using Ext-4.1.0 now.
I already tested on MS Office 2007 (windows), Style.js fix made by rdominelli does work but still show a warning when opening the file.
On MS Office 2011 (Mac) it doesn't work still error.
How about other version does it work ? anyone

Thanks Wiznia Great work ~o)

talha06

11 Jun 2012, 6:49 AM

Hello everyone,

I'm getting 404 Not found Error despite the path that I wrote is true.. I'm including some other sources from same path. :-?

The path you are setting is relative... the relative path is relative of the url of the browser you are seeing, not from the js file.

mrhomer

13 Jun 2012, 4:04 AM

the plugin works great on all borwser except on IE9 could you tell me what seems to be the problem?

I'm using extjs 4.

Thx

talha06

13 Jun 2012, 6:44 AM

The path you are setting is relative... the relative path is relative of the url of the browser you are seeing, not from the js file.
OK thanks for your care wiznia.. Now I don't get any errors but the expoerted excel file is damaged; I couldn't open it.. It is giving an error like this : "The file has a different extension than .xls; do you still want to open it?" Then I clicked yes but I couldn't see anything. How can I solve this error?
Thanks in advance..

neerajbherwal

12 Jul 2012, 11:14 AM

Hello ,

The exporter is working fine for me for EXTJS 4.1 and in Chrome and Firefox. But the button does not appear in IE.

Would you know what could cause this to happen?

Thanks,

another_i

13 Jul 2012, 2:52 AM

I rewrote exporter button for my purposes:
I don't use UX (and haven't enough free time for now to write a new exporter ux). I use ExtJS 4.1.1 GA application with MVC architecture.
In grid's dockedItems i have toolbar with button whitch have itemId: "exportXls" and in controller i have next control function:

Grids have checkbox select model and export function exports selected or all (if selection is null) rows.
You can use this code for define a new exporter button (which is in grid's toolbar) if you need.

I hope it will be helpful for you.

gabsoftware

17 Jul 2012, 1:14 AM

Thanks, but the generated XLS file is corrupt... Renaming it to .xslx does not help.

another_i

17 Jul 2012, 3:11 AM

@gabsoftware, a generated file is corrupted in MS Office? I use LibreOffice 3.5 and it open the file correct.

ferchotipin

17 Jul 2012, 3:36 AM

the plugin works great on all borwser except on IE9 could you tell me what seems to be the problem?

I'm using extjs 4.

Thx

What did you do to make it work, I have the same problem that I click the button and I don't get any error, but it doesn't do anything...

Thx

another_i

17 Jul 2012, 5:07 AM

Also saving Base64 String as an Excel .xls/.xlsx file using JavaScript impossible in IE7 without a server-side proxy. So, generally, it is better to use server-side code for a generation files, or you can also output an HTML table and ask the user to copy and paste it into Excel.
Server-side libraries are:

http://phpexcel.codeplex.com/ and on github: https://github.com/PHPOffice/PHPExcel
(https://github.com/PHPOffice/PHPExcel)
[/URL]http://www.tinybutstrong.com/tools.php (https://github.com/PHPOffice/PHPExcel)
https://github.com/IamSmith/node-excel for node.js
[URL="http://phpexcel.codeplex.com/"] (http://www.tinybutstrong.com/tools.php)And i think there are an other ones.

gabsoftware

17 Jul 2012, 5:09 AM

I use LibreOffice 3.5 as well (I do not have MS Office). I got a general error whenever I try to open the file. The
generated file is in attachment.

Note : I tried to indent the file to find out why it causes this error, and removed the "=" from the CDATA sections. Changed nothing, same error.

37226

gabsoftware

17 Jul 2012, 5:26 AM

By the way, here is my attempt at exporting a grid to CSV (based on the function from another_i) :

with that ext.define in any you put 'someGrid' and automatically brings the download button and detects store and columns.
but it sends only the records that seens in the page.
and to send the full sotre I believe that you need a different method ... or i dont know what am doing wrong.

Regards.

Ecthelion

11 Sep 2012, 4:50 AM

rdominelli's Style.js worked for me, too but the template should be more like this in my opinion:

This part reduces the file size as it closes the tags without an end tag, so it's better we leave it there.

alex9311

13 Sep 2012, 2:18 PM

Hey all,

I would really like to get this working for my grid project but I'm having a lot of trouble. I have been scouring the internet for a couple days and havn'y found anything very helpful in this topic. Even trying to set the loader is crashing my page. I'm using MVC architechture.

Where should I be setting the loader? In the grid view file or in the top app.js file? Are either of the commented out sections in my grid code the right way to create a print button?

Hi, Can someone cleanup and show an working example of Excel export without flash.. I have tried of example given in this thread but no luck. I keep getting one another error.

Yes, pleeeease .. we really need someone to do that

pksiv

2 Oct 2012, 12:20 PM

37715

Now, i get this error when i open the file downloaded.. help me please

Getting this same problem.

scaddenp

11 Oct 2012, 8:26 PM

I too browsed this thread looking for a way to use a non-flash download. It turns out that the core of Ext.ux.exporter is actually just responsible for extracting the data from a grid / store in the correct format. This data is then being passed to Downloadify for presentation to the user.

From memory, it is not easy to directly download data from the client-side (although I may be wrong). However, it is quite easy to initiate from the server-side by setting the src of a hidden iframe to point to a jsp (I presume other server-side languages will work just as well) that initiates a download with the correct response headers and output stream.

Therefore, I have now created a version of Ext.ux.exporter which will safely initiate a download using this server-side code. Check out https://github.com/stormtek/Ext.ux.Exporter for the latest version. This has been tested in Chrome, Firefox, and IE9, and it should work in older browser as well. Also, I have added an example of this being used (which will be great news for many people).

this-is-sparta

15 Oct 2012, 11:16 PM

rdominelli,
Although excel opens it, the file exported using your version of Style.js is stiil invalid xml (one may encounter unnecessary 0">)
Actually threr is a simple bug in Style.js: it should be &gt; instead of > in this line:
'<tpl if="children.length > 0">',

talha06

17 Oct 2012, 4:03 AM

I have just clone the source from github and applied to one of my grids : Getting an error like this with Ext JS 4.1.1.a on Ubuntu 64-bit while trying to open newly created Excel file:

General Error
General Input/Output Error

terjeio

17 Oct 2012, 5:10 AM

Here is some changes to the CSV-formatter, now quotes strings and escapes double quotes in strings, exports dates in ISO-format. It could be extended by setting ";" as default separator to avoid problems in locales using comma as decimal point.

@scaddenp : your stormtek/Ext.us.Exporter in github is not working in chrome or IE. The download as CSV / Excel buttons are not producing any file-download on click. Kindly suggest me what changes I need to make.

feiji1983

26 Oct 2012, 12:34 AM

I looked at the button code, and it is still messed up.
For now if you need this you can do what I'm currently doing.

There are still issues when use it on ExtJS 4.1.1a, I made some fix on CSV formater, and make it work. Here is the modified code on GitHub:
https://github.com/MasonZhang/Ext.ux.Exporter

Please note: there are some issues when excel parse the exported xml format file, I just make csv format work.

sarz

3 Nov 2012, 1:16 AM

Hi ,
I used your code to export into a xls file while opening in excel it shows some style error problem . How can i view that file without styles attached to it . please say how to remove style from that xls file ..

mpasacrita@escholar.com

5 Nov 2012, 10:23 AM

I've spent the last 2 days going through and trying all the posted solutions here and I found the following result:

All solutions posted here are either:
1) Not compatible with ExtJS4.1
2) Depend on a Flash SWF or the JQuery library
3) Have some issues in either firefox or webkit
4) Suggesting we use a server-side solution

Is there anyone who has gotten this working entirely with the ExtJS 4.x library, and no 3rd party dependencies or cross-browser issues? Thank you in advance.

sarz

5 Nov 2012, 8:49 PM

Yes its true i used 4.1 extjs lib so only it was not working . It works 4.0 and less

psnprasad

6 Nov 2012, 7:23 AM

Hi,
I have the same problem. Any plans to provide fix for 4.1

Thanks in Advance.

9josh

28 Nov 2012, 12:25 AM

May I know how to export the store after i reconfigure the grid? When I try to export the store, it only shows the first column of the grid not after reconfigure. Thanks.

Garry Hawkins

5 Dec 2012, 6:24 PM

is this can work in extjs 4.1.1? thanks

scaddenp

5 Dec 2012, 6:30 PM

Sorry, 4.1.1a broke other things so this one isnt at top of the worry list at the moment. Wont be looking at this till have renderers in tree + Geoext sorted out.

delusion

12 Dec 2012, 8:16 AM

Has anyone used this with a tree panel? I have it working for a grid, but when i try to give it a tree componenet, or a tree store, it goes into the excelFormatter, tries to render a workbook,

But it seems that event never happens. I do not see Save download dialogue...

I have also tried to use Downloadify JS without Ext.ux.exporter.Button but it looks when the ExtJS extension requires (absolutely useless in my current case) swf path, download image... it is completely locked by button logics somewhere in the source code that is why I suppose to use Downloadify JS separately (without knowing implementation details) is still not a good idea!

xdengli

6 Jan 2013, 6:13 AM

export to csv , use notepad to open normal ?but use excel to open garbled Chinese
character
what can i do ? tks?

Sheng_Yunzhou

6 Jan 2013, 6:11 PM

Vitalz: I think the problem is because the exportbutton is actually a swf file (which triggers the opening of download window), not a button, therefore fireEvent('click') may not work.

I'm also waiting for solutions.

vitalz

8 Jan 2013, 2:03 AM

export to csv , use notepad to open normal ?but use excel to open garbled Chinese
character
what can i do ? tks?

Well... that is a hack way. Surely I personally may do it.
But I am developing system for customers who will never go such painful way. What means when user clicks export button browser downloads an Excel file.

vitalz

8 Jan 2013, 2:12 AM

Vitalz: I think the problem is because the exportbutton is actually a swf file (which triggers the opening of download window), not a button, therefore fireEvent('click') may not work.

I'm also waiting for solutions.

Yes, flash is going to be completely removed. Otherwise flash is a reason to never use Ext.ux.exporter user exentension. So, it looks Downloadify is based on flash... we have to hope something will change. B)

First heard flash became main reason we refused Ext.ux.exporter and replaced it by server side Apache POI. :)

The other important feature after no flash is good news that multi stores/tables may be exported to one file. For instance, there are some tables on the screen and those tables need to be exported to one *.xls

kalchas

28 Jan 2013, 4:43 AM

I modified the Ed Spencer, Mason Zhang files and now export to Office 2003,2007,2010, Libreoffice is possible.

vitalz

28 Jan 2013, 4:45 AM

I modified the Ed Spencer, Mason Zhang files and now
did you remove flash? ;)

kalchas

28 Jan 2013, 5:14 AM

No, flash remains. It's needed for the Save As dialog popup to be triggered.

vitalz

28 Jan 2013, 5:17 AM

No, flash remains. It's needed for the Save As dialog popup to be triggered.
Well... Is there no way to open 'Save As' dialogue without flash?

kalchas

28 Jan 2013, 5:20 AM

Well... Is there no way to open 'Save As' dialogue without flash?
I think downlodify needs flash to work. Without it you are restricted to the size of records the grid stores.

vitalz

28 Jan 2013, 6:07 AM

I think downlodify needs flash to work. Without it you are restricted to the size of records the grid stores.
Sorry, have no time to change those JS plugins... I think if possible Ext JS community needs to fix Downloadify by flash removement (or replacement). Hope such solution is existing. Need to be implemented. B)

P.S. I haven't got why the Downloadify developer used flash. Why he made such solution. :-/

jwcraig

1 Feb 2013, 8:43 AM

I haven't tried it yet, but this looks promising: XLSX.js

http://blog.innovatejs.com/?p=50

here's a fiddle:

http://jsfiddle.net/innovatejs/ueETX/

nitingogia@gmail.com

8 Feb 2013, 8:03 AM

I am trying to give my custom image by specifying downloadImage attribute in the config, but any image i put in the image flickers and on clicking hides. Can anyone please help if seen this issue or what I need to do exactly to specify my image rather using the download.png provided by the library.