{"id":29116832,"url":"https://github.com/gomutex/godocx","last_synced_at":"2025-06-29T11:14:05.964Z","repository":{"id":215801877,"uuid":"739811202","full_name":"gomutex/godocx","owner":"gomutex","description":"Go library for reading and writing Microsoft Docx","archived":false,"fork":false,"pushed_at":"2025-05-25T05:08:38.000Z","size":3206,"stargazers_count":175,"open_issues_count":9,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-25T06:20:00.592Z","etag":null,"topics":["doc","document","docx","go","golang","microsoft","office","ooxml","openoffice","openxml"],"latest_commit_sha":null,"homepage":"","language":"Go","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/gomutex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-01-06T16:07:44.000Z","updated_at":"2025-05-25T05:08:43.000Z","dependencies_parsed_at":"2025-01-31T22:15:28.301Z","dependency_job_id":null,"html_url":"https://github.com/gomutex/godocx","commit_stats":null,"previous_names":["gomutex/godocx"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/gomutex/godocx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gomutex%2Fgodocx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gomutex%2Fgodocx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gomutex%2Fgodocx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gomutex%2Fgodocx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gomutex","download_url":"https://codeload.github.com/gomutex/godocx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gomutex%2Fgodocx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262581513,"owners_count":23331925,"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":["doc","document","docx","go","golang","microsoft","office","ooxml","openoffice","openxml"],"created_at":"2025-06-29T11:13:48.923Z","updated_at":"2025-06-29T11:14:05.904Z","avatar_url":"https://github.com/gomutex.png","language":"Go","readme":"# Godocx\n\n[![Go CI](https://github.com/gomutex/godocx/actions/workflows/go.yml/badge.svg)](https://github.com/gomutex/godocx/actions/workflows/go.yml) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/gomutex/godocx) [![Go Reference](https://pkg.go.dev/badge/github.com/gomutex/godocx.svg)](https://pkg.go.dev/github.com/gomutex/godocx)\n [![Go Report Card](https://goreportcard.com/badge/github.com/gomutex/godocx)](https://goreportcard.com/report/github.com/gomutex/godocx) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"650\" src=\"./godocx.png\" alt=\"Godocx logo\"\u003e\u003c/p\u003e\n\n\nGodocx is a library written in pure Go providing a set of functions that allow you to write to and read from Docx file. \n\nThis library needs Go version 1.18 or later. The usage documentation for the godocx can be accessed via the [Godocx Documentation Page](https://gomutex.github.io/godocx). \n\nIn depth, go docs can be seen using go's built-in documentation tool, or online at [go.dev](https://pkg.go.dev/github.com/gomutex/godocx). Please refer the [subpackage docx](https://pkg.go.dev/github.com/gomutex/godocx/docx) for the list of functions that can be used.\n\n\n## Usage\nHere's a simple example of how you can use Godocx to create and modify DOCX documents:\n\n## Installation\nUse the godocx in your project\n```bash\ngo get github.com/gomutex/godocx\n```\n\n\n### Examples\nExplore additional examples and use cases over at GitHub repository dedicated to showcasing the capabilities of Golang Docx:\nhttps://github.com/gomutex/godocx-examples\n\n\n```go\n// More examples in separate repository\n// https://github.com/gomutex/godocx-examples\n\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/gomutex/godocx\"\n)\n\nfunc main() {\n\t\t// Open an existing DOCX document\n\t// document, err := godocx.OpenDocument(\"./testdata/test.docx\")\n\n\t// Create New Document\n\tdocument, err := godocx.NewDocument()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdocument.AddHeading(\"Document Title\", 0)\n\n\t// Add a new paragraph to the document\n\tp := document.AddParagraph(\"A plain paragraph having some \")\n\tp.AddText(\"bold\").Bold(true)\n\tp.AddText(\" and some \")\n\tp.AddText(\"italic.\").Italic(true)\n\n\tdocument.AddHeading(\"Heading, level 1\", 1)\n\tdocument.AddParagraph(\"Intense quote\").Style(\"Intense Quote\")\n\tdocument.AddParagraph(\"first item in unordered list\").Style(\"List Bullet\")\n\tdocument.AddParagraph(\"first item in ordered list\").Style(\"List Number\")\n\n\trecords := []struct{ Qty, ID, Desc string }{{\"5\", \"A001\", \"Laptop\"}, {\"10\", \"B202\", \"Smartphone\"}, {\"2\", \"E505\", \"Smartwatch\"}}\n\n\ttable := document.AddTable()\n\ttable.Style(\"LightList-Accent4\")\n\thdrRow := table.AddRow()\n\thdrRow.AddCell().AddParagraph(\"Qty\")\n\thdrRow.AddCell().AddParagraph(\"ID\")\n\thdrRow.AddCell().AddParagraph(\"Description\")\n\n\tfor _, record := range records {\n\t\trow := table.AddRow()\n\t\trow.AddCell().AddParagraph(record.Qty)\n\t\trow.AddCell().AddParagraph(record.ID)\n\t\trow.AddCell().AddParagraph(record.Desc)\n\t}\n\n\t// Save the modified document to a new file\n\terr = document.SaveTo(\"demo.docx\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n## Demo Output\n\nThis is screenshot of demo document generated from the godocx library. \n\n![Screenshot of the demo output](https://github.com/gomutex/godocx-examples/raw/main/demo.png)\n\n\n## Feature addtion request\n\nIf you need a feature that's missing in godocx, feel free to raise an issue describing what you want to achieve, along with a sample DOCX. While I can't promise immediate implementation, I'll review your request and work on it if it's valid.\n\n\n## Inspiration\nThe Godocx library is inspired from the python-docx\n\n## Licenses\n\nThe Godocx library is licensed under the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Microsoft Office","微软办公软件"],"sub_categories":["Microsoft Word"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgomutex%2Fgodocx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgomutex%2Fgodocx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgomutex%2Fgodocx/lists"}