πŸ“„ Create word documents with React
Clone or download
Nitin Tulswani Nitin Tulswani
Nitin Tulswani and Nitin Tulswani v1.1.4
Latest commit 384305b Dec 7, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ updated Nov 9, 2017
demo v1.1.4 Dec 7, 2018
docs Added docs Oct 4, 2018
examples updated Nov 9, 2017
src Adding ability to render straight to memory mapped stream Oct 1, 2018
.babelrc Fix indentation issue for babelrc Dec 5, 2018
.eslintrc.js disable no console Aug 19, 2017
.gitignore chore(git): the generated demo file should be ignored Aug 21, 2017
.travis.yml node 6 Aug 19, 2017
CONTRIBUTING.md use word.js Aug 20, 2017
README.md updated Sep 1, 2017
package.json v1.1.4 Dec 7, 2018
redocx.png [ImgBot] optimizes images Sep 2, 2017
yarn.lock v1.1.4 Dec 7, 2018

README.md

redocx

Build Status yarn license status

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.

import React from 'react'
import { render, Document, Text } from 'redocx'

class App extends React.Component {
  render() {
    return (
      <Document>
        <Text>Hello World</Text>
      </Document>
    )
  }
}

render(<App />, `${__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, 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

Contributing

Contributing guide

License

MIT

Sponsor