diff --git a/README.md b/README.md index 60da1a934b..204317b421 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,15 @@ Press `endpoint` on the `RunKit` website:  -* https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text -* https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text -* https://runkit.com/dolanmiu/docx-demo3 - Bullet points -* https://runkit.com/dolanmiu/docx-demo4 - Simple table -* https://runkit.com/dolanmiu/docx-demo5 - Images -* https://runkit.com/dolanmiu/docx-demo6 - Margins -* https://runkit.com/dolanmiu/docx-demo7 - Landscape -* https://runkit.com/dolanmiu/docx-demo8/1.0.1 - Header and Footer -* https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx** +* https://runkit.com/dolanmiu/docx-demo1 - Simple paragraph and text +* https://runkit.com/dolanmiu/docx-demo2 - Advanced Paragraphs and text +* https://runkit.com/dolanmiu/docx-demo3 - Bullet points +* https://runkit.com/dolanmiu/docx-demo4 - Simple table +* https://runkit.com/dolanmiu/docx-demo5 - Images +* https://runkit.com/dolanmiu/docx-demo6 - Margins +* https://runkit.com/dolanmiu/docx-demo7 - Landscape +* https://runkit.com/dolanmiu/docx-demo8/1.0.1 - Header and Footer +* https://runkit.com/dolanmiu/docx-demo10 - **My CV generated with docx** #### Run demos locally: @@ -49,50 +49,17 @@ $ npm run demo This command will run the demo selector app in the `demo` folder. It will prompt you to select a demo number, which will run a demo from that folder. -## Guide +## How to -Please refer to [the Wiki](https://github.com/dolanmiu/docx/wiki) for details on how to use this library, examples and much more! - -Full documentation can be found here: [http://dolanmiu.github.io/docx/index.html](http://dolanmiu.github.io/docx/index.html) - -## Simple Usage - -```js -// Used to create docx files -var docx = require("docx"); - -// Create document -var doc = new docx.Document(); - -// Add some content in the document -var paragraph = new docx.Paragraph("Some cool text here."); -// Add more text into the paragraph if you wish -paragraph.addRun(new docx.TextRun("Lorem Ipsum Foo Bar")); -doc.addParagraph(paragraph); - -// Used to export the file into a .docx file -var exporter = new docx.LocalPacker(doc); - -// Or use the express packer to make the file downloadable. -// res is express' Response object -var exporter = new docx.ExpressPacker(doc, res); - -exporter.pack("My First Document"); -// If you want to export it as a .pdf file instead -exporter.packPdf("My First Document"); - -// done! A file called 'My First Document.docx' -// will be in your file system if you used LocalPacker -// Or it will start downloading if you are using Express -``` +Please refer to [https://docx.js.org/](https://docx.js.org/) for details on how to use this library, examples and much more! ## Examples -Check [the Wiki](https://github.com/dolanmiu/docx/wiki/Examples) and the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples. +Check the examples section in the [documentation](https://docx.js.org/#/usage/examples) and the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples. # Contributing -Read the contribution guidelines [here](https://github.com/dolanmiu/docx/wiki/Contributing-Guidelines). +Read the contribution guidelines [here](https://docx.js.org/#/contribution-guidelines). # Honoured Mentions diff --git a/docs/README.md b/docs/README.md index 1df213c45d..2ea6ac25e3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,30 +3,50 @@
- Easily generate .docx files with JS/TS. + Easily generate .docx files with JS/TS. :100:
--- # Welcome -## Getting Started - -### Installation +## Installation ```sh -$ npm install --save docx +npm install --save docx ``` + Then you can `require` or `import` as usual: -``` +```js let docx = require('docx'); ``` -``` +```js import * as docx from 'docx' ``` +## Basic Usage + +```js +var docx = require("docx"); + +// Create document +var doc = new docx.Document(); + +// Add some content in the document +var paragraph = new docx.Paragraph("Some cool text here."); +// Add more text into the paragraph if you wish +paragraph.addRun(new docx.TextRun("Lorem Ipsum Foo Bar")); +doc.addParagraph(paragraph); + +// Used to export the file into a .docx file +var exporter = new docx.LocalPacker(doc); + +exporter.pack("My First Document"); + +// Done! A file called 'My First Document.docx' will be in your file system if you used LocalPacker +``` --- diff --git a/docs/contribution-guidelines.md b/docs/contribution-guidelines.md index cb49368c38..28cfbad954 100644 --- a/docs/contribution-guidelines.md +++ b/docs/contribution-guidelines.md @@ -4,7 +4,7 @@ * Include documentation reference(s) at the top of each file: - ```ts + ```js // http://officeopenxml.com/WPdocument.php ``` @@ -18,7 +18,7 @@ Please write a test of every file you make and suffix it with `.spec.ts`. Here is a template of a test: -```ts +```js import { assert } from "chai"; describe("ClassName", () => { diff --git a/docs/index.html b/docs/index.html index 9ff9bd26a2..4b35f622af 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,23 +1,30 @@ + - -