# ![PHPWord](https://rawgit.com/PHPOffice/PHPWord/develop/docs/images/phpword.svg "PHPWord")
Master:
[![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v/stable.png)](https://packagist.org/packages/phpoffice/phpword)
[![Build Status](https://travis-ci.org/PHPOffice/PHPWord.svg?branch=master)](https://travis-ci.org/PHPOffice/PHPWord)
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
[![Coverage Status](https://coveralls.io/repos/github/PHPOffice/PHPWord/badge.svg?branch=master)](https://coveralls.io/github/PHPOffice/PHPWord?branch=master)
[![Total Downloads](https://poser.pugx.org/phpoffice/phpword/downloads.png)](https://packagist.org/packages/phpoffice/phpword)
[![License](https://poser.pugx.org/phpoffice/phpword/license.png)](https://packagist.org/packages/phpoffice/phpword)
[![Join the chat at https://gitter.im/PHPOffice/PHPWord](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/PHPWord)
Develop:
[![Latest Development Version](https://img.shields.io/badge/unstable-dev--develop-orange.svg)](https://packagist.org/packages/phpoffice/phpword#dev-develop)
[![Build Status](https://travis-ci.org/PHPOffice/PHPWord.svg?branch=develop)](https://travis-ci.org/PHPOffice/PHPWord/branches)
[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/?branch=develop)
[![Coverage Status](https://coveralls.io/repos/github/PHPOffice/PHPWord/badge.svg?branch=develop)](https://coveralls.io/github/PHPOffice/PHPWord?branch=develop)
PHPWord 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://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF), HTML, and PDF.
PHPWord 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://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/).
If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)
Read more about PHPWord:
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Getting started](#getting-started)
- [Contributing](#contributing)
- [Developers' Documentation](http://phpword.readthedocs.org/)
## Features
With PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP 5.3.3+ scripts. Below are some of the things that you can do with PHPWord library:
- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
- Create header and footer for each sections
- Set default font type, font size, and paragraph style
- Use UTF-8 and East Asia fonts/characters
- 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
- Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements
- Insert titles (headers) and table of contents
- Insert text breaks and page breaks
- Insert and format images, either local, remote, or as page watermarks
- Insert binary OLE Objects such as Excel or Visio
- Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)
- Insert list items as bulleted, numbered, or multilevel
- Insert hyperlinks
- Insert footnotes and endnotes
- Insert drawing shapes (arc, curve, line, polyline, rect, oval)
- Insert charts (pie, doughnut, bar, line, area, scatter, radar)
- Insert form fields (textinput, checkbox, and dropdown)
- Create document from templates
- Use XSL 1.0 style sheets to transform headers, main document part, and footers of an OOXML template
- ... and many more features on progress
## Requirements
PHPWord requires the following:
- PHP 5.3.3+
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- [Laminas Escaper component](https://docs.laminas.dev/laminas-escaper/intro/)
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)
- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write OOXML and ODF)
- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )
- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)
## Installation
PHPWord is installed via [Composer](https://getcomposer.org/).
To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links) to PHPWord in your project, either
Run the following to use the latest stable version
```sh
composer require phpoffice/phpword
```
or if you want the latest master version
```sh
composer require phpoffice/phpword:dev-master
```
You can of course also manually edit your composer.json file
```json
{
"require": {
"phpoffice/phpword": "v0.18.*"
}
}
```
## Getting started
The following is a basic usage example of the PHPWord library.
```php
<?php
require_once 'bootstrap.php';
// Creating the new document...
$phpWord = new \PhpOffice\PhpWord\PhpWord();
/* Note: any element you append to a document must reside inside of a Section. */
// Adding an empty Section to the document...
$section = $phpWord->addSection();
// Adding Text element to the Section having font styled by default...
$section->addText(
'"Learn from yesterday, live for today, hope for tomorrow. '
. 'The important thing is not to stop questioning." '
. '(Albert Einstein)'
);
/*
* Note: it's possible to customize font style of the Text element you add in three ways:
* - inline;
* - using named font style (new font style object will be implicitly created);
* - using explicitly created font style object.
*/
// Adding Text element with font customized inline...
$section->addText(
'"Great achievement is usually born of great sacrifice, '
. 'and is never the result of selfishness." '
. '(Napoleon Hill)',
array('name' => 'Tahoma', 'size' => 10)
);
// Adding Text element with font customized using named font style...
$fontStyleName = 'oneUserDefinedStyle';
$phpWord->addFontStyle(
$fontStyleName,
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
);
$section->addText(
'"The greatest accomplishment is not in never falling, '
. 'but in rising again after you fall." '
. '(Vince Lombardi)',
$fontStyleName
);
// Adding Text element with font customized using explicitly created font style object...
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
$fontStyle->setBold(true);
$fontStyle->setName('Tahoma');
$fontStyle->setSize(13);
$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');
$myTextElement->setFontStyle($fontStyle);
// Saving the document as OOXML file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('helloWorld.docx');
// Saving the document as ODF file...
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
$objWriter->save('helloWorld.odt');
// Saving the docume
没有合适的资源?快使用搜索试试~ 我知道了~
phpoffice类库 phpoffice.zip
共870个文件
php:630个
xlsx:81个
png:31个
5星 · 超过95%的资源 需积分: 48 20 下载量 80 浏览量
2021-10-27
11:29:14
上传
评论
收藏 4.55MB ZIP 举报
温馨提示
phpoffice类库
资源推荐
资源详情
资源评论
收起资源包目录
phpoffice类库 phpoffice.zip (870个子文件)
config 322B
config 293B
config 280B
config 263B
config 263B
config 252B
config 247B
config 241B
config 241B
config 239B
config 239B
config 238B
config 238B
config 237B
config 237B
config 236B
config 235B
config 71B
COPYING 34KB
bootstrap.min.css 118KB
font-awesome.min.css 28KB
extra.css 256B
phpspreadsheet.css 158B
example2.csv 8KB
longIntegers.csv 272B
example1.csv 268B
.php_cs.dist 8KB
.php_cs.dist 7KB
phpunit.xml.dist 826B
phpword.ini.dist 393B
fontawesome-webfont.eot 75KB
functions 52KB
functions 52KB
functions 35KB
functions 34KB
functions 34KB
functions 33KB
functions 33KB
functions 32KB
functions 31KB
functions 31KB
functions 31KB
functions 31KB
functions 30KB
functions 30KB
functions 30KB
functions 30KB
functions 29KB
generate-document 904B
.gitattributes 84B
.github_changelog_generator 96B
.gitignore 108B
GnumericTest.gnumeric 8KB
46readHtml.html 3KB
officelogo.jpg 5KB
termsconditions.jpg 528B
jquery.min.js 84KB
bootstrap.min.js 36KB
composer.json 3KB
composer.json 3KB
COPYING.LESSER 7KB
LICENSE 1KB
LICENSE 688B
composer.lock 123KB
CHANGELOG.PHPExcel.md 152KB
calculation-engine.md 61KB
features-cross-reference.md 53KB
recipes.md 53KB
function-list-by-name.md 46KB
CHANGELOG.md 41KB
function-list-by-category.md 30KB
CHANGELOG.md 29KB
reading-and-writing-to-file.md 27KB
reading-files.md 27KB
accessing-cells.md 20KB
autofilters.md 18KB
migration-from-PHPExcel.md 11KB
README.md 9KB
file-formats.md 6KB
worksheets.md 5KB
CONTRIBUTING.md 4KB
memory_saving.md 3KB
architecture.md 3KB
index.md 3KB
faq.md 2KB
creating-spreadsheet.md 2KB
settings.md 2KB
CONTRIBUTING.md 842B
bug_report.md 638B
feature_request.md 587B
how-to-use.md 450B
PULL_REQUEST_TEMPLATE.md 404B
migrate-from-phpexcel 171B
OOCalcTest.ods 20KB
FontAwesome.otf 122KB
Xls.php 279KB
pclzip.lib.php 210KB
Calculation.php 195KB
Worksheet.php 147KB
Statistical.php 119KB
共 870 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
- 申增浩2023-07-29这个phpoffice类库真是个实用的工具,让我在处理php文档时事半功倍。
- 是因为太久2023-07-29phpoffice.zip的使用方法简单明了,让我以更高效的方式生成和编辑php文档。
- 思想假2023-07-29使用了phpoffice.zip后,我对php文档的操作轻而易举,再也不需要费劲地编写复杂的代码了。
- Period熹微2023-07-29这个phpoffice类库虽然简洁,但功能完善,满足了我处理php文档的各种需求。
- 爱吃番茄great2023-07-29通过phpoffice.zip,我能轻松地导入和导出各种格式的文档,真是省了不少时间和精力。
ultramankiki
- 粉丝: 6
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- STM8L101F3P6单片机+CC1100模块433M遥控器设计硬件(原理图+PCB)工程文件.zip
- 上传下载铁人下载系统 Liuxing 1.0-liuxing1.0.rar
- 南京邮电大学数学实验实力雄厚,凭借其优秀的师资力量、丰富的实践教学资源和卓越的科研成果,成为国内一流的数学实验教学和科研基地
- 【火爆朋友圈的今天吃什么源码 v1.0】随机的为用户带来每一天的用餐选择和推荐.rar
- MPU6050中文版数据手册
- 上传下载手机电影下载-mobiledy.rar
- 响应式旅游网站源码下载 马尔代夫旅游网站.rar
- CMS小涴熊漫画连载系统漫画网站源码 带采集API.rar
- 福袋点点.apk
- 基于STM32的电子秤采用0.96寸OLED显示UI界面源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功