Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

📄 Create word documents with React

NotificationsYou must be signed in to change notification settings

nitin42/redocx

Repository files navigation

Build Statusyarnlicensestatus

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.

importReactfrom'react'import{render,Document,Text}from'redocx'classAppextendsReact.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 fileexample.js withthis example, runbabel-node example.js. This will render your React component to word document.

Demo

git clone https://github.com/nitin42/redocx.gitcd redocxnpm installnpm run example

Documentation

See the detailed documentationhere

Contributing

Contributing guide

License

MIT

Sponsor


[8]ページ先頭

©2009-2025 Movatter.jp