https://github.com/nitin42/redocx
📄 Create word documents with React
https://github.com/nitin42/redocx
components library react react-fiber renderer word-documents
Last synced: 2 days ago
JSON representation
📄 Create word documents with React
- Host: GitHub
- URL: https://github.com/nitin42/redocx
- Owner: nitin42
- Created: 2017-08-19T07:08:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T07:27:24.000Z (over 4 years ago)
- Last Synced: 2025-04-07T05:01:39.317Z (9 days ago)
- Topics: components, library, react, react-fiber, renderer, word-documents
- Language: JavaScript
- Size: 386 KB
- Stars: 1,423
- Watchers: 25
- Forks: 72
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
- awesome-react-renderer - redocx - Create word documents using React. (File)
README
# redocx
[](https://travis-ci.org/nitin42/redocx)


> Create word documents with React
![]()
## Introduction
`redocx` is a library which lets you create word documents with React. It provides a set of components which renders your declarative views and components to word documents.
#### Example
A simple component that renders a "Hello World" text to a word document.
```js
import React from 'react'
import { render, Document, Text } from 'redocx'class App extends React.Component {
render() {
return (
Hello World
)
}
}render(, `${__dirname}/example.docx`)
```Let's get started!
## Install
**Babel presets and cli**
```
npm install --save-dev babel-cli babel-core babel-preset-env babel-preset-react babel-preset-stage-0
```**react and redocx**
```
npm install --save react redocx
```## Usage
* Create a `.babelrc`
```
{
"presets": [
"env",
"stage-0",
"react"
]
}
```* After configuring babel and assuming you've already created a file `example.js` with [this](#example) example, run `babel-node example.js`. This will render your React component to word document.
## Demo
```
git clone https://github.com/nitin42/redocx.git
cd redocx
npm install
npm run example
```## Documentation
See the detailed documentation [here](./docs)
## Contributing
[Contributing guide](https://github.com/nitin42/redocx/blob/master/CONTRIBUTING.md)
## License
MIT
[](https://app.codesponsor.io/link/FCRW65HPiwhNtebDx2tTc53E/nitin42/redocx)