文档介绍:PHPWord Beta
Developers Guide
Table of contents
What the hell are twips? 4
Set default Font 4
Set document properties 4
Sections 4
Add a section 5
Style sections 5
Available style properties 5
Text Elements 6
Add text elements 6
Add textrun elements 6
Style text elements 7
Available style properties 7
Add text breaks 8
Add page breaks 8
List elements 8
Add list elements 8
Style list elements 9
Available list style properties 9
Hyperlinks 9
Add Hyperlinks 9
Style Hyperlinks 9
Images 10
Add images 10
Style images 10
Available style properties 10
Add memory images 11
Add watermarks 11
Add objects 12
Add titles 12
Add table-of-contents 13
Tables 14
Add tables 14
Add rows 14
Add cells 14
Style cells 15
Style tables 16
Footer 17
Header 18
Templates 18
What the hell are twips?
You'll often find the unit twips in this documentation. Twips are the base length unit in Open Office. Twip means "TWentieth of an Inch Point". So 1 twip = 1/1440 inch.
到底twips是什么?
你经常会发现这个文档单位twips是基本长度单位在开放的办公室。Twip意味着“20英寸点”。因此,1 twip = 1/1440英寸。
Set default Font
By default every text appears in Arial font with font size of 10 point. You can alter the default font by using the following two functions:
$PHPWord->setDefaultFontName('Tahoma');
$PHPWord->setDefaultFontSize(12);
Set document properties
You can set the following document properties:
Name
Type
Creator
String
Company
String
Title
String
Description
String
Category
String
Last modified by
String
Created
Datetime
Modified
Datetime
Subject
String
Keywords
String
To set these properties use the following code:
$properties = $PHPWord->getProperties();
$properties->setCreator('My name');
$properties->pany('My factory');
$properties->setTitle('My title');
$properties->setDescription('My description');
$properties->setCategory('My category');
$properties->setLastModifiedBy('My name');
$properties->setCreated( mktime(0, 0, 0, 3, 12, 2010) );
$properties->se