[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8243":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":36,"readmeContent":37,"aiSummary":38,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":39,"discoverSource":40},8243,"PHPWord","PHPOffice\u002FPHPWord","PHPOffice","A pure PHP library for reading and writing word processing documents","https:\u002F\u002Fphpoffice.github.io\u002FPHPWord\u002F",null,"PHP",7565,2732,300,1092,0,2,14,1,68.4,"Other",false,"master",true,[26,27,28,29,30,31,32,33,34,35],"doc","docx","html","libreoffice-writer","msword","odt","office","pdf","php","rtf","2026-06-12 04:00:38","# ![PHPWord](https:\u002F\u002Frawgit.com\u002FPHPOffice\u002FPHPWord\u002Fdevelop\u002Fdocs\u002Fimages\u002Fphpword.svg \"PHPWord\")\n\n[![Latest Stable Version](https:\u002F\u002Fposer.pugx.org\u002Fphpoffice\u002Fphpword\u002Fv)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fphpoffice\u002Fphpword)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002FPHPOffice\u002FPHPWord\u002Fbadge.svg?branch=master)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002FPHPOffice\u002FPHPWord?branch=master)\n[![Total Downloads](https:\u002F\u002Fposer.pugx.org\u002Fphpoffice\u002Fphpword\u002Fdownloads)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fphpoffice\u002Fphpword)\n[![License](https:\u002F\u002Fposer.pugx.org\u002Fphpoffice\u002Fphpword\u002Flicense)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fphpoffice\u002Fphpword)\n\nBranch Master : [![PHPWord](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Factions\u002Fworkflows\u002Fphp.yml\u002Fbadge.svg?branch=master)](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Factions\u002Fworkflows\u002Fphp.yml)\n\nPHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft [Office Open XML](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FOffice_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FOpenDocument) (OpenDocument or ODF), [Rich Text Format](http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FRich_Text_Format) (RTF), HTML, and PDF.\n\nPHPWord is an open source project licensed under the terms of [LGPL version 3](COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Factions) and unit testing. You can learn more about PHPWord by reading the [Developers' Documentation](https:\u002F\u002Fphpoffice.github.io\u002FPHPWord\u002F).\n\nIf you have any questions, please ask on [StackOverFlow](https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002Ftagged\u002Fphpword)\n\nRead more about PHPWord:\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Getting started](#getting-started)\n- [Contributing](#contributing)\n- [Developers' Documentation](https:\u002F\u002Fphpoffice.github.io\u002FPHPWord\u002F)\n\n## Features\n\nWith PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP scripts. Below are some of the things that you can do with PHPWord library:\n\n- Set document properties, e.g. title, subject, and creator.\n- Create document sections with different settings, e.g. portrait\u002Flandscape, page size, and page numbering\n- Create header and footer for each sections\n- Set default font type, font size, and paragraph style\n- Use UTF-8 and East Asia fonts\u002Fcharacters\n- Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text\n- Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements\n- Insert titles (headers) and table of contents\n- Insert text breaks and page breaks\n- Insert and format images, either local, remote, or as page watermarks\n- Insert binary OLE Objects such as Excel or Visio\n- Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)\n- Insert list items as bulleted, numbered, or multilevel\n- Insert hyperlinks\n- Insert footnotes and endnotes\n- Insert drawing shapes (arc, curve, line, polyline, rect, oval)\n- Insert charts (pie, doughnut, bar, line, area, scatter, radar)\n- Insert form fields (textinput, checkbox, and dropdown)\n- Create document from templates\n- Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template\n- ... and many more features on progress\n\n## Requirements\n\nPHPWord requires the following:\n\n- PHP 7.1+\n- [XML Parser extension](http:\u002F\u002Fwww.php.net\u002Fmanual\u002Fen\u002Fxml.installation.php)\n- [Laminas Escaper component](https:\u002F\u002Fdocs.laminas.dev\u002Flaminas-escaper\u002Fintro\u002F)\n- [Zip extension](http:\u002F\u002Fphp.net\u002Fmanual\u002Fen\u002Fbook.zip.php) (optional, used to write OOXML and ODF)\n- [GD extension](http:\u002F\u002Fphp.net\u002Fmanual\u002Fen\u002Fbook.image.php) (optional, used to add images)\n- [XMLWriter extension](http:\u002F\u002Fphp.net\u002Fmanual\u002Fen\u002Fbook.xmlwriter.php) (optional, used to write OOXML and ODF)\n- [XSL extension](http:\u002F\u002Fphp.net\u002Fmanual\u002Fen\u002Fbook.xsl.php) (optional, used to apply XSL style sheet to template )\n- [dompdf library](https:\u002F\u002Fgithub.com\u002Fdompdf\u002Fdompdf) (optional, used to write PDF)\n\n## Installation\n\nPHPWord is installed via [Composer](https:\u002F\u002Fgetcomposer.org\u002F).\nTo [add a dependency](https:\u002F\u002Fgetcomposer.org\u002Fdoc\u002F04-schema.md#package-links) to PHPWord in your project, either\n\nRun the following to use the latest stable version\n```sh\ncomposer require phpoffice\u002Fphpword\n```\nor if you want the latest unreleased version\n```sh\ncomposer require phpoffice\u002Fphpword:dev-master\n```\n\n## Getting started\n\nThe following is a basic usage example of the PHPWord library.\n\n```php\n\u003C?php\n\n\u002F\u002F Creating the new document...\n$phpWord = new \\PhpOffice\\PhpWord\\PhpWord();\n\n\u002F* Note: any element you append to a document must reside inside of a Section. *\u002F\n\n\u002F\u002F Adding an empty Section to the document...\n$section = $phpWord->addSection();\n\u002F\u002F Adding Text element to the Section having font styled by default...\n$section->addText(\n    '\"Learn from yesterday, live for today, hope for tomorrow. '\n        . 'The important thing is not to stop questioning.\" '\n        . '(Albert Einstein)'\n);\n\n\u002F*\n * Note: it's possible to customize font style of the Text element you add in three ways:\n * - inline;\n * - using named font style (new font style object will be implicitly created);\n * - using explicitly created font style object.\n *\u002F\n\n\u002F\u002F Adding Text element with font customized inline...\n$section->addText(\n    '\"Great achievement is usually born of great sacrifice, '\n        . 'and is never the result of selfishness.\" '\n        . '(Napoleon Hill)',\n    array('name' => 'Tahoma', 'size' => 10)\n);\n\n\u002F\u002F Adding Text element with font customized using named font style...\n$fontStyleName = 'oneUserDefinedStyle';\n$phpWord->addFontStyle(\n    $fontStyleName,\n    array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)\n);\n$section->addText(\n    '\"The greatest accomplishment is not in never falling, '\n        . 'but in rising again after you fall.\" '\n        . '(Vince Lombardi)',\n    $fontStyleName\n);\n\n\u002F\u002F Adding Text element with font customized using explicitly created font style object...\n$fontStyle = new \\PhpOffice\\PhpWord\\Style\\Font();\n$fontStyle->setBold(true);\n$fontStyle->setName('Tahoma');\n$fontStyle->setSize(13);\n$myTextElement = $section->addText('\"Believe you can and you\\'re halfway there.\" (Theodor Roosevelt)');\n$myTextElement->setFontStyle($fontStyle);\n\n\u002F\u002F Saving the document as OOXML file...\n$objWriter = \\PhpOffice\\PhpWord\\IOFactory::createWriter($phpWord, 'Word2007');\n$objWriter->save('helloWorld.docx');\n\n\u002F\u002F Saving the document as ODF file...\n$objWriter = \\PhpOffice\\PhpWord\\IOFactory::createWriter($phpWord, 'ODText');\n$objWriter->save('helloWorld.odt');\n\n\u002F\u002F Saving the document as HTML file...\n$objWriter = \\PhpOffice\\PhpWord\\IOFactory::createWriter($phpWord, 'HTML');\n$objWriter->save('helloWorld.html');\n\n\u002F* Note: we skip RTF, because it's not XML-based and requires a different example. *\u002F\n\u002F* Note: we skip PDF, because \"HTML-to-PDF\" approach is used to create PDF documents. *\u002F\n```\n\nMore examples are provided in the [samples folder](samples\u002F). For an easy access to those samples launch `php -S localhost:8000` in the samples directory then browse to [http:\u002F\u002Flocalhost:8000](http:\u002F\u002Flocalhost:8000) to view the samples.\nYou can also read the [Developers' Documentation](https:\u002F\u002Fphpoffice.github.io\u002FPHPWord\u002F) for more detail.\n\n## Contributing\n\nWe welcome everyone to contribute to PHPWord. Below are some of the things that you can do to contribute.\n\n- Read [our contributing guide](CONTRIBUTING.md).\n- [Fork us](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Ffork) and [request a pull](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Fpulls) to the [master](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Ftree\u002Fmaster) branch.\n- Submit [bug reports or feature requests](https:\u002F\u002Fgithub.com\u002FPHPOffice\u002FPHPWord\u002Fissues) to GitHub.\n- Follow [@PHPOffice](https:\u002F\u002Ftwitter.com\u002FPHPOffice) on Twitter.\n","PHPWord 是一个用纯 PHP 编写的库，用于读取和写入各种文档格式。它支持 Microsoft Office Open XML（如 .docx）、OpenDocument（.odt）、RTF、HTML 和 PDF 等多种文件格式。核心功能包括设置文档属性、创建不同布局的文档部分、自定义字体和段落样式、插入文本、图片、表格及页眉页脚等元素。此外，PHPWord 还支持使用 UTF-8 和东亚字符集。该库适用于需要通过 PHP 脚本动态生成或处理文档的应用场景，如自动化报告生成、文档模板填充等。","2026-06-11 03:16:57","top_language"]