{"id":20171679,"url":"https://github.com/nickelony/quickword.openxml","last_synced_at":"2025-03-03T04:24:08.662Z","repository":{"id":197640822,"uuid":"696711318","full_name":"Nickelony/QuickWord.OpenXml","owner":"Nickelony","description":"An open-source set of extension methods for DocumentFormat.OpenXml which simplifies creating and modifying Word documents (such as .docx).","archived":false,"fork":false,"pushed_at":"2023-10-12T22:19:06.000Z","size":205,"stargazers_count":2,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-14T05:35:18.266Z","etag":null,"topics":["dotnet","office","openxml","word"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/QuickWord.OpenXml","language":"C#","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/Nickelony.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":"2023-09-26T09:39:31.000Z","updated_at":"2025-01-16T16:08:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"84fa7317-a5e3-4f85-bc43-ac8a8cc3942c","html_url":"https://github.com/Nickelony/QuickWord.OpenXml","commit_stats":null,"previous_names":["nickelony/quickword.openxml"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickelony%2FQuickWord.OpenXml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickelony%2FQuickWord.OpenXml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickelony%2FQuickWord.OpenXml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nickelony%2FQuickWord.OpenXml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nickelony","download_url":"https://codeload.github.com/Nickelony/QuickWord.OpenXml/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241607357,"owners_count":19989873,"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":["dotnet","office","openxml","word"],"created_at":"2024-11-14T01:26:36.994Z","updated_at":"2025-03-03T04:24:08.638Z","avatar_url":"https://github.com/Nickelony.png","language":"C#","funding_links":["https://www.buymeacoffee.com/Nickelony","https://img.buymeacoffee.com/button-api/?text=Support"],"categories":[],"sub_categories":[],"readme":"# ![Icon32x32](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/9fb9f9c8-dc60-46dc-9d04-68a9ff60146f) QuickWord for DocumentFormat.OpenXml\nAn open-source set of extension methods for `DocumentFormat.OpenXml` which simplifies creating and modifying Word documents (such as .docx).\nYou can use these methods with your existing `DocumentFormat.OpenXml` code without having to change anything.\n\nIf you think something very important is missing in this library, please create an [Issue](https://github.com/Nickelony/QuickWord.OpenXml/issues) for it. I'm willing to implement anything that is crucial.\nContributions via **Pull Requests** are always welcome! :)\n\nIf you have any questions, feel free to open a [Discussion](https://github.com/Nickelony/QuickWord.OpenXml/discussions).\n\nPlease remember that I may not always be able to push updates because of lack of time. If you wish to support me, you can buy me a coffee:\n\n\u003ca href=\"https://www.buymeacoffee.com/Nickelony\"\u003e\u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Support Me\u0026emoji=❤️\u0026slug=Nickelony\u0026button_colour=FFDD00\u0026font_colour=000000\u0026font_family=Lato\u0026outline_colour=000000\u0026coffee_colour=ffffff\" /\u003e\u003c/a\u003e\n\nThank you! ❤️\n\n# Getting Started\nExample document creation with 1 formatted paragraph:\n```cs\nstring fileName = \"TEST.docx\";\n\nusing (var document = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document))\n{\n\tBody body = document.CreateBody()\n\t  .PageWidth(21, MeasuringUnits.Centimeters) // A4 width\n\t  .PageHeight(29.7, MeasuringUnits.Centimeters); // A4 height\n\n\tbody.AppendChild(new Paragraph(\n\t\tnew Run().Text(\"This is a single, centered paragraph.\")\n\t\t  .FontSize(16)\n\t\t  .FontColor(\"Red\") // #FF0000 will also work\n\t\t  .FontFace(\"Times New Roman\"))\n\t\t.Justification(JustificationValues.Center));\n\n\tdocument.Save();\n}\n```\n\n# Highlighted Features\n- Super quick and easy Builder-like pattern:\n```cs\nvar run = new Run().Text(\"This is a simple Run.\")\n  .FontSize(24)\n  .FontColor(\"Red\")\n  .Bold()\n  .Italic();\n```\n---\n- The ability to create Paragraphs with multiple Runs and multiple formattings:\n```cs\nRun[] runs = new[]\n{\n\tnew Run().Text(\"This is a\").FontSize(16),\n\tnew Run().Text(\" single paragraph \").FontFace(\"Comic Sans MS\"),\n\tnew Run().Text(\"with 3 Runs.\").HighlightColor(HighlightColorValues.Cyan)\n};\n\nbody.AppendChild(new Paragraph(runs))\n```\nExample with 5 runs:\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/85ddb350-834f-41d2-b2a8-e46e54bbe42f)\n\n---\n- The ability to create tables quickly:\n```cs\nbody.AppendChild(QTable.Create(new[]\n{\n\tnew[] { \"1\", \"John\", \"Doe\" },\n\tnew[] { \"2\", \"Jane\", \"Doe\" },\n\tnew[] { \"3\", \"John\", \"Smith\" },\n\tnew[] { \"4\", \"Jane\", \"Smith\" }\n}));\n```\nExample:\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/211e54e6-c6d8-4db4-93b0-5a85c7b72591)\n\n---\n- The ability quickly merge cells:\n```cs\n// Merge cells [0,0] and [1,0] (vertically)\ntable.Rows(0)?.Cells(0)?.VerticalMerge(MergedCellValues.Restart);\ntable.Rows(1)?.Cells(0)?.VerticalMerge(MergedCellValues.Continue);\n\n// Merge cells [2,0] and [3,0] (vertically)\ntable.Rows(2)?.Cells(0)?.VerticalMerge(MergedCellValues.Restart);\ntable.Rows(3)?.Cells(0)?.VerticalMerge(MergedCellValues.Continue);\n```\nExample:\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/ce0cbcd7-e7fc-4f73-bcb2-95d589de3e02)\n\n---\n- The ability to quickly create formatted rows and cells:\n```cs\ntable1.AppendChild(QTableRow.Create(\n\tnew[] { \"ID\", \"First Name\", \"Last Name\" },\n\trowFormatting: new TableRowFormatting { IsHeader = true },\n\trunFormatting: new RunFormatting { Bold = true }));\n```\n- The ability to easily customize existing table cells:\n```cs\nforeach (TableCell? cell in table2.GetColumnOfCells(3).Skip(1)) // 4th column of cells, skip header cell\n{\n\tif (cell?.Paragraphs(0)?.GetText() == \"Yes\")\n\t\tcell?.FillColor(\"LightGreen\");\n\telse\n\t\tcell?.FillColor(\"LightPink\");\n}\n```\nExample:\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/8615e12c-baa7-4af4-8ff8-1df516c8190b)\n\n---\n- The ability to create inlined images:\n```cs\nbody.AppendChild(new Paragraph(\n\tnew Run(QDrawing.FromImage(body, \"Icon.png\", ImagePartType.Png, 32, 32)),\n\tnew Run().Text(\" This image is inlined with the text.\").VerticalPosition(8)\n).Justification(JustificationValues.Center));\n```\nExample:\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/8743289e-91a3-4de7-b296-d765478655d6)\n\n---\n- The ability to create anchored images:\n```cs\nbody.AppendChild(new Paragraph(\n\tnew Run(QDrawing.FromImage(body, \"Icon.png\", ImagePartType.Png, 128, 128)\n\t\t.ToAnchoredDrawing()\n\t\t.AbsoluteVerticalPosition(0, ImageMeasuringUnits.Pixels, DW.VerticalRelativePositionValues.Paragraph)\n\t\t.SquareWrapping(0, 0, 0.5, 0, ImageMeasuringUnits.Centimeters)),\n\n\tnew Run().Text(\"This\\nimage\\nis\\naligned\\nbefore\\nthe text.\\n\")\n));\n```\nExample:\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/a52e8424-f6bb-45ae-8fd2-f83ec21755a4)\n\nWith images you can also:\n  - Set the transparency\n  - Set the rotation\n  - Set cropping\n  - Set a border\n  - Set text wrapping\n  - Set the position\n  - many more...\n\n![image](https://github.com/Nickelony/QuickWord.OpenXml/assets/20436882/89883b1b-04dd-43b4-b0a3-3ebc7240cb95)\n\n---\n- You can also use additional `Paragraph` inherited objects, such as:\n  - `EmptyLine`\n  - `PageBreak`\n  - `HorizontalLine`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickelony%2Fquickword.openxml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnickelony%2Fquickword.openxml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnickelony%2Fquickword.openxml/lists"}