mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.82k stars 1.98k forks source link

Excel Export Unavailability #995

Open shivamtandon opened 10 years ago

shivamtandon commented 10 years ago

Hi Leibman,

Do you see in near future any possibility of providing the excel export functionality for slickgrid, as it is a much required feature for the modern day grids.

styfle commented 10 years ago

Excel accepts csv so you can create your CSV by iterating over the rows using grid.GetData(). Then there are a couple ways to force a download, using a new window or a[download] attribute with the data URI.

http://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side

GerHobbelt commented 10 years ago

Also there's examples/example-excel-compatible-spreadsheet.html which howcases the copy/paste from/to Excel.

Met vriendelijke groeten / Best regards,

Ger Hobbelt


web: http://www.hobbelt.com/ http://www.hebbut.net/ mail: ger@hobbelt.com

mobile: +31-6-11 120 978

On Fri, Aug 22, 2014 at 7:50 PM, Steven notifications@github.com wrote:

Excel accepts csv so you can create your CSV by iterating over the rows using grid.GetData(). Then there are a couple ways to force a download, using a new window or a[download] attribute with the data URI.

http://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side

— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/995#issuecomment-53096328.

shivamtandon commented 10 years ago

Hi Steven

I was going through your email and still stuck at one thing that if i want all the grid formattin to be present in the csv extract the same suggested by you wont work

Thanks & Regards Shivam Tandon On 22 Aug 2014 23:20, "Steven" notifications@github.com wrote:

Excel accepts csv so you can create your CSV by iterating over the rows using grid.GetData(). Then there are a couple ways to force a download, using a new window or a[download] attribute with the data URI.

http://stackoverflow.com/questions/14964035/how-to-export-javascript-array-info-to-csv-on-client-side

— Reply to this email directly or view it on GitHub https://github.com/mleibman/SlickGrid/issues/995#issuecomment-53096328.

styfle commented 10 years ago

@shivamtandon While iterating through your data you can call your formatter functions on the appropriate columns but then you will need to save as HTML.

Excel is smart enough to open an html file with a

in it so you can name the file with a .xls extension.

shivamtandon commented 10 years ago

Is there example or implementation present for this feature as i am a newbie, so it would be helpful for me if i had an example to go through.

shivamtandon commented 9 years ago

Do we have any implementation or is there any chance we would be supporting this functionality in slickgrid?

6pac commented 9 years ago

I'm sure you could find an example of html-to-excel somewhere on the web. Really this is either (1) cut and paste html to excel, or (2) create a CSV and open in excel. In either case, this is a really a javascript or HTML thing, not specific to SlickGrid

shivamtandon commented 9 years ago

I have been able to implement extract to csv part on slickgrid , but i am still pretty unsure about how can i also get the formatting of the grid to be enabled in the csv extract.

Gaurav-Rai commented 9 years ago

New to Slick grid, need help on export functionality to PDF. Currently the data is coming but the formatting is completely lost. What currently I need is to retain the colouring, fonts and the grid structure along with the data when I export. It's only showing data as of now, with all formatting gone. Any help regarding that will be very helpful,

6pac commented 9 years ago

there are a ton of third party solutions - google: html to pdf

Gaurav-Rai commented 9 years ago

From csv the data is coming to excel, is there any way to get the formatting also that is there is the UI, like different values in cell marked in different colours.

6pac commented 9 years ago

PDF from javascript: http://mrrio.github.io/jsPDF/

Excel: simple answer, no. Rigorous answer, yes, if you want to spend days, or perhaps even weeks, re-formatting XML to modify a .XLSX file.

Gaurav-Rai commented 9 years ago

Thanks a ton for the responses #6pac, I'll let you know if I come to some conclusion.

prem-kumar-e commented 8 years ago

I have implemented export functionalities (pdf, xls and csv)

Is it possible to export the data after grouping .

Now I can simply export the JSON data but not the modified(grouped, aggregated, sorted) one. Is it possible ?

6pac commented 8 years ago

Look at the .getItem() method on the DataView. This is where the grid gets the data from, so iterating through it will get you the same data. You may have to add a small amount of custom code to interpret the totals rows in a slightly different way. See the getDataItem() method in the grid code.

prem-kumar-e commented 8 years ago

Thanks for your response. And what is the difference between getItem() and getDataItem().

6pac commented 8 years ago

getItem() is in the dataview and getDataItem() is in the grid