项目
在 GitHub 查看
nitin42/redocx
关于
📄 使用 React 创建 Word 文档
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- -1
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文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.
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.jswith this example, runbabel-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
License
MIT
探索相关项目
加载中…