Comments (3)
Excel is a bit harder. Basically you have a few options, the easiest being to send html down to excel but with the appropriate headers. However, excels HTML rendering engine is fairly basic. So it makes exporting a grid like this pretty hard (ie it wont understand floated divs).
Pdfs are a little easier in principal. We use a node based process internally that, basically, uses phantomJS, grabs a screenshot as an image, and then converts that to a pdf. BUt there are a bunch of other alternatives.
One more fundamental issue, depending on your use case, is that the grid is designed to only render the rows in view. So if you have 1000 rows, we only show 20 (or whatever you have set for your viewport). Depending on what you are trying to achieve, that may not be correct.
In terms of adding this as a feature, I think it probably sits out of scope for the core library. But an add on to either render the rows and cells in Excel compatible html (basically <tr>
and <td>
and / or an add on that pushes out a pdf (ideally browser based, but not seen anything reliable there) would be something we'd consider
@malonecj @jpdriver chip in if anything you'd add here
from react-data-grid.
for Excel it probably depends on whether or not you need the HTML markup in your resulting spreadsheet. IMO it makes more sense to get the rows from the grid state and pass that a JSON --> CSV converter.
I'm using the grid in a project where I'm doing that the other way (CSV --> React Data Grid) for initial data load so should be easy enough to do the other way, and there are lots of npm packages that do JSON <---> CSV.
for PDF's @bakesteve 's right -- PhantomJS is probably the easiest way to go. It actually natively supports rendering as a PDF (see http://phantomjs.org/screen-capture.html), though as mentioned you might need to fiddle with the styling to display rows beyond what the Viewport is currently rendering.
from react-data-grid.
@jpdriver can you recommend a npm package for JSON to CSV? I'm also trying to export a generated table to CSV. Thanks you for any info that you could provide!
from react-data-grid.
Related Issues (20)
- Scrolls Upward When Reordering or Resizing Column HOT 2
- onAllRowsSelectionChange is not defined in renderHeaderCell for Select Column HOT 1
- Console error display for the Row Grouping feature (Cannot read properties of undefined (reading 'renderEditCell'))
- Unresponsive Column Resizing in Firefox for Draggable Columns HOT 2
- Module '"react-data-grid"' has no exported member 'HeaderRendererProps'. Did you mean to use 'import HeaderRendererProps from "react-data-grid"' instead? HOT 1
- Column widths should recalculate when columns are added/removed from the columns array HOT 1
- TreeDataGridProps has wrong type for columns HOT 2
- Chrome mobile emulator: can't go to edit cell mode HOT 5
- Column auto size not working on Firefox HOT 3
- Deactivate editor mode if cell is not editable - old version
- 'SelectCellFormatter' cannot be used as a JSX component. HOT 4
- Hide header
- Space Navigation
- Make the cell tooltips keyboard accessible. HOT 2
- Editor getting activated on ANY key press HOT 1
- String field cannot be focused when trying to edit it
- Calculated Column is incorrectly not rendered when spanning multiple columns
- React Server Components Support
- UI Crash from NextJS HOT 13
- Header cell collapses when resizable set to true and promoted to staging environment HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-data-grid.