{"id":13611350,"url":"https://github.com/bokuweb/docx-rs","last_synced_at":"2025-05-14T13:02:31.686Z","repository":{"id":37801602,"uuid":"207853854","full_name":"bokuweb/docx-rs","owner":"bokuweb","description":":memo:  A .docx file writer with Rust/WebAssembly.","archived":false,"fork":false,"pushed_at":"2025-04-30T09:06:13.000Z","size":12581,"stargazers_count":408,"open_issues_count":61,"forks_count":77,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-30T09:49:22.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://bokuweb.github.io/docx-rs/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bokuweb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["bokuweb"]}},"created_at":"2019-09-11T16:08:49.000Z","updated_at":"2025-04-30T08:36:28.000Z","dependencies_parsed_at":"2023-10-15T00:55:36.635Z","dependency_job_id":"2d35995f-9ce0-45ca-8f4c-f968f0484d4e","html_url":"https://github.com/bokuweb/docx-rs","commit_stats":{"total_commits":731,"total_committers":22,"mean_commits":33.22727272727273,"dds":0.344733242134063,"last_synced_commit":"11e09de5cdb34ce23f158a07b16044706a5c15c3"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Fdocx-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Fdocx-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Fdocx-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bokuweb%2Fdocx-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bokuweb","download_url":"https://codeload.github.com/bokuweb/docx-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149645,"owners_count":22022846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:54.451Z","updated_at":"2025-05-14T13:02:31.635Z","avatar_url":"https://github.com/bokuweb.png","language":"Rust","readme":"\u003cp align=\"center\"\u003e\u003cimg src =\"https://github.com/bokuweb/docx-rs/blob/main/logo.png?raw=true\" /\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    A .docx file `writer` with Rust/WebAssembly.\n\u003c/p\u003e\n\n---\n\n[![GitHub Actions Status](https://github.com/bokuweb/docx-rs/workflows/Continuous%20Integration/badge.svg)](https://github.com/bokuweb/docx-rs/actions)\n[![docx-rs at crates.io](https://img.shields.io/crates/v/docx-rs.svg)](https://crates.io/crates/docx-rs)\n[![](https://img.shields.io/npm/v/docx-wasm.svg)](https://www.npmjs.com/package/docx-wasm)\n\u003ca href=\"https://www.npmjs.com/package/docx-wasm\"\u003e\n\u003cimg src=\"https://img.shields.io/npm/dm/docx-wasm.svg\" /\u003e\u003c/a\u003e\n\n## Installation\n\n### Rust\n\n```\n[dependencies]\ndocx-rs = \"0.4\"\n```\n\n### Browser/Node.js\n\n```\n$ pnpm add docx-wasm\n```\n\n## Example\n\n### Rust\n\n```rust\nuse docx_rs::*;\n\npub fn hello() -\u003e Result\u003c(), DocxError\u003e {\n    let path = std::path::Path::new(\"./hello.docx\");\n    let file = std::fs::File::create(path).unwrap();\n    Docx::new()\n        .add_paragraph(Paragraph::new().add_run(Run::new().add_text(\"Hello\")))\n        .build()\n        .pack(file)?;\n    Ok(())\n}\n```\n\n### Browser\n\n```javascript\nimport { saveAs } from \"file-saver\";\n\n// // Note that a dynamic `import` statement here is required due to webpack/webpack#6615,\nimport(\"docx-wasm\").then((w) =\u003e {\n  const { buffer } = new w.Docx()\n    .addParagraph(\n      new w.Paragraph().addRun(new w.Run().addText(\"Hello world!!\"))\n    )\n    .build();\n  saveAs(new Blob([buffer]), \"hello.docx\");\n});\n```\n\n### Node.js\n\n```javascript\nconst w = require(\"docx-wasm\");\nconst { writeFileSync } = require(\"fs\");\n\nconst { buffer } = new w.Docx()\n  .addParagraph(new w.Paragraph().addRun(new w.Run().addText(\"Hello world!!\")))\n  .build();\n\nwriteFileSync(\"hello.docx\", Buffer.from(buffer));\n```\n\n### More examples\n\n- [Minimum](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/hello.rs)\n- [Indent](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/indent.rs)\n- [Alignment](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/alignment.rs)\n- [Font](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/font.rs)\n- [Numbering](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/numbering.rs)\n- [Table](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/table.rs)\n- [Comment](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/comment.rs)\n- [Image](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/image_inline.rs)\n- [History](https://github.com/bokuweb/docx-rs/blob/master/docx-core/examples/history.rs)\n\n## Development\n\n### Requirements\n\n- Node.js 16+\n- pnpm 9+\n- wasm-pack0.10.1 (https://rustwasm.github.io/wasm-pack/)\n- insta (https://github.com/mitsuhiko/insta)\n\n### Examples\n\nYou can run example with following code.\nPlease see `examples` directory.\n\n```sh\n$ cargo run --example [EXAMPLE_NAME]\n```\n\nFor Example if you want to run `hello` example.\nPlease run following command.\n\n```sh\n$ cargo run --example hello\n```\n\nSo you can see output file in output directory.\n\n### Testing\n\n#### Rust\n\nPlease run following command.\n\n```\nmake lint \u0026\u0026 make test\n```\n\nIf snapshot testing is failed, fix code or update snapshot files. (See https://insta.rs/).\n\n```\n$ cargo-insta review\n```\n\nThen re run test.\n\n```\n$ make test\n```\n\n#### Wasm\n\nPlease run following command.\n\n```\n$ cd docx-wasm \u0026\u0026 pnpm install \u0026\u0026 pnpm test\n```\n\nIf snapshot testing is failed, fix code or update snapshot files. (See https://jestjs.io/docs/snapshot-testing).\n\n```\n$ pnpm test -- --updateSnapshot\n```\n\n## Features\n\n- [x] Paragraph\n  - [x] Alignment\n  - [x] Indent\n  - [x] Numbering\n- [x] Run\n  - [x] Bold\n  - [x] Size\n  - [x] Font\n  - [x] Color\n  - [x] Highlight\n  - [x] Underline\n  - [x] vanish\n  - [x] Italic\n  - [x] TextBorder\n  - [x] Footnote\n- [x] Break\n- [x] Header\n- [x] Footer\n- [x] Comment\n- [x] Image\n- [x] Style\n- [x] Table\n- [x] HIstory\n- [x] Table of contents\n- [ ] Section\n- [ ] Textbox\n","funding_links":["https://github.com/sponsors/bokuweb"],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbokuweb%2Fdocx-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbokuweb%2Fdocx-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbokuweb%2Fdocx-rs/lists"}