Compare commits
1120 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08064480ea | ||
|
|
aac3a601e1 | ||
|
|
ef99fac8e1 | ||
|
|
60734dd7f1 | ||
|
|
ed8d9ff420 | ||
|
|
a379577ac9 | ||
|
|
53d34fd049 | ||
|
|
679a738c42 | ||
|
|
0f6fbf2b11 | ||
|
|
050802bdb5 | ||
|
|
a215501cc9 | ||
|
|
1a80aacb4f | ||
|
|
40d5770651 | ||
|
|
143e01b29b | ||
|
|
25575c80ca | ||
|
|
1dc3dc6ce5 | ||
|
|
b453cf00ff | ||
|
|
f195d282d0 | ||
|
|
b2dfa65698 | ||
|
|
be499388da | ||
|
|
20f3a3e370 | ||
|
|
803cdee4f3 | ||
|
|
25de4b819c | ||
|
|
6041bb3fb5 | ||
|
|
249e049894 | ||
|
|
9658c12084 | ||
|
|
83f6b020b3 | ||
|
|
d721b5eda7 | ||
|
|
02e3aa96b6 | ||
|
|
02a92c8924 | ||
|
|
b457ff5f7f | ||
|
|
573f1c3ea1 | ||
|
|
0189977743 | ||
|
|
9afd53d622 | ||
|
|
a075740e32 | ||
|
|
ecd2fcbda8 | ||
|
|
9ed82d1f5a | ||
|
|
0af4ca1f6e | ||
|
|
228bada972 | ||
|
|
6deea59905 | ||
|
|
95ce998651 | ||
|
|
c37be288a5 | ||
|
|
28ca75eca4 | ||
|
|
0b9f30fc77 | ||
|
|
d2c6b9f790 | ||
|
|
a771de75b9 | ||
|
|
ab3a2c0418 | ||
|
|
14c6e6f370 | ||
|
|
8521612b39 | ||
|
|
f482f2600b | ||
|
|
46e61d4c18 | ||
|
|
4b7e7e4612 | ||
|
|
9a6eb6970d | ||
|
|
91504dfddc | ||
|
|
fab9966b8c | ||
|
|
e81520f94c | ||
|
|
024fdf9c1a | ||
|
|
c4bcba9741 | ||
|
|
f92ec7e3ad | ||
|
|
c3e34a0d24 | ||
|
|
c467fe02d3 | ||
|
|
f8d0b2ad87 | ||
|
|
02ccca1551 | ||
|
|
f80f660457 | ||
|
|
2b7b4ddc5f | ||
|
|
99d4b29471 | ||
|
|
62444d2161 | ||
|
|
969448ff12 | ||
|
|
b9f1151bc6 | ||
|
|
c5e7a535e6 | ||
|
|
a49618f248 | ||
|
|
d59591b7ab | ||
|
|
5b5de9e514 | ||
|
|
c8d360e095 | ||
|
|
2bc75771cc | ||
|
|
25c56a3e2d | ||
|
|
207438270f | ||
|
|
0e8bcb63e7 | ||
|
|
2ee6df65bc | ||
|
|
82769b9736 | ||
|
|
93e16d4001 | ||
|
|
f853b9f125 | ||
|
|
ecee8339c3 | ||
|
|
301e481fbe | ||
|
|
54415c113b | ||
|
|
26532b5f3f | ||
|
|
7df75b2efe | ||
|
|
62584900b5 | ||
|
|
a4cdcd6250 | ||
|
|
fa84160f7f | ||
|
|
077175efbe | ||
|
|
83b0bef3a8 | ||
|
|
a006aa8780 | ||
|
|
2de551647b | ||
|
|
26757c29bb | ||
|
|
2f93873a7c | ||
|
|
4dc34d43d8 | ||
|
|
945cbd9b93 | ||
|
|
91416e48ac | ||
|
|
fc18246b20 | ||
|
|
6b331603e6 | ||
|
|
2bba013311 | ||
|
|
be0190cd5d | ||
|
|
3bcd4b5370 | ||
|
|
01d87e17fb | ||
|
|
c57c292915 | ||
|
|
e159b723bd | ||
|
|
e9cd17d4c7 | ||
|
|
d9c1daa89c | ||
|
|
5bd4ad39a5 | ||
|
|
aca10785cf | ||
|
|
e37b22bf2b | ||
|
|
5a5562cd99 | ||
|
|
bb106f9052 | ||
|
|
eec9e975da | ||
|
|
7744ef2234 | ||
|
|
d905e764e3 | ||
|
|
612fefd636 | ||
|
|
1e0157f184 | ||
|
|
d6e0a3ebdb | ||
|
|
a9deeb8c25 | ||
|
|
7fd0489567 | ||
|
|
524c08bafb | ||
|
|
94b74c27a4 | ||
|
|
ab7d82274e | ||
|
|
fa52c92561 | ||
|
|
3a7301c700 | ||
|
|
0692a55fa4 | ||
|
|
a4055fb7a0 | ||
|
|
8efd9ff9da | ||
|
|
d731e9284f | ||
|
|
55defcc892 | ||
|
|
afed126ab1 | ||
|
|
7f78322d04 | ||
|
|
a30bbbdc62 | ||
|
|
06b90e39a3 | ||
|
|
84d1da6ce2 | ||
|
|
556a250fb3 | ||
|
|
5dcb3e53ee | ||
|
|
2ae000cbad | ||
|
|
b71b4fdb71 | ||
|
|
2961b72c7a | ||
|
|
1e5fd83222 | ||
|
|
67ea85688e | ||
|
|
68cbca530f | ||
|
|
1bd7cd6238 | ||
|
|
c2e2ec4004 | ||
|
|
659d3d7b4b | ||
|
|
bed1f7afbf | ||
|
|
4c5e760871 | ||
|
|
c550a53c3e | ||
|
|
a382f9d754 | ||
|
|
8bb0b73733 | ||
|
|
d4f08a3f8a | ||
|
|
9736d37bc9 | ||
|
|
81d613bc4d | ||
|
|
4840faa422 | ||
|
|
1b7b43a4e5 | ||
|
|
e1bbc85cc4 | ||
|
|
b2585dfd28 | ||
|
|
1c3fdd2719 | ||
|
|
264f1590f0 | ||
|
|
cba1edc9e8 | ||
|
|
486321bb02 | ||
|
|
6db2927484 | ||
|
|
f832a7c9db | ||
|
|
ca45d14511 | ||
|
|
5080139511 | ||
|
|
6baf287a5f | ||
|
|
d592b8e4c9 | ||
|
|
9e322dd6e7 | ||
|
|
bf8f2ac12f | ||
|
|
137238faed | ||
|
|
f5c96beedd | ||
|
|
26e479422a | ||
|
|
dc9b1edb5b | ||
|
|
31259f6448 | ||
|
|
1168789e8a | ||
|
|
214df1a1cb | ||
|
|
48ee2eb78a | ||
|
|
31002fc6e8 | ||
|
|
4e87e72110 | ||
|
|
8922632ead | ||
|
|
24e46544d8 | ||
|
|
3c66ce9a73 | ||
|
|
13384f63d3 | ||
|
|
83ba5a7b57 | ||
|
|
ca1272bd69 | ||
|
|
554e90a46c | ||
|
|
c391b90823 | ||
|
|
06c82488a8 | ||
|
|
40966dd5c5 | ||
|
|
293efab0c2 | ||
|
|
ea917c28da | ||
|
|
7a131d0ae1 | ||
|
|
681d5c4709 | ||
|
|
67b15986a7 | ||
|
|
a2c8d8c2d5 | ||
|
|
357e905e8b | ||
|
|
0cca050bcd | ||
|
|
9a26ad9189 | ||
|
|
b656720619 | ||
|
|
c52686c243 | ||
|
|
cf808cb3fc | ||
|
|
834a95c503 | ||
|
|
15ee5dee05 | ||
|
|
20856fc102 | ||
|
|
f780c5d18f | ||
|
|
7c7d7fd405 | ||
|
|
31d8b547c8 | ||
|
|
e3732ef610 | ||
|
|
b2335d2b73 | ||
|
|
6126080cdf | ||
|
|
7a97d24c77 | ||
|
|
18e41a1c4e | ||
|
|
1f67c993e2 | ||
|
|
cc9dfb8630 | ||
|
|
c8de86a7ec | ||
|
|
36b63a107c | ||
|
|
4b4dfb4ccd | ||
|
|
a9e012530d | ||
|
|
f7242e1250 | ||
|
|
b86c60694c | ||
|
|
ecc13ff62a | ||
|
|
6b99923363 | ||
|
|
4cc2cc1aeb | ||
|
|
f2516b08b1 | ||
|
|
4e4282a76e | ||
|
|
b8ffe0477b | ||
|
|
b7dc71ab1b | ||
|
|
6d49b28678 | ||
|
|
eaf2212aa8 | ||
|
|
0edcab0da6 | ||
|
|
236c7c4499 | ||
|
|
2845284284 | ||
|
|
bf1bb2b7ca | ||
|
|
a36a429128 | ||
|
|
93579e90ef | ||
|
|
9c6cf6fdb6 | ||
|
|
93978211a1 | ||
|
|
7fd4b64e8a | ||
|
|
9dad1d20e8 | ||
|
|
e334ecf059 | ||
|
|
adb917273c | ||
|
|
aa7c1d0fe8 | ||
|
|
166a136f22 | ||
|
|
51034af207 | ||
|
|
ae34ae9518 | ||
|
|
58e0200fbd | ||
|
|
63d1ffceb8 | ||
|
|
3a7dd774a2 | ||
|
|
9a59cf0590 | ||
|
|
ec1b3d35ee | ||
|
|
d42854ddb6 | ||
|
|
6f1b18937c | ||
|
|
9945240ea8 | ||
|
|
d6260988bd | ||
|
|
69632b3f03 | ||
|
|
f69885e7b9 | ||
|
|
4448bda721 | ||
|
|
70ad01550b | ||
|
|
38788e0c7e | ||
|
|
889f4e3381 | ||
|
|
3066d47003 | ||
|
|
108c1cdc55 | ||
|
|
ca5f081302 | ||
|
|
e180cfe456 | ||
|
|
701f770ab7 | ||
|
|
21f4bb3053 | ||
|
|
250e206b59 | ||
|
|
e7f70f3450 | ||
|
|
2c7a306961 | ||
|
|
1587c59f40 | ||
|
|
3738a6806e | ||
|
|
ba3d616282 | ||
|
|
6da3fd3c06 | ||
|
|
41a5b74f93 | ||
|
|
04b224caa5 | ||
|
|
258b9a65c8 | ||
|
|
ad8eeccd72 | ||
|
|
726c8caf54 | ||
|
|
37c15e66cd | ||
|
|
a0e57459dc | ||
|
|
4e347b33d7 | ||
|
|
677e042c3a | ||
|
|
d5149b2867 | ||
|
|
1dee5f33cf | ||
|
|
608730531f | ||
|
|
d965a69601 | ||
|
|
46c41c5ac1 | ||
|
|
cfa29cc1c2 | ||
|
|
e24b2e1ba7 | ||
|
|
fa0ba2e2ab | ||
|
|
8b2e21b634 | ||
|
|
c52c7abb65 | ||
|
|
733f845f8f | ||
|
|
cb3e211135 | ||
|
|
4852028743 | ||
|
|
dfea4e12a6 | ||
|
|
5940d18ab2 | ||
|
|
9fe6a58669 | ||
|
|
072c3bfdb3 | ||
|
|
d9cb88e987 | ||
|
|
5a7a11a62b | ||
|
|
9020e6769e | ||
|
|
d423e9bb57 | ||
|
|
38345041fd | ||
|
|
777b48f184 | ||
|
|
3583cfe7eb | ||
|
|
638154936c | ||
|
|
122aaf17b1 | ||
|
|
9b5483a1e0 | ||
|
|
5e64b26451 | ||
|
|
7657992a83 | ||
|
|
30e3981ed2 | ||
|
|
11d82be21c | ||
|
|
ecfafd7576 | ||
|
|
f51811b96b | ||
|
|
aa44594ed3 | ||
|
|
0945a37c61 | ||
|
|
1451fadc4a | ||
|
|
d9ea617545 | ||
|
|
ebf5cf784f | ||
|
|
2d60f3220d | ||
|
|
00f9bb5897 | ||
|
|
2513e54540 | ||
|
|
a10fe823b2 | ||
|
|
b230242127 | ||
|
|
0ce843016b | ||
|
|
21db2d40a4 | ||
|
|
cb7ffd0ac2 | ||
|
|
b0de8e7d1d | ||
|
|
68118685d0 | ||
|
|
5e93950bc3 | ||
|
|
b8346af548 | ||
|
|
4f0d6f78ba | ||
|
|
dfa0b5f8ce | ||
|
|
7628b41fdf | ||
|
|
6ed320311e | ||
|
|
5a68ef600b | ||
|
|
8f4f4dcd48 | ||
|
|
8fbd060148 | ||
|
|
aec9582d83 | ||
|
|
18664fb955 | ||
|
|
e9a4251c7e | ||
|
|
5b34391eea | ||
|
|
18ec5d63f3 | ||
|
|
72311767c5 | ||
|
|
41227e8e08 | ||
|
|
90a8900208 | ||
|
|
9e572ecd9b | ||
|
|
85e9144822 | ||
|
|
815bb52ebf | ||
|
|
24d120baf1 | ||
|
|
487622bb9e | ||
|
|
fa6a80fb4d | ||
|
|
5fe485adac | ||
|
|
5f8fad3985 | ||
|
|
06c2f5683b | ||
|
|
58adc1eb1f | ||
|
|
4f7790baab | ||
|
|
7768c56a56 | ||
|
|
415bdb378d | ||
|
|
9e93d5eae5 | ||
|
|
9abf4473b0 | ||
|
|
b13aa70ae9 | ||
|
|
71ac081cfa | ||
|
|
74e52ce71b | ||
|
|
e401adeb7e | ||
|
|
d6b0977afe | ||
|
|
d7ed18c39d | ||
|
|
3c6a1a1568 | ||
|
|
b209fec72b | ||
|
|
18b3c754ef | ||
|
|
fe531cae55 | ||
|
|
c00c77c4c1 | ||
|
|
b1903524b9 | ||
|
|
2045e52db7 | ||
|
|
1534dc23c3 | ||
|
|
8cea3221dc | ||
|
|
6e4f18c2b0 | ||
|
|
607378b8fb | ||
|
|
014ff7d261 | ||
|
|
2d2fe52b7a | ||
|
|
8931ab12b2 | ||
|
|
57ae7008b2 | ||
|
|
81af913a66 | ||
|
|
81a1b2acff | ||
|
|
9958a4825f | ||
|
|
b3982ebb70 | ||
|
|
0a73bfd115 | ||
|
|
3219950d59 | ||
|
|
5206c7f690 | ||
|
|
6e172747ec | ||
|
|
e3020c0db3 | ||
|
|
235cc1205c | ||
|
|
5b0c8a3e28 | ||
|
|
58a2849e38 | ||
|
|
98026aefaf | ||
|
|
d2b0b317e0 | ||
|
|
bc448aed6c | ||
|
|
d862b1f267 | ||
|
|
67f3bd369c | ||
|
|
af31fc5340 | ||
|
|
3c9fa2df13 | ||
|
|
1956908aa7 | ||
|
|
3a7b8aba44 | ||
|
|
6aae8bdccb | ||
|
|
f91863ed64 | ||
|
|
4d76baea42 | ||
|
|
c408ac5d50 | ||
|
|
7b7d4e4936 | ||
|
|
b375b8580f | ||
|
|
54e7c6dd5a | ||
|
|
1c35c4871a | ||
|
|
481f2c7310 | ||
|
|
067c4f6809 | ||
|
|
3390c907dc | ||
|
|
54b94be65a | ||
|
|
23407c99dd | ||
|
|
5057617de7 | ||
|
|
7c8cfb7b8a | ||
|
|
b2c627d57c | ||
|
|
9e5da1e025 | ||
|
|
ccf291234e | ||
|
|
d8d697c848 | ||
|
|
a4b532083b | ||
|
|
7790b6a6b0 | ||
|
|
01209ddbd1 | ||
|
|
75620caf51 | ||
|
|
1bcef04ddc | ||
|
|
1717bd4978 | ||
|
|
0f963e40a7 | ||
|
|
bbe517aa60 | ||
|
|
254d300ea7 | ||
|
|
dcf637df5a | ||
|
|
d84da93a36 | ||
|
|
8ffaa1c8b7 | ||
|
|
5e2374be4a | ||
|
|
a5ec49d99d | ||
|
|
575c5531b8 | ||
|
|
2a088fb45b | ||
|
|
6cf10b4562 | ||
|
|
c9b19cf65b | ||
|
|
10b106ce05 | ||
|
|
56ca30ab95 | ||
|
|
d5da80b56e | ||
|
|
0b99f8f3e2 | ||
|
|
e6496bf411 | ||
|
|
b1661af71a | ||
|
|
c0f8cae55c | ||
|
|
0db21ae115 | ||
|
|
b188ab94e1 | ||
|
|
8f85424fb7 | ||
|
|
cf3132acac | ||
|
|
c2b54cc343 | ||
|
|
260bb75fc2 | ||
|
|
af5a271e9e | ||
|
|
c15d4d155d | ||
|
|
7930f5d136 | ||
|
|
7b3b723646 | ||
|
|
c177c55d07 | ||
|
|
9f684c745e | ||
|
|
0c4bd1d02f | ||
|
|
5b688d50d8 | ||
|
|
31968fa814 | ||
|
|
fb60865b8d | ||
|
|
a44aee8c34 | ||
|
|
6a7594630c | ||
|
|
d9165f00fa | ||
|
|
9dd5e0c27d | ||
|
|
f472bfbc75 | ||
|
|
b50de97a41 | ||
|
|
32fb85fc8e | ||
|
|
7aef21faca | ||
|
|
78ffbff0c1 | ||
|
|
a7bfc8da51 | ||
|
|
d0bcfea4a4 | ||
|
|
a2a70736ad | ||
|
|
5ccf985f9a | ||
|
|
c12f98f69a | ||
|
|
1c20a4ed22 | ||
|
|
79a7d5fe0e | ||
|
|
55da063ed9 | ||
|
|
586f45efea | ||
|
|
718f84c8f6 | ||
|
|
b5865b2fc2 | ||
|
|
d9d79c0666 | ||
|
|
1a03a6cf58 | ||
|
|
25348c6e49 | ||
|
|
663fb036d0 | ||
|
|
9b174e52c1 | ||
|
|
3cf0770376 | ||
|
|
49eb9d1f17 | ||
|
|
ea6edf95cc | ||
|
|
925e9e0919 | ||
|
|
c51b6febc0 | ||
|
|
9f28ece4e9 | ||
|
|
768a070715 | ||
|
|
54eb6e6f2c | ||
|
|
28505b0b77 | ||
|
|
e19de8e8a4 | ||
|
|
7eb19c8f76 | ||
|
|
7f55816eba | ||
|
|
18760620b3 | ||
|
|
8a20678a7a | ||
|
|
9d65414684 | ||
|
|
45ee8b7faf | ||
|
|
d8c0441975 | ||
|
|
683d91990f | ||
|
|
677e3f6a19 | ||
|
|
4b9ae18d5a | ||
|
|
e61c40e71d | ||
|
|
aa49536e3e | ||
|
|
2bfd82e229 | ||
|
|
d09da0b6f2 | ||
|
|
18c26f9218 | ||
|
|
f376f207b8 | ||
|
|
1951db58c1 | ||
|
|
e07c6559a9 | ||
|
|
8c62cea580 | ||
|
|
f5e3807654 | ||
|
|
139242612d | ||
|
|
0c3eb4bafc | ||
|
|
affccc7937 | ||
|
|
198165ce59 | ||
|
|
dfa2f36cad | ||
|
|
4c9e75088a | ||
|
|
fe454dbaf3 | ||
|
|
27946cad30 | ||
|
|
8fa1d4f224 | ||
|
|
87498e43e1 | ||
|
|
54155bf5a9 | ||
|
|
af4f834149 | ||
|
|
9ee99d2c45 | ||
|
|
de83da2bbf | ||
|
|
6475812e82 | ||
|
|
32907215ed | ||
|
|
adc1428607 | ||
|
|
e028aef6d2 | ||
|
|
3906be19ee | ||
|
|
cdc18522a2 | ||
|
|
4c4c6f43ca | ||
|
|
96b21badaf | ||
|
|
536a1b89d7 | ||
|
|
94cf1aecb6 | ||
|
|
c93880b125 | ||
|
|
2593e9e200 | ||
|
|
fe647f6e55 | ||
|
|
4fa945561f | ||
|
|
5b9719071e | ||
|
|
682b88bd28 | ||
|
|
da43a880e3 | ||
|
|
d9ddc162a3 | ||
|
|
844a7c95ba | ||
|
|
4e37afa15d | ||
|
|
0bd7c0b301 | ||
|
|
aa27109101 | ||
|
|
1a06173e1b | ||
|
|
e76487172b | ||
|
|
b2cafffffc | ||
|
|
82f3a2ab44 | ||
|
|
c22f7eab5e | ||
|
|
da604a80c4 | ||
|
|
e02c5f74e6 | ||
|
|
0c9626cedd | ||
|
|
65a594d271 | ||
|
|
a89e4c93a7 | ||
|
|
e40449e7c8 | ||
|
|
13fc647d01 | ||
|
|
d1ce0c366a | ||
|
|
46b7bea097 | ||
|
|
c5d0f71963 | ||
|
|
a228811a61 | ||
|
|
d54cc6efee | ||
|
|
58c6c52ee9 | ||
|
|
90d4d30dd3 | ||
|
|
e6501eb9ff | ||
|
|
cdb3633e37 | ||
|
|
0b27bb927d | ||
|
|
254064150d | ||
|
|
2480103b49 | ||
|
|
7f46d951eb | ||
|
|
453ddf078b | ||
|
|
e47ce1b4fc | ||
|
|
65b0f062ad | ||
|
|
96a47ec0ae | ||
|
|
94be56b0ec | ||
|
|
4d9e9bc81b | ||
|
|
84fa44090f | ||
|
|
5ec2c8560e | ||
|
|
b147919a64 | ||
|
|
c52c96d657 | ||
|
|
85e1e5c280 | ||
|
|
b394247740 | ||
|
|
dd27f668e0 | ||
|
|
9bc85347ef | ||
|
|
6ba2df474f | ||
|
|
3380aa8b19 | ||
|
|
57ededeabf | ||
|
|
9989e4e387 | ||
|
|
833cf07c1a | ||
|
|
853fcec1b6 | ||
|
|
081c6722f6 | ||
|
|
e885b371bc | ||
|
|
6253adaba1 | ||
|
|
a7981717b3 | ||
|
|
ca82e19bba | ||
|
|
67b18c32e7 | ||
|
|
ed24140e2f | ||
|
|
91ada213c5 | ||
|
|
5741e47129 | ||
|
|
a09e7151ac | ||
|
|
71618f704d | ||
|
|
566e625b85 | ||
|
|
9b722a5b0c | ||
|
|
34bda10536 | ||
|
|
400ee57bee | ||
|
|
ade497d9d7 | ||
|
|
c08f2718af | ||
|
|
45e2e92af7 | ||
|
|
a8d1775eb1 | ||
|
|
2c5970a388 | ||
|
|
d8387c1aba | ||
|
|
d8caa0b572 | ||
|
|
d7fc1a5f7b | ||
|
|
296706aa03 | ||
|
|
992d842552 | ||
|
|
f73beaa26a | ||
|
|
16a9ded2c9 | ||
|
|
de01e86d41 | ||
|
|
97d60dd985 | ||
|
|
fe3f383621 | ||
|
|
de2e05bc11 | ||
|
|
997e21433c | ||
|
|
4c846426ce | ||
|
|
fb1e2e41cc | ||
|
|
9ffce350f5 | ||
|
|
bb70eb0b4c | ||
|
|
17680f7aec | ||
|
|
6b48451ebc | ||
|
|
a0111be6ae | ||
|
|
e29a3e7c10 | ||
|
|
8bafe0000f | ||
|
|
77f2b16bc1 | ||
|
|
f9a05547f7 | ||
|
|
eb6900969f | ||
|
|
9affbf4ecf | ||
|
|
d8f4a28b94 | ||
|
|
9ffbd98cc6 | ||
|
|
edc3aa3cce | ||
|
|
f41c542ba0 | ||
|
|
6a6497956d | ||
|
|
250fbd49b1 | ||
|
|
30b224b3d0 | ||
|
|
8a2cba2292 | ||
|
|
740e66acf5 | ||
|
|
0869bdc8f7 | ||
|
|
7fe32e6ac1 | ||
|
|
f3c73f333a | ||
|
|
a95c3f83bc | ||
|
|
557af99a6d | ||
|
|
59de019881 | ||
|
|
def023752d | ||
|
|
bded91af9f | ||
|
|
04d0c02e23 | ||
|
|
ba035185c7 | ||
|
|
cc57eb987e | ||
|
|
7324070c30 | ||
|
|
d061c6dc7c | ||
|
|
fede4f736e | ||
|
|
ab978356c3 | ||
|
|
e7232a715b | ||
|
|
99d8b5256f | ||
|
|
6a926e26f1 | ||
|
|
615c1d5576 | ||
|
|
7ddaed240f | ||
|
|
e846602d1e | ||
|
|
ee95cf3df0 | ||
|
|
5ff15e06a2 | ||
|
|
377fb99fbc | ||
|
|
b868c3370c | ||
|
|
874c6d6fb6 | ||
|
|
91a8dd3b22 | ||
|
|
3f40c5e408 | ||
|
|
5b381bc0c0 | ||
|
|
604e60cae9 | ||
|
|
9cd5ab7433 | ||
|
|
fd127ef9bb | ||
|
|
24f3463f9a | ||
|
|
c0ed4ab03d | ||
|
|
304173c4d7 | ||
|
|
33739ea21c | ||
|
|
46476d7101 | ||
|
|
47c837abef | ||
|
|
46a5f96d3b | ||
|
|
12ad6fa865 | ||
|
|
623bd993d8 | ||
|
|
07e97c38cd | ||
|
|
cf6319d7d4 | ||
|
|
4308ce9eab | ||
|
|
edd9617c03 | ||
|
|
1813e2db38 | ||
|
|
4105a9aad1 | ||
|
|
e0096dba08 | ||
|
|
8a9a4784d9 | ||
|
|
caba7e238f | ||
|
|
9a91d54e10 | ||
|
|
30183e2881 | ||
|
|
4f6fa5079f | ||
|
|
0425a25cdb | ||
|
|
8ed3cacfe8 | ||
|
|
4c68ebbe9d | ||
|
|
99b04f0353 | ||
|
|
4a530d1d97 | ||
|
|
35aa6d6291 | ||
|
|
bdca366d91 | ||
|
|
7d929fee8c | ||
|
|
d480aab1b0 | ||
|
|
23693b403c | ||
|
|
ca29ceb1fa | ||
|
|
d1a79b79f1 | ||
|
|
2d87fd320d | ||
|
|
400a8e65d3 | ||
|
|
526d0ac8de | ||
|
|
709ea1e14c | ||
|
|
46e179d148 | ||
|
|
b20cd4fa9f | ||
|
|
1d8e7b8374 | ||
|
|
d2b9e88047 | ||
|
|
fd7ee76438 | ||
|
|
b614497ae6 | ||
|
|
fce1bf28c8 | ||
|
|
512cf952ae | ||
|
|
4767703f86 | ||
|
|
7250b15e74 | ||
|
|
6daf31be8f | ||
|
|
56720df487 | ||
|
|
ed704da5b2 | ||
|
|
3e6745f146 | ||
|
|
200c2f1eb0 | ||
|
|
7908491ba3 | ||
|
|
8929917677 | ||
|
|
0f200d99f4 | ||
|
|
46a037ebd0 | ||
|
|
219f3bcee1 | ||
|
|
87acd3764b | ||
|
|
5d5362a3fd | ||
|
|
5a57409df0 | ||
|
|
ad38d4c20f | ||
|
|
f7d2ad7201 | ||
|
|
9e029415cc | ||
|
|
dc7cb1ee75 | ||
|
|
253b060241 | ||
|
|
194e5c47e4 | ||
|
|
f6dd78daa6 | ||
|
|
88bbe49d01 | ||
|
|
d4c6427418 | ||
|
|
0c7593ba10 | ||
|
|
905029a59e | ||
|
|
fd156bf12a | ||
|
|
c079bf7f10 | ||
|
|
9081ed9868 | ||
|
|
8f512bf618 | ||
|
|
05e2f1bf63 | ||
|
|
3b7b894290 | ||
|
|
cfc89b7853 | ||
|
|
86115b9e2d | ||
|
|
3b6f9cea21 | ||
|
|
274f50ce5a | ||
|
|
ca25eba8aa | ||
|
|
23bc837666 | ||
|
|
6a460c292d | ||
|
|
def9123575 | ||
|
|
911739a0b2 | ||
|
|
01008a591b | ||
|
|
355027d854 | ||
|
|
2ea9ffbdd4 | ||
|
|
72a6b1b19f | ||
|
|
5d928db916 | ||
|
|
6faddc684a | ||
|
|
5a5ae48bb6 | ||
|
|
ab5d4468f9 | ||
|
|
3429c443ad | ||
|
|
446d3478e4 | ||
|
|
2e562512f4 | ||
|
|
ad83196a05 | ||
|
|
7b30145270 | ||
|
|
ffa9c156d7 | ||
|
|
b4b87cd1dc | ||
|
|
6a5d2a636d | ||
|
|
8d82340589 | ||
|
|
38ea5ecb5f | ||
|
|
e07195c512 | ||
|
|
0354e4e4a1 | ||
|
|
670d46e543 | ||
|
|
ac357d10d5 | ||
|
|
b22208f810 | ||
|
|
bc4750dd7c | ||
|
|
ab9a3dbc63 | ||
|
|
9cd373806c | ||
|
|
5ad68e0ba6 | ||
|
|
8eb72c976a | ||
|
|
c9350d3e80 | ||
|
|
a01d22ed67 | ||
|
|
3f8892ed91 | ||
|
|
e72446442b | ||
|
|
ff8234bce4 | ||
|
|
d8dcc770a9 | ||
|
|
8bb9a99975 | ||
|
|
07c9d9fd00 | ||
|
|
379df3cebd | ||
|
|
e4fe0c6673 | ||
|
|
266817ecac | ||
|
|
6328b83388 | ||
|
|
ba6c03e06d | ||
|
|
9e7e07d0bc | ||
|
|
c8b55b8e59 | ||
|
|
fcdafeedd4 | ||
|
|
778a77ecff | ||
|
|
7b9e262e44 | ||
|
|
ebd4741774 | ||
|
|
13dc3bb2e4 | ||
|
|
5412df29fa | ||
|
|
64a6505f70 | ||
|
|
610d91e041 | ||
|
|
0bd396b5cb | ||
|
|
9634352b0f | ||
|
|
1b9c1d921b | ||
|
|
75bf84fa48 | ||
|
|
ac4180ef7d | ||
|
|
56a3a53e7b | ||
|
|
5ddb3f0b77 | ||
|
|
9653619c48 | ||
|
|
1e9203adc9 | ||
|
|
603bb9b02b | ||
|
|
9c1c544954 | ||
|
|
9ac9016f50 | ||
|
|
a7a35c688d | ||
|
|
200d846f61 | ||
|
|
92fc54992a | ||
|
|
ce377b9b58 | ||
|
|
67ca6ec1fd | ||
|
|
8c7ed19d62 | ||
|
|
64957d9ec8 | ||
|
|
de9268ae12 | ||
|
|
056f81078f | ||
|
|
aa4c3f8486 | ||
|
|
15eeaa2574 | ||
|
|
835aa9c5a4 | ||
|
|
b926eec3bc | ||
|
|
03d4a36b9b | ||
|
|
601a2b6ec6 | ||
|
|
f4697ab6e1 | ||
|
|
0459670a9c | ||
|
|
3cbc65bae4 | ||
|
|
0f50b6dc61 | ||
|
|
87a355bb82 | ||
|
|
7792eb2769 | ||
|
|
ba9e8958d7 | ||
|
|
f7cb73e8a6 | ||
|
|
a4df134a4c | ||
|
|
4084d4f191 | ||
|
|
e6f4d0276a | ||
|
|
0beeb275fe | ||
|
|
75a3fb8e40 | ||
|
|
6657f0eec3 | ||
|
|
7e3d9fb89a | ||
|
|
cb469b973e | ||
|
|
e0a2c40fb4 | ||
|
|
5364feb6c8 | ||
|
|
3f3f398524 | ||
|
|
0be9ae3353 | ||
|
|
a8ade6d22d | ||
|
|
743dbff9d4 | ||
|
|
34a1be0053 | ||
|
|
8ce1a19ec4 | ||
|
|
f6aafe48bb | ||
|
|
8b0ce2e936 | ||
|
|
0115fc3d91 | ||
|
|
6cd2633b85 | ||
|
|
f1aee39700 | ||
|
|
9d57693acd | ||
|
|
34ac7170a2 | ||
|
|
d5291629f7 | ||
|
|
41a048604e | ||
|
|
2fc685b4da | ||
|
|
15585dd3c7 | ||
|
|
c653377b2e | ||
|
|
c448046b52 | ||
|
|
cf76b1f217 | ||
|
|
7c256b5344 | ||
|
|
18cb0b26f7 | ||
|
|
be6b6008e8 | ||
|
|
b72ffbdc98 | ||
|
|
4c7c84b17e | ||
|
|
88cc13dd85 | ||
|
|
722c81d89d | ||
|
|
24c440b0ab | ||
|
|
b919d58bac | ||
|
|
e9cc289243 | ||
|
|
21303ed4fb | ||
|
|
17849b3514 | ||
|
|
a6c6f9faa1 | ||
|
|
f3f11cb64b | ||
|
|
8a5433e5df | ||
|
|
663a552d29 | ||
|
|
ef95611203 | ||
|
|
e7c551a0bf | ||
|
|
6a3135bff2 | ||
|
|
29f7cfb581 | ||
|
|
ce492133a6 | ||
|
|
0f649f3f37 | ||
|
|
d5dbfb98b0 | ||
|
|
fd418e0746 | ||
|
|
ccccb3d679 | ||
|
|
f59b7228bb | ||
|
|
8c3efa4a51 | ||
|
|
2074d35ab0 | ||
|
|
aae9ad4249 | ||
|
|
28e3242a1d | ||
|
|
e22ece8c00 | ||
|
|
cbea5aed87 | ||
|
|
eff532e64f | ||
|
|
2d1b52bc90 | ||
|
|
2b4b200e42 | ||
|
|
11d816f94d | ||
|
|
373039cbdc | ||
|
|
64f06e1114 | ||
|
|
f0fa91f63c | ||
|
|
8aabf812f8 | ||
|
|
ee2dcddc6e | ||
|
|
6a84b8ed26 | ||
|
|
7ce54abac3 | ||
|
|
ac89cc39ea | ||
|
|
f21f79761a | ||
|
|
68dd3fd576 | ||
|
|
a55405e655 | ||
|
|
11c711b275 | ||
|
|
09e669f9e9 | ||
|
|
6e49e89547 | ||
|
|
1cfb62de0d | ||
|
|
0e0817c972 | ||
|
|
759794d746 | ||
|
|
71574d1fe2 | ||
|
|
4decaffd53 | ||
|
|
76246630ce | ||
|
|
0221414ee0 | ||
|
|
703e34137b | ||
|
|
483a167500 | ||
|
|
05387fac09 | ||
|
|
488b10b73b | ||
|
|
f9cab8d02c | ||
|
|
d8c5703e06 | ||
|
|
aef7a0ba76 | ||
|
|
7c08dd595b | ||
|
|
217fd6ecf1 | ||
|
|
517c432ee6 | ||
|
|
91f79d85cf | ||
|
|
d23409f687 | ||
|
|
8b960c79d5 | ||
|
|
1ab93e7e8a | ||
|
|
8d7775552c | ||
|
|
fc3bc29a02 | ||
|
|
da60645be3 | ||
|
|
b6a9f7c9b3 | ||
|
|
38a4e79c3c | ||
|
|
1a1b362f40 | ||
|
|
6da9d8a0bf | ||
|
|
c4c35ddb63 | ||
|
|
204f0c32ec | ||
|
|
51c6b5fc38 | ||
|
|
a070628225 | ||
|
|
46eebe2136 | ||
|
|
60e7f53945 | ||
|
|
3f9ab94812 | ||
|
|
000e36acfe | ||
|
|
1c0444646e | ||
|
|
c50e3c581a | ||
|
|
18474c56c4 | ||
|
|
2216bc6130 | ||
|
|
8318b412e9 | ||
|
|
77ed1565c3 | ||
|
|
e7229fc15c | ||
|
|
0953065b8c | ||
|
|
d52d9b8985 | ||
|
|
23e19a2d47 | ||
|
|
49492b2516 | ||
|
|
c71069022e | ||
|
|
98d2e0df33 | ||
|
|
0a3f873972 | ||
|
|
31cc01a3d1 | ||
|
|
4486e2befb | ||
|
|
2bcfacfbf9 | ||
|
|
1827eab20c | ||
|
|
7817524b31 | ||
|
|
54013a6164 | ||
|
|
fb863cdf21 | ||
|
|
133b727f59 | ||
|
|
7deb010318 | ||
|
|
e2ea1eec7c | ||
|
|
3f1e0ac4a7 | ||
|
|
649da97a42 | ||
|
|
4c7e1399fe | ||
|
|
0652302423 | ||
|
|
b011e6f157 | ||
|
|
f51422ad8d | ||
|
|
c6fff318f3 | ||
|
|
508d6194fc | ||
|
|
ebbb3a525e | ||
|
|
a2d307936d | ||
|
|
a07dc6cdf0 | ||
|
|
ec3c62b051 | ||
|
|
4954f28012 | ||
|
|
d3f3a4a172 | ||
|
|
38ca52ead1 | ||
|
|
d9627e19fd | ||
|
|
023977a885 | ||
|
|
40984dcc88 | ||
|
|
d57973693d | ||
|
|
f4ec74a4c5 | ||
|
|
adfcc62e64 | ||
|
|
1c5bb3a911 | ||
|
|
28f801b5d0 | ||
|
|
0857f36572 | ||
|
|
16495a0a0d | ||
|
|
53a53695ff | ||
|
|
d2daa5a48c | ||
|
|
17521e7593 | ||
|
|
3c3eecd4da | ||
|
|
a68634c3f1 | ||
|
|
995dc68706 | ||
|
|
8bc236460a | ||
|
|
a621447993 | ||
|
|
ea4388def5 | ||
|
|
3981e01489 | ||
|
|
f359825cb7 | ||
|
|
5781f659b1 | ||
|
|
529edcb68e | ||
|
|
9f0b437e60 | ||
|
|
7bd6cbdb64 | ||
|
|
43fb23d896 | ||
|
|
bcfb3e868c | ||
|
|
e6d73d8ff8 | ||
|
|
95c097106f | ||
|
|
c75056f076 | ||
|
|
ef3c3b8a9d | ||
|
|
c75bbf16a7 | ||
|
|
e771b473a6 | ||
|
|
e24fec7966 | ||
|
|
4ebd668d7a | ||
|
|
e3c88526b9 | ||
|
|
f884527af1 | ||
|
|
015a34f5cb | ||
|
|
3965f110ff | ||
|
|
d74c0bd878 | ||
|
|
f7afdebb03 | ||
|
|
d3908deff8 | ||
|
|
09e5e352a9 | ||
|
|
12823a5fbf | ||
|
|
505cc76406 | ||
|
|
94c0d02330 | ||
|
|
b446a23b61 | ||
|
|
873d41a872 | ||
|
|
a123ce41e5 | ||
|
|
3a58c818bd | ||
|
|
adf20d318f | ||
|
|
90295fe09c | ||
|
|
75b479fa23 | ||
|
|
d11b2467aa | ||
|
|
a9398e32c7 | ||
|
|
cb034879b4 | ||
|
|
13a1c9f24f | ||
|
|
e929610746 | ||
|
|
304765162e | ||
|
|
a6528471c2 | ||
|
|
3a251770e8 | ||
|
|
62d3f97e30 | ||
|
|
cd2e7f7347 | ||
|
|
b0ff13c075 | ||
|
|
c1cfd503a5 | ||
|
|
637c2bce79 | ||
|
|
07e0d4cd6d | ||
|
|
db8221d303 | ||
|
|
988eaca87e | ||
|
|
7a2125c7e9 | ||
|
|
1b56db21dc | ||
|
|
858ab18919 | ||
|
|
26b0eaca2a | ||
|
|
1383cefec6 | ||
|
|
1cd4fbf5ae | ||
|
|
7fdc50b6b8 | ||
|
|
4212c7e32a | ||
|
|
daf7d11144 | ||
|
|
9770f44877 | ||
|
|
6ef9ac222c | ||
|
|
fef4a367fe | ||
|
|
d5e276ac62 | ||
|
|
b7387be3fd | ||
|
|
a5c3645717 | ||
|
|
520a7a8bc6 | ||
|
|
f33abcdcc4 | ||
|
|
75022c5526 | ||
|
|
8e9f86564d | ||
|
|
a38ec77afe | ||
|
|
0198aec0d1 | ||
|
|
f2cd42fecf | ||
|
|
18c54623b0 | ||
|
|
17ee9e1bf8 | ||
|
|
cb6ad0e9d3 | ||
|
|
e0dea8e95c | ||
|
|
fbdd5f15bb | ||
|
|
25a5ba2b4c | ||
|
|
2c040d2d33 | ||
|
|
f902549614 | ||
|
|
4eefb60362 | ||
|
|
cc305bcb11 | ||
|
|
00adf6de81 | ||
|
|
8bb4573534 | ||
|
|
2a5c66784b |
21
.gitattributes
vendored
Normal file
21
.gitattributes
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# build config
|
||||
/.scrutinizer.yml export-ignore
|
||||
/.github export-ignore
|
||||
/php_cs.dist export-ignore
|
||||
/phpmd.xml.dist export-ignore
|
||||
/phpstan.neon export-ignore
|
||||
|
||||
/composer.lock export-ignore
|
||||
|
||||
# git files
|
||||
/.gitignore export-ignore
|
||||
/.gitattributes export-ignore
|
||||
|
||||
# project directories
|
||||
/build export-ignore
|
||||
/docs export-ignore
|
||||
/samples export-ignore
|
||||
|
||||
# tests
|
||||
/phpunit.xml.dist export-ignore
|
||||
/tests export-ignore
|
||||
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help improve PHPWord
|
||||
labels: Bug Report
|
||||
|
||||
---
|
||||
|
||||
### Describe the Bug
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
### Steps to Reproduce
|
||||
|
||||
Please provide a code sample that reproduces the issue.
|
||||
|
||||
```php
|
||||
<?php
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$section->...
|
||||
```
|
||||
|
||||
### Expected Behavior
|
||||
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
### Current Behavior
|
||||
|
||||
What is the current behavior?
|
||||
|
||||
### Context
|
||||
|
||||
Please fill in your environment information:
|
||||
|
||||
- PHP Version:
|
||||
- PHPWord Version:
|
||||
22
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
labels: Change Request
|
||||
|
||||
---
|
||||
|
||||
### Is your feature request related to a problem? Please describe.
|
||||
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
### Describe the solution you'd like
|
||||
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
### Describe alternatives you've considered
|
||||
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
### Additional context
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
14
.github/ISSUE_TEMPLATE/how-to-use.md
vendored
Normal file
14
.github/ISSUE_TEMPLATE/how-to-use.md
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
name: How to Use PHPWord
|
||||
about: Find out how to use PHPWord
|
||||
labels: WontFix
|
||||
|
||||
---
|
||||
|
||||
***Please do not use the issue tracker to ask how to use PHPWord.***
|
||||
|
||||
Documentation is available on [Read the Docs](https://phpword.readthedocs.io/en/latest/).
|
||||
|
||||
Sample code is in the [`/samples/` directory](https://github.com/PHPOffice/PHPWord/tree/master/samples).
|
||||
|
||||
Usage questions belong on [Stack Overflow](https://stackoverflow.com/questions/tagged/phpword).
|
||||
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
11
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
### Description
|
||||
|
||||
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
### Checklist:
|
||||
|
||||
- [ ] I have run `composer run-script check --timeout=0` and no errors were reported
|
||||
- [ ] The new code is covered by unit tests (check build/coverage for coverage report)
|
||||
- [ ] I have updated the documentation to describe the changes
|
||||
8
.github/dependabot.yml
vendored
Normal file
8
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: composer
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "11:00"
|
||||
open-pull-requests-limit: 10
|
||||
15
.github/support.yml
vendored
Normal file
15
.github/support.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# Label used to mark issues as support requests
|
||||
supportLabel: Question
|
||||
# Comment to post on issues marked as support requests. Add a link
|
||||
# to a support page, or set to `false` to disable
|
||||
supportComment: >
|
||||
This looks like a support question. Please ask your support questions on
|
||||
[StackOverflow](http://stackoverflow.com/questions/tagged/phpword),
|
||||
or [Gitter](https://gitter.im/PHPOffice/PHPWord).
|
||||
|
||||
Thank you for your contributions.
|
||||
|
||||
# Whether to close issues marked as support requests
|
||||
close: true
|
||||
# Whether to lock issues marked as support requests
|
||||
lock: false
|
||||
119
.github/workflows/ci.yml
vendored
Normal file
119
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
name: CI
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version:
|
||||
- "7.1"
|
||||
- "7.2"
|
||||
- "7.3"
|
||||
- "7.4"
|
||||
- "8.0"
|
||||
- "8.1"
|
||||
|
||||
name: PHP ${{ matrix.php-version }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
|
||||
coverage: none
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Setup problem matchers for PHP
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
|
||||
|
||||
- name: Setup problem matchers for PHPUnit
|
||||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
|
||||
|
||||
- name: Configure matchers
|
||||
uses: mheap/phpunit-matcher-action@v1
|
||||
|
||||
- name: Test with PHPUnit
|
||||
run: ./vendor/bin/phpunit --no-coverage
|
||||
|
||||
php-cs-fixer:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
|
||||
coverage: none
|
||||
tools: cs2pr
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Code style with PHP-CS-Fixer
|
||||
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
|
||||
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
|
||||
coverage: pcov
|
||||
|
||||
- name: Get composer cache directory
|
||||
id: composer-cache
|
||||
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
|
||||
- name: Cache composer dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.composer-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: ${{ runner.os }}-composer-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --no-progress --prefer-dist --optimize-autoloader
|
||||
|
||||
- name: Coverage
|
||||
run: |
|
||||
./vendor/bin/phpunit --coverage-clover coverage-clover.xml
|
||||
curl -LO https://scrutinizer-ci.com/ocular.phar
|
||||
php ocular.phar code-coverage:upload --format=php-clover coverage-clover.xml
|
||||
29
.github/workflows/github-pages.yml
vendored
Normal file
29
.github/workflows/github-pages.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: GithHub Pages
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
github-pages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 7.4
|
||||
coverage: none # remove xdebug
|
||||
|
||||
- name: Build API documentation
|
||||
run: |
|
||||
curl -LO https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.0.0/phpDocumentor.phar
|
||||
php phpDocumentor.phar --directory src/ --target docs/api
|
||||
|
||||
- name: Deploy to GithHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/api
|
||||
8
.github_changelog_generator
Normal file
8
.github_changelog_generator
Normal file
@ -0,0 +1,8 @@
|
||||
user=PHPOffice
|
||||
project=PHPWord
|
||||
|
||||
since-tag=0.18.1
|
||||
future-release=0.18.2
|
||||
|
||||
issues=false
|
||||
pulls=true
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@ -6,14 +6,19 @@ Thumbs.db
|
||||
Desktop.ini
|
||||
.idea
|
||||
_build
|
||||
/build
|
||||
phpunit.xml
|
||||
composer.lock
|
||||
composer.phar
|
||||
vendor
|
||||
/report
|
||||
/samples/resources
|
||||
/build
|
||||
/samples/results
|
||||
/.settings
|
||||
phpword.ini
|
||||
/.buildpath
|
||||
/.project
|
||||
/.scannerwork
|
||||
/.project
|
||||
/nbproject
|
||||
/.php_cs.cache
|
||||
/.phpunit.result.cache
|
||||
|
||||
227
.php-cs-fixer.dist.php
Normal file
227
.php-cs-fixer.dist.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
$finder = PhpCsFixer\Finder::create()
|
||||
->notName('pclzip.lib.php')
|
||||
->notName('OLERead.php')
|
||||
->in('samples')
|
||||
->in('src')
|
||||
->in('tests');
|
||||
|
||||
$config = new PhpCsFixer\Config();
|
||||
$config
|
||||
->setRiskyAllowed(true)
|
||||
->setFinder($finder)
|
||||
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__))
|
||||
->setRules([
|
||||
'align_multiline_comment' => true,
|
||||
'array_indentation' => true,
|
||||
'array_syntax' => ['syntax' => 'short'],
|
||||
'backtick_to_shell_exec' => true,
|
||||
'binary_operator_spaces' => true,
|
||||
'blank_line_after_namespace' => true,
|
||||
'blank_line_after_opening_tag' => true,
|
||||
'blank_line_before_statement' => true,
|
||||
'braces' => true,
|
||||
'cast_spaces' => true,
|
||||
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const
|
||||
'class_definition' => false,
|
||||
'class_keyword_remove' => false, // ::class keyword gives us better support in IDE
|
||||
'combine_consecutive_issets' => true,
|
||||
'combine_consecutive_unsets' => true,
|
||||
'combine_nested_dirname' => true,
|
||||
'comment_to_phpdoc' => false, // interferes with annotations
|
||||
'compact_nullable_typehint' => true,
|
||||
'concat_space' => ['spacing' => 'one'],
|
||||
'constant_case' => true,
|
||||
'date_time_immutable' => false, // Break our unit tests
|
||||
'declare_equal_normalize' => true,
|
||||
'declare_strict_types' => false, // Too early to adopt strict types
|
||||
'dir_constant' => true,
|
||||
'doctrine_annotation_array_assignment' => true,
|
||||
'doctrine_annotation_braces' => true,
|
||||
'doctrine_annotation_indentation' => true,
|
||||
'doctrine_annotation_spaces' => true,
|
||||
'elseif' => true,
|
||||
'encoding' => true,
|
||||
'ereg_to_preg' => true,
|
||||
'escape_implicit_backslashes' => true,
|
||||
'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read
|
||||
'explicit_string_variable' => false, // I feel it makes the code actually harder to read
|
||||
'final_class' => false, // We need non-final classes
|
||||
'final_internal_class' => true,
|
||||
'final_public_method_for_abstract_class' => false, // We need non-final methods
|
||||
'fopen_flag_order' => true,
|
||||
'fopen_flags' => true,
|
||||
'full_opening_tag' => true,
|
||||
'fully_qualified_strict_types' => true,
|
||||
'function_declaration' => true,
|
||||
'function_to_constant' => true,
|
||||
'function_typehint_space' => true,
|
||||
'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright', 'throws']],
|
||||
'global_namespace_import' => true,
|
||||
'header_comment' => false, // We don't use common header in all our files
|
||||
'heredoc_indentation' => false, // Requires PHP >= 7.3
|
||||
'heredoc_to_nowdoc' => false, // Not sure about this one
|
||||
'implode_call' => true,
|
||||
'include' => true,
|
||||
'increment_style' => true,
|
||||
'indentation_type' => true,
|
||||
'is_null' => true,
|
||||
'line_ending' => true,
|
||||
'linebreak_after_opening_tag' => true,
|
||||
'list_syntax' => ['syntax' => 'short'],
|
||||
'logical_operators' => true,
|
||||
'lowercase_cast' => true,
|
||||
'lowercase_keywords' => true,
|
||||
'lowercase_static_reference' => true,
|
||||
'magic_constant_casing' => true,
|
||||
'magic_method_casing' => true,
|
||||
'mb_str_functions' => false, // No, too dangerous to change that
|
||||
'method_argument_space' => true,
|
||||
'method_chaining_indentation' => true,
|
||||
'modernize_types_casting' => true,
|
||||
'multiline_comment_opening_closing' => true,
|
||||
'multiline_whitespace_before_semicolons' => true,
|
||||
'native_constant_invocation' => false, // Micro optimization that look messy
|
||||
'native_function_casing' => true,
|
||||
'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it
|
||||
'native_function_type_declaration_casing' => true,
|
||||
'new_with_braces' => true,
|
||||
'no_alias_functions' => true,
|
||||
'no_alternative_syntax' => true,
|
||||
'no_binary_string' => true,
|
||||
'no_blank_lines_after_class_opening' => true,
|
||||
'no_blank_lines_after_phpdoc' => true,
|
||||
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
|
||||
'no_break_comment' => true,
|
||||
'no_closing_tag' => true,
|
||||
'no_empty_comment' => true,
|
||||
'no_empty_phpdoc' => true,
|
||||
'no_empty_statement' => true,
|
||||
'no_extra_blank_lines' => true,
|
||||
'no_homoglyph_names' => true,
|
||||
'no_leading_import_slash' => true,
|
||||
'no_leading_namespace_whitespace' => true,
|
||||
'no_mixed_echo_print' => true,
|
||||
'no_multiline_whitespace_around_double_arrow' => true,
|
||||
'no_null_property_initialization' => true,
|
||||
'no_php4_constructor' => true,
|
||||
'no_short_bool_cast' => true,
|
||||
'echo_tag_syntax' => ['format' => 'long'],
|
||||
'no_singleline_whitespace_before_semicolons' => true,
|
||||
'no_spaces_after_function_name' => true,
|
||||
'no_spaces_around_offset' => true,
|
||||
'no_spaces_inside_parenthesis' => true,
|
||||
'no_superfluous_elseif' => false, // Might be risky on a huge code base
|
||||
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
|
||||
'no_trailing_comma_in_list_call' => true,
|
||||
'no_trailing_comma_in_singleline_array' => true,
|
||||
'no_trailing_whitespace' => true,
|
||||
'no_trailing_whitespace_in_comment' => true,
|
||||
'no_unneeded_control_parentheses' => true,
|
||||
'no_unneeded_curly_braces' => true,
|
||||
'no_unneeded_final_method' => true,
|
||||
'no_unreachable_default_argument_value' => true,
|
||||
'no_unset_cast' => true,
|
||||
'no_unset_on_property' => true,
|
||||
'no_unused_imports' => true,
|
||||
'no_useless_else' => true,
|
||||
'no_useless_return' => true,
|
||||
'no_whitespace_before_comma_in_array' => true,
|
||||
'no_whitespace_in_blank_line' => true,
|
||||
'non_printable_character' => true,
|
||||
'normalize_index_brace' => true,
|
||||
'not_operator_with_space' => false, // No we prefer to keep '!' without spaces
|
||||
'not_operator_with_successor_space' => false, // idem
|
||||
'nullable_type_declaration_for_default_null_value' => true,
|
||||
'object_operator_without_whitespace' => true,
|
||||
'ordered_class_elements' => false, // We prefer to keep some freedom
|
||||
'ordered_imports' => true,
|
||||
'ordered_interfaces' => true,
|
||||
'php_unit_construct' => true,
|
||||
'php_unit_dedicate_assert' => true,
|
||||
'php_unit_dedicate_assert_internal_type' => true,
|
||||
'php_unit_expectation' => true,
|
||||
'php_unit_fqcn_annotation' => true,
|
||||
'php_unit_internal_class' => false, // Because tests are excluded from package
|
||||
'php_unit_method_casing' => true,
|
||||
'php_unit_mock' => true,
|
||||
'php_unit_mock_short_will_return' => true,
|
||||
'php_unit_namespaced' => true,
|
||||
'php_unit_no_expectation_annotation' => true,
|
||||
'phpdoc_order_by_value' => ['annotations' => ['covers']],
|
||||
'php_unit_set_up_tear_down_visibility' => true,
|
||||
'php_unit_size_class' => false, // That seems extra work to maintain for little benefits
|
||||
'php_unit_strict' => false, // We sometime actually need assertEquals
|
||||
'php_unit_test_annotation' => true,
|
||||
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
|
||||
'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage
|
||||
'phpdoc_add_missing_param_annotation' => false, // Don't add things that bring no value
|
||||
'phpdoc_align' => false, // Waste of time
|
||||
'phpdoc_annotation_without_dot' => true,
|
||||
'phpdoc_indent' => true,
|
||||
//'phpdoc_inline_tag' => true,
|
||||
'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this
|
||||
'phpdoc_no_access' => true,
|
||||
'phpdoc_no_alias_tag' => true,
|
||||
'phpdoc_no_empty_return' => true,
|
||||
'phpdoc_no_package' => true,
|
||||
'phpdoc_no_useless_inheritdoc' => true,
|
||||
'phpdoc_order' => true,
|
||||
'phpdoc_return_self_reference' => true,
|
||||
'phpdoc_scalar' => true,
|
||||
'phpdoc_separation' => true,
|
||||
'phpdoc_single_line_var_spacing' => true,
|
||||
'phpdoc_summary' => true,
|
||||
'phpdoc_to_comment' => false, // interferes with annotations
|
||||
'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use
|
||||
'phpdoc_to_return_type' => false, // idem
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_types_order' => true,
|
||||
'phpdoc_var_annotation_correct_order' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'pow_to_exponentiation' => true,
|
||||
'protected_to_private' => true,
|
||||
'psr_autoloading' => true,
|
||||
'random_api_migration' => true,
|
||||
'return_assignment' => false, // Sometimes useful for clarity or debug
|
||||
'return_type_declaration' => true,
|
||||
'self_accessor' => true,
|
||||
'self_static_accessor' => true,
|
||||
'semicolon_after_instruction' => false, // Buggy in `samples/index.php`
|
||||
'set_type_to_cast' => true,
|
||||
'short_scalar_cast' => true,
|
||||
'simple_to_complex_string_variable' => false, // Would differ from TypeScript without obvious advantages
|
||||
'simplified_null_return' => false, // Even if technically correct we prefer to be explicit
|
||||
'single_blank_line_at_eof' => true,
|
||||
'single_blank_line_before_namespace' => true,
|
||||
'single_class_element_per_statement' => true,
|
||||
'single_import_per_statement' => true,
|
||||
'single_line_after_imports' => true,
|
||||
'single_line_comment_style' => true,
|
||||
'single_line_throw' => false, // I don't see any reason for having a special case for Exception
|
||||
'single_quote' => true,
|
||||
'single_trait_insert_per_statement' => true,
|
||||
'space_after_semicolon' => true,
|
||||
'standardize_increment' => true,
|
||||
'standardize_not_equals' => true,
|
||||
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
|
||||
'strict_comparison' => false, // No, too dangerous to change that
|
||||
'strict_param' => false, // No, too dangerous to change that
|
||||
'string_line_ending' => true,
|
||||
'switch_case_semicolon_to_colon' => true,
|
||||
'switch_case_space' => true,
|
||||
'ternary_operator_spaces' => true,
|
||||
'ternary_to_null_coalescing' => true,
|
||||
'trailing_comma_in_multiline' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'visibility_required' => ['elements' => ['property', 'method']], // not const
|
||||
'void_return' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
'yoda_style' => false,
|
||||
]);
|
||||
|
||||
return $config;
|
||||
@ -1,3 +1,14 @@
|
||||
build:
|
||||
nodes:
|
||||
analysis:
|
||||
tests:
|
||||
override: [php-scrutinizer-run]
|
||||
environment:
|
||||
php:
|
||||
version: '7.4'
|
||||
pecl_extensions:
|
||||
- zip
|
||||
|
||||
filter:
|
||||
excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*', 'src/PhpWord/Shared/PCLZip/*' ]
|
||||
|
||||
@ -14,8 +25,8 @@ tools:
|
||||
config:
|
||||
ruleset: phpmd.xml.dist
|
||||
external_code_coverage:
|
||||
enabled: true
|
||||
timeout: 900
|
||||
enabled: false
|
||||
timeout: 1200
|
||||
php_cpd: true
|
||||
# php_sim: # Temporarily disabled to allow focus on things other than duplicates
|
||||
# min_mass: 40
|
||||
|
||||
50
.travis.yml
50
.travis.yml
@ -1,50 +0,0 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- hhvm
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
|
||||
env:
|
||||
global:
|
||||
- secure: "Sq+6bVtnPsu0mWX8DWQ+9bGAjxMcGorksUiHc4YIXEJsuDfVmVlH8tTD547IeCjDAx9MxXerZ2Z4HSjxTB70VEnJPvZMHI/EZn4Ny31YLHEthdZbV5Gd1h0TGp8VOzPKGShvGrtGBX6MvMfgpK4zuieVWbSfdKeecm8ZNLMpUd4="
|
||||
|
||||
before_install:
|
||||
## Packages
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y graphviz
|
||||
|
||||
before_script:
|
||||
## Composer
|
||||
- composer self-update
|
||||
- composer install --prefer-source
|
||||
## PHPDocumentor
|
||||
- mkdir -p build/docs
|
||||
- mkdir -p build/coverage
|
||||
|
||||
script:
|
||||
## PHP_CodeSniffer
|
||||
- ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
|
||||
## PHP Copy/Paste Detector
|
||||
- ./vendor/bin/phpcpd src/ tests/ --verbose
|
||||
## PHP Mess Detector
|
||||
- ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
|
||||
## PHPUnit
|
||||
- ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage
|
||||
## PHPLOC
|
||||
- ./vendor/bin/phploc src/
|
||||
## PHPDocumentor
|
||||
- ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/*/*" --template="responsive-twig"
|
||||
|
||||
after_script:
|
||||
## PHPDocumentor
|
||||
- bash .travis_shell_after_success.sh
|
||||
## Scrutinizer
|
||||
- wget https://scrutinizer-ci.com/ocular.phar
|
||||
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
|
||||
@ -1,39 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "--DEBUG--"
|
||||
echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG"
|
||||
echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION"
|
||||
echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST"
|
||||
|
||||
if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/PHPWord" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then
|
||||
|
||||
echo -e "Publishing PHPDoc...\n"
|
||||
|
||||
cp -R build/docs $HOME/docs-latest
|
||||
cp -R build/coverage $HOME/coverage-latest
|
||||
|
||||
cd $HOME
|
||||
git config --global user.email "travis@travis-ci.org"
|
||||
git config --global user.name "travis-ci"
|
||||
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/PHPWord gh-pages > /dev/null
|
||||
|
||||
cd gh-pages
|
||||
echo "--DEBUG : Suppression"
|
||||
git rm -rf ./docs/$TRAVIS_BRANCH
|
||||
|
||||
echo "--DEBUG : Dossier"
|
||||
mkdir -p docs/$TRAVIS_BRANCH
|
||||
mkdir -p coverage/$TRAVIS_BRANCH
|
||||
|
||||
echo "--DEBUG : Copie"
|
||||
cp -Rf $HOME/docs-latest/* ./docs/$TRAVIS_BRANCH/
|
||||
cp -Rf $HOME/coverage-latest/* ./coverage/$TRAVIS_BRANCH/
|
||||
|
||||
echo "--DEBUG : Git"
|
||||
git add -f .
|
||||
git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)"
|
||||
git push -fq origin gh-pages > /dev/null
|
||||
|
||||
echo -e "Published PHPDoc to gh-pages.\n"
|
||||
|
||||
fi
|
||||
434
CHANGELOG.md
434
CHANGELOG.md
@ -1,26 +1,411 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
This is the changelog between releases of PHPWord. Releases are listed in reverse chronological order with the latest version listed on top, while additions/changes in each release are listed in chronological order. Changes in each release are divided into three parts: added or change features, bugfixes, and miscellaneous improvements. Each line contains short information about the change made, the person who made it, and the related issue number(s) in GitHub.
|
||||
## [1.0.0](https://github.com/PHPOffice/PHPWord/tree/1.0.0) (2022-11-15)
|
||||
|
||||
0.12.1 (30 August 2015)
|
||||
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.3...1.0.0)
|
||||
|
||||
### BREAKING CHANGE
|
||||
|
||||
Most deprecated things were dropped. See details in
|
||||
https://github.com/PHPOffice/PHPWord/commit/b9f1151bc6f90c276153c3c9dca10a5fc7f355fb.
|
||||
|
||||
#### Dropped classes:
|
||||
|
||||
- `PhpOffice\PhpWord\Template`
|
||||
|
||||
#### Dropped constants:
|
||||
|
||||
- `PhpOffice\PhpWord\Style\Font::UNDERLINE_DOTHASH`
|
||||
- `PhpOffice\PhpWord\Style\Font::UNDERLINE_DOTHASHHEAVY`
|
||||
- `PhpOffice\PhpWord\Style\Cell::VALIGN_TOP`
|
||||
- `PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER`
|
||||
- `PhpOffice\PhpWord\Style\Cell::VALIGN_BOTTOM`
|
||||
- `PhpOffice\PhpWord\Style\Cell::VALIGN_BOTH`
|
||||
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_DOT`
|
||||
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_UNDERSCORE`
|
||||
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_LINE`
|
||||
- `PhpOffice\PhpWord\Style\TOC::TABLEADER_NONE`
|
||||
- `PhpOffice\PhpWord\Style\Table::WIDTH_AUTO`
|
||||
- `PhpOffice\PhpWord\Style\Table::WIDTH_PERCENT`
|
||||
- `PhpOffice\PhpWord\Style\Table::WIDTH_TWIP`
|
||||
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_NAME`
|
||||
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_SIZE`
|
||||
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_COLOR`
|
||||
- `PhpOffice\PhpWord\PhpWord::DEFAULT_FONT_CONTENT_TYPE`
|
||||
-
|
||||
#### Dropped methods:
|
||||
|
||||
- `PhpOffice\PhpWord\Ekement\AbstractContainer::createTextRun()`
|
||||
- `PhpOffice\PhpWord\Ekement\AbstractContainer::createFootnote()`
|
||||
- `PhpOffice\PhpWord\Ekement\Footnote::getReferenceId()`
|
||||
- `PhpOffice\PhpWord\Ekement\Footnote::setReferenceId()`
|
||||
- `PhpOffice\PhpWord\Ekement\Image::getIsWatermark()`
|
||||
- `PhpOffice\PhpWord\Ekement\Image::getIsMemImage()`
|
||||
- `PhpOffice\PhpWord\Ekement\Link::getTarget()`
|
||||
- `PhpOffice\PhpWord\Ekement\Link::getLinkSrc()`
|
||||
- `PhpOffice\PhpWord\Ekement\Link::getLinkName()`
|
||||
- `PhpOffice\PhpWord\Ekement\OLEObject::getObjectId()`
|
||||
- `PhpOffice\PhpWord\Ekement\OLEObject::setObjectId()`
|
||||
- `PhpOffice\PhpWord\Ekement\Section::getFootnotePropoperties()`
|
||||
- `PhpOffice\PhpWord\Ekement\Section::setSettings()`
|
||||
- `PhpOffice\PhpWord\Ekement\Section::getSettings()`
|
||||
- `PhpOffice\PhpWord\Ekement\Section::createHeader()`
|
||||
- `PhpOffice\PhpWord\Ekement\Section::createFooter()`
|
||||
- `PhpOffice\PhpWord\Ekement\Section::getFooter()`
|
||||
- `PhpOffice\PhpWord\Media::addSectionMediaElement()`
|
||||
- `PhpOffice\PhpWord\Media::addSectionLinkElement()`
|
||||
- `PhpOffice\PhpWord\Media::getSectionMediaElements()`
|
||||
- `PhpOffice\PhpWord\Media::countSectionMediaElements()`
|
||||
- `PhpOffice\PhpWord\Media::addHeaderMediaElement()`
|
||||
- `PhpOffice\PhpWord\Media::countHeaderMediaElements()`
|
||||
- `PhpOffice\PhpWord\Media::getHeaderMediaElements()`
|
||||
- `PhpOffice\PhpWord\Media::addFooterMediaElement()`
|
||||
- `PhpOffice\PhpWord\Media::countFooterMediaElements()`
|
||||
- `PhpOffice\PhpWord\Media::getFooterMediaElements()`
|
||||
- `PhpOffice\PhpWord\PhpWord::getProtection()`
|
||||
- `PhpOffice\PhpWord\PhpWord::loadTemplate()`
|
||||
- `PhpOffice\PhpWord\PhpWord::createSection()`
|
||||
- `PhpOffice\PhpWord\PhpWord::getDocumentProperties()`
|
||||
- `PhpOffice\PhpWord\PhpWord::setDocumentProperties()`
|
||||
- `PhpOffice\PhpWord\Reader\AbstractReader::getReadDataOnly()`
|
||||
- `PhpOffice\PhpWord\Settings::getCompatibility()`
|
||||
- `PhpOffice\PhpWord\Style\AbstractStyle::setArrayStyle()`
|
||||
- `PhpOffice\PhpWord\Style\Cell::getDefaultBorderColor()`
|
||||
- `PhpOffice\PhpWord\Style\Font::getBold()`
|
||||
- `PhpOffice\PhpWord\Style\Font::getItalic()`
|
||||
- `PhpOffice\PhpWord\Style\Font::getSuperScript()`
|
||||
- `PhpOffice\PhpWord\Style\Font::getSubScript()`
|
||||
- `PhpOffice\PhpWord\Style\Font::getStrikethrough()`
|
||||
- `PhpOffice\PhpWord\Style\Font::getParagraphStyle()`
|
||||
- `PhpOffice\PhpWord\Style\Frame::getAlign()`
|
||||
- `PhpOffice\PhpWord\Style\Frame::setAlign()`
|
||||
- `PhpOffice\PhpWord\Style\NumberingLevel::getAlign()`
|
||||
- `PhpOffice\PhpWord\Style\NumberingLevel::setAlign()`
|
||||
- `PhpOffice\PhpWord\Style\Paragraph::getAlign()`
|
||||
- `PhpOffice\PhpWord\Style\Paragraph::setAlign()`
|
||||
- `PhpOffice\PhpWord\Style\Paragraph::getWidowControl()`
|
||||
- `PhpOffice\PhpWord\Style\Paragraph::getKeepNext()`
|
||||
- `PhpOffice\PhpWord\Style\Paragraph::getKeepLines()`
|
||||
- `PhpOffice\PhpWord\Style\Paragraph::getPageBreakBefore()`
|
||||
- `PhpOffice\PhpWord\Style\Row::getTblHeader()`
|
||||
- `PhpOffice\PhpWord\Style\Row::isTblHeader()`
|
||||
- `PhpOffice\PhpWord\Style\Row::getCantSplit()`
|
||||
- `PhpOffice\PhpWord\Style\Row::getExactHeight()`
|
||||
- `PhpOffice\PhpWord\Style\Spacing::getRule()`
|
||||
- `PhpOffice\PhpWord\Style\Spacing::setRule()`
|
||||
- `PhpOffice\PhpWord\Style\Table::getAlign()`
|
||||
- `PhpOffice\PhpWord\Style\Table::setAlign()`
|
||||
- `PhpOffice\PhpWord\Writer\AbstractWriter::getUseDiskCaching()`
|
||||
- `PhpOffice\PhpWord\Writer\HTML::writeDocument()`
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- Multiple PHP 8.1 fixes
|
||||
- `loadConfig` returns config that was actually applied
|
||||
- HTML Reader : Override inline style on HTML attribute for table
|
||||
- HTML Reader : Use `border` attribute for tables
|
||||
- HTML Reader : Style page-break-after in paragraph
|
||||
- HTML Reader : Heading in Text Run is not allowed
|
||||
-
|
||||
### Miscellaneous
|
||||
|
||||
- Drop support for PHP 7.0 and older
|
||||
|
||||
## [0.18.3](https://github.com/PHPOffice/PHPWord/tree/0.18.3) (2022-02-17)
|
||||
|
||||
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.2...0.18.3)
|
||||
|
||||
### Bug fixes
|
||||
- PHP 8.1 compatibility
|
||||
|
||||
## [0.18.2](https://github.com/PHPOffice/PHPWord/tree/0.18.2) (2021-06-04)
|
||||
|
||||
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.1...0.18.2)
|
||||
|
||||
### Bug fixes
|
||||
- when adding image to relationship first check that the generated RID is actually unique [\#2063](https://github.com/PHPOffice/PHPWord/pull/2063) ([tpv-ebben](https://github.com/tpv-ebben))
|
||||
- Update chart, don't write 'c:overlap' if grouping is 'clustered' [\#2052](https://github.com/PHPOffice/PHPWord/pull/2052) ([dfsd534](https://github.com/dfsd534))
|
||||
- Update Html parser to accept line-height:normal [\#2041](https://github.com/PHPOffice/PHPWord/pull/2041) ([joelgo](https://github.com/joelgo))
|
||||
- Fix image border in Word2007 Writer for LibreOffice 7 [\#2021](https://github.com/PHPOffice/PHPWord/pull/2021) ([kamilmmach](https://github.com/kamilmmach))
|
||||
|
||||
### Miscellaneous
|
||||
- Corrected namespace for Language class in docs. [\#2087](https://github.com/PHPOffice/PHPWord/pull/2087) ([MegaChriz](https://github.com/MegaChriz))
|
||||
- Added support for Garamond font [\#2078](https://github.com/PHPOffice/PHPWord/pull/2078) ([artemkolotilkin](https://github.com/artemkolotilkin))
|
||||
- Add BorderStyle for Cell Style to documentation [\#2090](https://github.com/PHPOffice/PHPWord/pull/2090) ([DShkrabak](https://github.com/DShkrabak))
|
||||
|
||||
## [0.18.1](https://github.com/PHPOffice/PHPWord/tree/0.18.1) (2021-03-08)
|
||||
|
||||
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.18.0...0.18.1)
|
||||
|
||||
### Bug fixes
|
||||
- Fix BC break in #1946. This package does not replace laminas/laminas-zendframework-bridge [\#2032](https://github.com/PHPOffice/PHPWord/pull/2032) ([mussbach](https://github.com/mussbach))
|
||||
|
||||
## [0.18.0](https://github.com/PHPOffice/PHPWord/tree/0.18.0) (2021-02-12)
|
||||
|
||||
[Full Changelog](https://github.com/PHPOffice/PHPWord/compare/0.17.0...0.18.0)
|
||||
|
||||
### Enhancements
|
||||
- Add support for charts in template processor [\#2012](https://github.com/PHPOffice/PHPWord/pull/2012) ([dbarzin](https://github.com/dbarzin))
|
||||
- add/setting page element border style. [\#1986](https://github.com/PHPOffice/PHPWord/pull/1986) ([emnabs](https://github.com/emnabs))
|
||||
- allow to use customized pdf library [\#1983](https://github.com/PHPOffice/PHPWord/pull/1983) ([SailorMax](https://github.com/SailorMax))
|
||||
- feat: Update addHtml to handle style inheritance [\#1965](https://github.com/PHPOffice/PHPWord/pull/1965) ([Julien1138](https://github.com/Julien1138))
|
||||
- Add parsing of Shape node values [\#1924](https://github.com/PHPOffice/PHPWord/pull/1924) ([sven-ahrens](https://github.com/sven-ahrens))
|
||||
- Allow to redefine TCPDF object [\#1907](https://github.com/PHPOffice/PHPWord/pull/1907) ([SailorMax](https://github.com/SailorMax))
|
||||
- Enhancements to addHTML parser [\#1902](https://github.com/PHPOffice/PHPWord/pull/1902) ([lubosdz](https://github.com/lubosdz))
|
||||
- Make Default Paper Configurable [\#1851](https://github.com/PHPOffice/PHPWord/pull/1851) ([oleibman](https://github.com/oleibman))
|
||||
- Implement various missing features for the ODT writer [\#1796](https://github.com/PHPOffice/PHPWord/pull/1796) ([oleibman](https://github.com/oleibman))
|
||||
- Added support for "cloudConvert" images [\#1794](https://github.com/PHPOffice/PHPWord/pull/1794) ([ErnestStaug](https://github.com/ErnestStaug))
|
||||
- Add support for several features for the RTF writer [\#1775](https://github.com/PHPOffice/PHPWord/pull/1775) ([oleibman](https://github.com/oleibman))
|
||||
- Add font style for Field elements [\#1774](https://github.com/PHPOffice/PHPWord/pull/1774) ([oleibman](https://github.com/oleibman))
|
||||
- Add support for ListItemRun in HTML writer [\#1766](https://github.com/PHPOffice/PHPWord/pull/1766) ([stefan-91](https://github.com/stefan-91))
|
||||
- Improvements in RTF writer [\#1755](https://github.com/PHPOffice/PHPWord/pull/1755) ([oleibman](https://github.com/oleibman))
|
||||
- Allow a closure to be passed with image replacement tags [\#1716](https://github.com/PHPOffice/PHPWord/pull/1716) ([mbardelmeijer](https://github.com/mbardelmeijer))
|
||||
- Add Option for Dynamic Chart Legend Position [\#1699](https://github.com/PHPOffice/PHPWord/pull/1699) ([Stephan212](https://github.com/Stephan212))
|
||||
- Add parsing of HTML checkbox input field [\#1832](https://github.com/PHPOffice/PHPWord/pull/1832) ([Matze2010](https://github.com/Matze2010))
|
||||
|
||||
### Bug fixes
|
||||
- Fix image stroke in libreoffice 7.x [\#1992](https://github.com/PHPOffice/PHPWord/pull/1992) ([Adizbek](https://github.com/Adizbek))
|
||||
- Fix deprecated warning for non-hexadecimal number [\#1988](https://github.com/PHPOffice/PHPWord/pull/1988) ([Ciki](https://github.com/Ciki))
|
||||
- Fix limit not taken into account when adding image in template [\#1967](https://github.com/PHPOffice/PHPWord/pull/1967) ([jsochor](https://github.com/jsochor))
|
||||
- Add null check when setComplexValue is not found [\#1936](https://github.com/PHPOffice/PHPWord/pull/1936) ([YannikFirre](https://github.com/YannikFirre))
|
||||
- Some document have non-standard locale code [\#1824](https://github.com/PHPOffice/PHPWord/pull/1824) ([ErnestStaug](https://github.com/ErnestStaug))
|
||||
- Fixes PHPDoc @param and @return types for several Converter methods [\#1818](https://github.com/PHPOffice/PHPWord/pull/1818) ([caugner](https://github.com/caugner))
|
||||
- Update the regexp to avoid catastrophic backtracking [\#1809](https://github.com/PHPOffice/PHPWord/pull/1809) ([juzser](https://github.com/juzser))
|
||||
- Fix PHPUnit tests on develop branch [\#1771](https://github.com/PHPOffice/PHPWord/pull/1771) ([mdupont](https://github.com/mdupont))
|
||||
- TemplateProcessor cloneBlock wrongly clones images [\#1763](https://github.com/PHPOffice/PHPWord/pull/1763) ([alarai](https://github.com/alarai))
|
||||
|
||||
### Miscellaneous
|
||||
- Compatibility with PHP 7.4, PHP 8.0 and migrate to Laminas Escaper [\#1946](https://github.com/PHPOffice/PHPWord/pull/1946) ([liborm85](https://github.com/liborm85))
|
||||
- Remove legacy PHPOffice/Common package, fix PHP 8.0 compatibility [\#1996](https://github.com/PHPOffice/PHPWord/pull/1996) ([liborm85](https://github.com/liborm85))
|
||||
- Improve Word2007 Test Coverage [\#1858](https://github.com/PHPOffice/PHPWord/pull/1858) ([oleibman](https://github.com/oleibman))
|
||||
- Fix typo in docs. Update templates-processing.rst [\#1952](https://github.com/PHPOffice/PHPWord/pull/1952) ([mnvx](https://github.com/mnvx))
|
||||
- Fix documentation and method name for FootnoteProperties [\#1776](https://github.com/PHPOffice/PHPWord/pull/1776) ([mdupont](https://github.com/mdupont))
|
||||
- fix: documentation about paragraph indentation [\#1764](https://github.com/PHPOffice/PHPWord/pull/1764) ([mdupont](https://github.com/mdupont))
|
||||
- Update templates-processing.rst [\#1745](https://github.com/PHPOffice/PHPWord/pull/1745) ([igronus](https://github.com/igronus))
|
||||
- Unused variables $rows, $cols in sample [\#1877](https://github.com/PHPOffice/PHPWord/pull/1877) ([ThanasisMpalatsoukas](https://github.com/ThanasisMpalatsoukas))
|
||||
- Add unit test for NumberingStyle [\#1744](https://github.com/PHPOffice/PHPWord/pull/1744) ([Manunchik](https://github.com/Manunchik))
|
||||
- Add unit test for PhpWord Settings [\#1743](https://github.com/PHPOffice/PHPWord/pull/1743) ([Manunchik](https://github.com/Manunchik))
|
||||
- Add unit test for Media elements [\#1742](https://github.com/PHPOffice/PHPWord/pull/1742) ([Manunchik](https://github.com/Manunchik))
|
||||
- Update templates processing docs [\#1729](https://github.com/PHPOffice/PHPWord/pull/1729) ([hcdias](https://github.com/hcdias))
|
||||
|
||||
v0.17.0 (01 oct 2019)
|
||||
----------------------
|
||||
### Added
|
||||
- Add methods setValuesFromArray and cloneRowFromArray to the TemplateProcessor @geraldb-nicat #670
|
||||
- Set complex type in template @troosan #1565
|
||||
- implement support for section vAlign @troosan #1569
|
||||
- ParseStyle for border-color @Gllrm0 #1551
|
||||
- Html writer auto invert text color @SailorMax #1387
|
||||
- Add RightToLeft table presentation. @troosan #1550
|
||||
- Add support for page vertical alignment. @troosan #672 #1569
|
||||
- Adding setNumId method for ListItem style @eweso #1329
|
||||
- Add support for basic fields in RTF writer. @Samuel-BF #1717
|
||||
|
||||
### Fixed
|
||||
- Fix HTML border-color parsing. @troosan #1551 #1570
|
||||
- Language::validateLocale should pass with locale 'zxx'. @efpapado #1558
|
||||
- can't align center vertically with the text @ter987 #672
|
||||
- fix parsing of border-color and add test @troosan #1570
|
||||
- TrackChange doesn't handle all return types of \DateTime::createFromFormat(...) @superhaggis #1584
|
||||
- To support PreserveText inside sub container @bhattnishant #1637
|
||||
- No nested w:pPr elements in ListItemRun. @waltertamboer #1628
|
||||
- Ensure that entity_loader disable variable is re-set back to the original setting @seamuslee001 #1585
|
||||
|
||||
### Miscellaneous
|
||||
- Use embedded http server to test loading of remote images @troosan #1544
|
||||
- Change private to protected to be able extending class Html @SpinyMan #1646
|
||||
- Fix apt-get crash in Travis CI for PHP 5.3 @mdupont #1707
|
||||
|
||||
v0.16.0 (30 dec 2018)
|
||||
----------------------
|
||||
### Added
|
||||
- Add getVariableCount method in TemplateProcessor. @nicoder #1272
|
||||
- Add setting Chart Title and Legend visibility @Tom-Magill #1433
|
||||
- Add ability to pass a Style object in Section constructor @ndench #1416
|
||||
- Add support for hidden text @Alexmg86 #1527
|
||||
- Add support for setting images in TemplateProcessor @SailorMax #1170
|
||||
- Add "Plain Text" type to SDT (Structured Document Tags) @morrisdj #1541
|
||||
- Added possibility to index variables inside cloned block in TemplateProcessor @JPBetley #817
|
||||
- Added possibility to replace variables inside cloned block with values in TemplateProcessor @DIDoS #1392
|
||||
|
||||
### Fixed
|
||||
- Fix regex in `cloneBlock` function @nicoder #1269
|
||||
- HTML Title Writer loses text when Title contains a TextRun instead a string. @begnini #1436
|
||||
- Fix regex in fixBrokenMacros, make it less greedy @MuriloSo @brainwood @yurii-sio2 #1502 #1345
|
||||
- 240 twips are being added to line spacing, should not happen when using lineRule fixed @troosan #1509 #1505
|
||||
- Adding table layout to the generated HTML @aarangara #1441
|
||||
- Fix loading of Sharepoint document @Garrcomm #1498
|
||||
- RTF writer: Round getPageSizeW and getPageSizeH to avoid decimals @Patrick64 #1493
|
||||
- Fix parsing of Office 365 documents @Timanx #1485
|
||||
- For RTF writers, sizes should should never have decimals @Samuel-BF #1536
|
||||
- Style Name Parsing fails if document generated by a non-english word version @begnini #1434
|
||||
|
||||
### Miscellaneous
|
||||
- Get rid of duplicated code in TemplateProcessor @abcdmitry #1161
|
||||
|
||||
v0.15.0 (14 Jul 2018)
|
||||
----------------------
|
||||
### Added
|
||||
- Parsing of `align` HTML attribute - @troosan #1231
|
||||
- Parse formatting inside HTML lists - @troosan @samimussbach #1239 #945 #1215 #508
|
||||
- Parsing of CSS `direction` instruction, HTML `lang` attribute, formatting inside table cell - @troosan #1273 #1252 #1254
|
||||
- Add support for Track changes @Cip @troosan #354 #1262
|
||||
- Add support for fixed Table Layout @aoloe @ekopach @troosan #841 #1276
|
||||
- Add support for Cell Spacing @dox07 @troosan #1040
|
||||
- Add parsing of formatting inside lists @atomicalnet @troosan #594
|
||||
- Added support for Vertically Raised or Lowered Text (w:position) @anrikun @troosan #640
|
||||
- Add support for MACROBUTTON field @phryneas @troosan #1021
|
||||
- Add support for Hyphenation @Trainmaster #1282 (Document: `autoHyphenation`, `consecutiveHyphenLimit`, `hyphenationZone`, `doNotHyphenateCaps`, Paragraph: `suppressAutoHyphens`)
|
||||
- Added support for Floating Table Positioning (tblpPr) @anrikun #639
|
||||
- Added support for Image text wrapping distance @troosan #1310
|
||||
- Added parsing of CSS line-height and text-indent in HTML reader @troosan #1316
|
||||
- Added the ability to enable gridlines and axislabels on charts @FrankMeyer #576
|
||||
- Add support for table indent (tblInd) @Trainmaster #1343
|
||||
- Added parsing of internal links in HTML reader @lalop #1336
|
||||
- Several improvements to charts @JAEK-S #1332
|
||||
- Add parsing of html image in base64 format @jgpATs2w #1382
|
||||
- Added Support for Indentation & Tabs on RTF Writer. @smaug1985 #1405
|
||||
- Allows decimal numbers in HTML line-height style @jgpATs2w #1413
|
||||
|
||||
### Fixed
|
||||
- Fix reading of docx default style - @troosan #1238
|
||||
- Fix the size unit of when parsing html images - @troosan #1254
|
||||
- Fixed HTML parsing of nested lists - @troosan #1265
|
||||
- Save PNG alpha information when using remote images. @samsullivan #779
|
||||
- Fix parsing of `<w:br/>` tag. @troosan #1274
|
||||
- Bookmark are not writton as internal link in html writer @troosan #1263
|
||||
- It should be possible to add a Footnote in a ListItemRun @troosan #1287 #1287
|
||||
- Fix colspan and rowspan for tables in HTML Writer @mattbolt #1292
|
||||
- Fix parsing of Heading and Title formating @troosan @gthomas2 #465
|
||||
- Fix Dateformat typo, fix hours casing, add Month-Day-Year formats @ComputerTinker #591
|
||||
- Support reading of w:drawing for documents produced by word 2011+ @gthomas2 #464 #1324
|
||||
- Fix missing column width in ODText writer @potofcoffee #413
|
||||
- Disable entity loader before parsing XML to avoid XXE injection @Tom4t0 #1427
|
||||
|
||||
### Changed
|
||||
- Remove zend-stdlib dependency @Trainmaster #1284
|
||||
- The default unit for `\PhpOffice\PhpWord\Style\Image` changed from `px` to `pt`.
|
||||
|
||||
### Miscellaneous
|
||||
- Drop GitHub pages, switch to coveralls for code coverage analysis @czosel #1360
|
||||
|
||||
v0.14.0 (29 Dec 2017)
|
||||
----------------------
|
||||
This release fixes several bugs and adds some new features.
|
||||
This version brings compatibility with PHP 7.0 & 7.1
|
||||
|
||||
### Added
|
||||
- Possibility to control the footnote numbering - @troosan #1068
|
||||
- Image creation from string - @troosan #937
|
||||
- Introduced the `\PhpOffice\PhpWord\SimpleType\NumberFormat` simple type. - @troosan
|
||||
- Support for ContextualSpacing - @postHawk #1088
|
||||
- Possiblity to hide spelling and/or grammatical errors - @troosan #542
|
||||
- Possiblity to set default document language as well as changing the language for each text element - @troosan #1108
|
||||
- Support for Comments - @troosan #1067
|
||||
- Support for paragraph textAlignment - @troosan #1165
|
||||
- Add support for HTML underline tag <u> in addHtml - @zNightFalLz #1186
|
||||
- Add support for HTML <br> in addHtml - @anrikun @troosan #659
|
||||
- Allow to change cell width unit - guillaume-ro-fr #986
|
||||
- Allow to change the line height rule @troosan
|
||||
- Implement PageBreak for odt writer @cookiekiller #863 #824
|
||||
- Allow to force an update of all fields on opening a document - @troosan #951
|
||||
- Allow adding a CheckBox in a TextRun - @irond #727
|
||||
- Add support for HTML img tag - @srggroup #934
|
||||
- Add support for password protection for docx - @mariahaubner #1019
|
||||
|
||||
### Fixed
|
||||
- Loosen dependency to Zend
|
||||
- Images are not being printed when generating PDF - @hubertinio #1074 #431
|
||||
- Fixed some PHP 7 warnings - @ likeuntomurphy #927
|
||||
- Fixed PHP 7.2 compatibility (renamed `Object` class names to `ObjectElement`) - @SailorMax #1185
|
||||
- Fixed Word 97 reader - @alsofronie @Benpxpx @mario-rivera #912 #920 #892
|
||||
- Fixed image loading over https - @troosan #988
|
||||
- Impossibility to set different even and odd page headers - @troosan #981
|
||||
- Fixed Word2007 reader where unnecessary paragraphs were being created - @donghaobo #1043 #620
|
||||
- Fixed Word2007 reader where margins were not being read correctly - @slowprog #885 #1008
|
||||
- Impossible to add element PreserveText in Section - @rvanlaak #452
|
||||
- Added missing options for numbering format - @troosan #1041
|
||||
- Fixed impossibility to set a different footer for first page - @ctrlaltca #1116, @aoloe #875
|
||||
- Fixed styles not being applied by HTML writer, better pdf output - @sarke #1047 #500 #1139
|
||||
- Fixed read docx error when document contains image from remote url - @FBnil #1173 #1176
|
||||
- Padded the $args array to remove error - @kaigoh #1150, @reformed #870
|
||||
- Fix incorrect image size between windows and mac - @bskrtich #874
|
||||
- Fix adding HTML table to document - @mogilvie @arivanbastos #324
|
||||
- Fix parsing on/off values (w:val="true|false|1|0|on|off") - @troosan #1221 #1219
|
||||
- Fix error on Empty Dropdown Entry - @ComputerTinker #592
|
||||
|
||||
### Deprecated
|
||||
- PhpWord->getProtection(), get it from the settings instead PhpWord->getSettings()->getDocumentProtection();
|
||||
|
||||
|
||||
|
||||
v0.13.0 (31 July 2016)
|
||||
-------------------
|
||||
This release brings several improvements in `TemplateProcessor`, automatic output escaping feature for OOXML, ODF, HTML, and RTF (turned off, by default).
|
||||
It also introduces constants for horizontal alignment options, and resolves some issues with PHP 7.
|
||||
Manual installation feature has been dropped since the release. Please, use [Composer](https://getcomposer.org/) to install PHPWord.
|
||||
|
||||
Maintenance release. This release is focused primarily on ``TemplateProcessor``.
|
||||
### Added
|
||||
- Introduced the `\PhpOffice\PhpWord\SimpleType\Jc` simple type. - @RomanSyroeshko
|
||||
- Introduced the `\PhpOffice\PhpWord\SimpleType\JcTable` simple type. - @RomanSyroeshko
|
||||
- Introduced writer for the "Paragraph Alignment" element (see `\PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment`). - @RomanSyroeshko
|
||||
- Introduced writer for the "Table Alignment" element (see `\PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment`). - @RomanSyroeshko
|
||||
- Supported indexed arrays in arguments of `TemplateProcessor::setValue()`. - @RomanSyroeshko #618
|
||||
- Introduced automatic output escaping for OOXML, ODF, HTML, and RTF. To turn the feature on use `phpword.ini` or `\PhpOffice\PhpWord\Settings`. - @RomanSyroeshko #483
|
||||
- Supported processing of headers and footers in `TemplateProcessor::applyXslStyleSheet()`. - @RomanSyroeshko #335
|
||||
|
||||
### Changed
|
||||
- Improved error message for the case when `autoload.php` is not found. - @RomanSyroeshko #371
|
||||
- Renamed the `align` option of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles into `alignment`. - @RomanSyroeshko
|
||||
- Improved performance of `TemplateProcessor::setValue()`. - @kazitanvirahsan #614, #617
|
||||
- Fixed some HTML tags not rendering any output (p, header & table) - #257, #324 - @twmobius and @garethellis
|
||||
|
||||
### Deprecated
|
||||
- `getAlign` and `setAlign` methods of `NumberingLevel`, `Frame`, `Table`, and `Paragraph` styles.
|
||||
Use the correspondent `getAlignment` and `setAlignment` methods instead. - @RomanSyroeshko
|
||||
- `left`, `right`, and `justify` alignment options for paragraphs (now are mapped to `Jc::START`, `Jc::END`, and `Jc::BOTH`). - @RomanSyroeshko
|
||||
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko
|
||||
- `TCPDF` due to its limited HTML support. Use `DomPDF` or `MPDF` writer instead. - @RomanSyroeshko #399
|
||||
|
||||
### Removed
|
||||
- `\PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
|
||||
In each case set of available string values is defined by the correspondent simple type. - @RomanSyroeshko
|
||||
- Manual installation support. Since the release we have dependencies on third party libraries,
|
||||
so installation via ZIP-archive download is not an option anymore. To install PHPWord use [Composer](https://getcomposer.org/).
|
||||
We also removed `\PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
|
||||
Autoloaders provided by Composer are in use now (see `bootstrap.php`). - @RomanSyroeshko
|
||||
- `\PhpOffice\PhpWord\Shared\Drawing` replaced by `\PhpOffice\Common\Drawing`. - @Progi1984 #658
|
||||
- `\PhpOffice\PhpWord\Shared\Font`. - @Progi1984 #658
|
||||
- `\PhpOffice\PhpWord\Shared\String` replaced by `\PhpOffice\Common\Text`. - @Progi1984 @RomanSyroeshko #658
|
||||
- `\PhpOffice\PhpWord\Shared\XMLReader` replaced by `\PhpOffice\Common\XMLReader`. - @Progi1984 #658
|
||||
- `\PhpOffice\PhpWord\Shared\XMLWriter` replaced by `\PhpOffice\Common\XMLWriter`. - @Progi1984 @RomanSyroeshko #658
|
||||
- `AbstractContainer::addMemoryImage()`. Use `AbstractContainer::addImage()` instead.
|
||||
|
||||
### Fixed
|
||||
- `Undefined property` error while reading MS-DOC documents. - @jaberu #610
|
||||
- Corrupted OOXML template issue in case when its names is broken immediately after `$` sign.
|
||||
That case wasn't taken into account in implementation of `TemplateProcessor::fixBrokenMacros()`. - @RomanSyroeshko @d-damien #548
|
||||
|
||||
|
||||
|
||||
v0.12.1 (30 August 2015)
|
||||
-----------------------
|
||||
Maintenance release. This release is focused primarily on `TemplateProcessor`.
|
||||
|
||||
### Changes
|
||||
- Changed visibility of all private properties and methods of ``TemplateProcessor`` to ``protected``. - @RomanSyroeshko #498
|
||||
- Improved performance of ``TemplateProcessor::setValue()``. - @RomanSyroeshko @nicoSWD #513
|
||||
- Changed visibility of all private properties and methods of `TemplateProcessor` to `protected`. - @RomanSyroeshko #498
|
||||
- Improved performance of `TemplateProcessor::setValue()`. - @RomanSyroeshko @nicoSWD #513
|
||||
|
||||
### Bugfixes
|
||||
- Fixed issue with "Access denied" message while opening ``Sample_07_TemplateCloneRow.docx`` and ``Sample_23_TemplateBlock.docx`` result files on Windows platform. - @RomanSyroeshko @AshSat #532
|
||||
- Fixed ``PreserveText`` element alignment in footer (see ``Sample_12_HeaderFooter.php``). - @RomanSyroeshko @SSchwaiger #495
|
||||
- Fixed issue with "Access denied" message while opening `Sample_07_TemplateCloneRow.docx` and `Sample_23_TemplateBlock.docx` result files on Windows platform. - @RomanSyroeshko @AshSat #532
|
||||
- Fixed `PreserveText` element alignment in footer (see `Sample_12_HeaderFooter.php`). - @RomanSyroeshko @SSchwaiger #495
|
||||
|
||||
|
||||
|
||||
0.12.0 (3 January 2015)
|
||||
v0.12.0 (3 January 2015)
|
||||
-----------------------
|
||||
|
||||
This release added form fields (textinput, checkbox, and dropdown), drawing shapes (arc, curve, line, polyline, rect, oval), and basic 2D chart (pie, doughnut, bar, line, area, scatter, radar) elements along with some new styles. Basic MsDoc reader is introduced.
|
||||
|
||||
### Features
|
||||
@ -78,18 +463,16 @@ This release added form fields (textinput, checkbox, and dropdown), drawing shap
|
||||
|
||||
|
||||
|
||||
0.11.1 (2 June 2014)
|
||||
v0.11.1 (2 June 2014)
|
||||
--------------------
|
||||
|
||||
This is an immediate bugfix release for HTML reader.
|
||||
|
||||
- HTML Reader: `<p>` and header tags puts no output - @canyildiz @ivanlanin #257
|
||||
|
||||
|
||||
|
||||
0.11.0 (1 June 2014)
|
||||
v0.11.0 (1 June 2014)
|
||||
--------------------
|
||||
|
||||
This release marked the change of PHPWord license from LGPL 2.1 to LGPL 3. Four new elements were added: TextBox, ListItemRun, Field, and Line. Relative and absolute positioning for images and textboxes were added. Writer classes were refactored into parts, elements, and styles. ODT and RTF features were enhanced. Ability to add elements to PHPWord object via HTML were implemented. RTF and HTML reader were initiated.
|
||||
|
||||
### Features
|
||||
@ -152,18 +535,16 @@ This release marked the change of PHPWord license from LGPL 2.1 to LGPL 3. Four
|
||||
|
||||
|
||||
|
||||
0.10.1 (21 May 2014)
|
||||
v0.10.1 (21 May 2014)
|
||||
--------------------
|
||||
|
||||
This is a bugfix release for `php-zip` requirement in Composer.
|
||||
|
||||
- Change Composer requirements for php-zip from `require` to `suggest` - @bskrtich #246
|
||||
|
||||
|
||||
|
||||
0.10.0 (4 May 2014)
|
||||
v0.10.0 (4 May 2014)
|
||||
-------------------
|
||||
|
||||
This release marked heavy refactorings on internal code structure with the creation of some abstract classes to reduce code duplication. `Element` subnamespace is introduced in this release to replace `Section`. Word2007 reader capability is greatly enhanced. Endnote is introduced. List numbering is now customizable. Basic HTML and PDF writing support is enabled. Basic ODText reader is introduced.
|
||||
|
||||
### Features
|
||||
@ -246,18 +627,16 @@ This release marked heavy refactorings on internal code structure with the creat
|
||||
|
||||
|
||||
|
||||
0.9.1 (27 Mar 2014)
|
||||
v0.9.1 (27 Mar 2014)
|
||||
-------------------
|
||||
|
||||
This is a bugfix release for PSR-4 compatibility.
|
||||
|
||||
- Fixed PSR-4 composer autoloader - @AntonTyutin
|
||||
|
||||
|
||||
|
||||
0.9.0 (26 Mar 2014)
|
||||
v0.9.0 (26 Mar 2014)
|
||||
-------------------
|
||||
|
||||
This release marked the transformation to namespaces (PHP 5.3+).
|
||||
|
||||
### Features
|
||||
@ -278,18 +657,16 @@ This release marked the transformation to namespaces (PHP 5.3+).
|
||||
|
||||
|
||||
|
||||
0.8.1 (17 Mar 2014)
|
||||
v0.8.1 (17 Mar 2014)
|
||||
-------------------
|
||||
|
||||
This is a bugfix release for image detection functionality.
|
||||
|
||||
- Added fallback for computers that do not have exif_imagetype - @bskrtich, @gabrielbull
|
||||
|
||||
|
||||
|
||||
0.8.0 (15 Mar 2014)
|
||||
v0.8.0 (15 Mar 2014)
|
||||
-------------------
|
||||
|
||||
This release merged a lot of improvements from the community. Unit tests introduced in this release and has reached 90% code coverage.
|
||||
|
||||
### Features
|
||||
@ -336,9 +713,8 @@ This release merged a lot of improvements from the community. Unit tests introdu
|
||||
|
||||
|
||||
|
||||
0.7.0 (28 Jan 2014)
|
||||
v0.7.0 (28 Jan 2014)
|
||||
-------------------
|
||||
|
||||
This is the first release after a long development hiatus in [CodePlex](https://phpword.codeplex.com/). This release initialized ODT and RTF Writer, along with some other new features for the existing Word2007 Writer, e.g. tab, multiple header, rowspan and colspan. [Composer](https://packagist.org/packages/phpoffice/phpword) and [Travis](https://travis-ci.org/PHPOffice/PHPWord) were added.
|
||||
|
||||
### Features
|
||||
|
||||
@ -1,13 +1,30 @@
|
||||
# Contributing to PHPWord
|
||||
|
||||
PHPWord is built by the crowd and for the crowd. Every contribution is welcome; either by [submitting](https://github.com/PHPOffice/PHPWord/issues) bug issues or suggesting improvements, or in a more active form like [requesting](https://github.com/PHPOffice/PHPWord/pulls) a pull.
|
||||
PHPWord is built by the crowd and for the crowd. Every contribution is welcome; either by [reporting a bug](https://github.com/PHPOffice/PHPWord/issues/new?labels=Bug+Report&template=bug_report.md) or [suggesting improvements](https://github.com/PHPOffice/PHPWord/issues/new?labels=Change+Request&template=feature_request.md), or in a more active form like [requesting a pull](https://github.com/PHPOffice/PHPWord/pulls).
|
||||
|
||||
We want to create a high quality document writer and reader library that people can use with more confidence and less bugs. We want to collaborate happily, code joyfully, and get alive merrily. Thus, below are some guidelines, that we expect to be followed by each contributor.
|
||||
We want to create a high quality document writer and reader library that people can use with more confidence and fewer bugs. We want to collaborate happily, code joyfully, and live merrily. Thus, below are some guidelines that we expect to be followed by each contributor:
|
||||
|
||||
- **Be brief, but be bold**. State your issues briefly. But speak out your ideas loudly, even if you can't or don't know how to implement it right away. The world will be better with limitless innovations.
|
||||
- **Follow PHP-FIG standards**. We follow PHP Standards Recommendations (PSRs) by [PHP Framework Interoperability Group](http://www.php-fig.org/). If you're not familiar with these standards, please, [familiarize yourself now](https://github.com/php-fig/fig-standards). Also, please, use [PHPCodeSniffer](http://pear.php.net/package/PHP_CodeSniffer/) to validate your code against PSRs.
|
||||
- **Test your code**. Nobody else knows your code better than you. So, it's completely yours mission to test the changes you made before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and recommend you using this tool too. [Here](https://phpunit.de/presentations.html) you can find PHPUnit best practices and additional information on effective unit testing, which helps us making PHPWord better day to day. Do not hesitate to smoke it carefully. It's a great investment in quality of your work, and it saves you years of life.
|
||||
- **Request pull in separate branch**. Do not submit your request to the master branch. But create a separate branch named specifically for the issue that you addressed. Read [GitHub manual](https://help.github.com/articles/using-pull-requests) to find out more about this. If you are new to GitHub, read [this short manual](https://help.github.com/articles/fork-a-repo) to get yourself familiar with forks and how git works in general. [This video](http://www.youtube.com/watch?v=-zvHQXnBO6c) explains how to synchronize your Github Fork with the Branch of PHPWord.
|
||||
- **Be brief, but be bold**. State your issues briefly. But speak out your ideas loudly, even if you can't or don't know how to implement them right away. The world will be better with limitless innovations.
|
||||
- **Follow PHP-FIG standards**. We follow PHP Standards Recommendations (PSRs) by [PHP Framework Interoperability Group](http://www.php-fig.org/). If you're not familiar with these standards, [familiarize yourself now](https://github.com/php-fig/fig-standards). Also, please run `composer fix` to automatically fix your code to match these recommendations.
|
||||
- **Test your code**. No one knows your code better than you, so we depend on you to test the changes you make before pull request submission. We use [PHPUnit](https://phpunit.de/) for our testing purposes and request that you use this tool too. Tests can be ran with `composer test`. [Documentation for writing tests with PHPUnit is available on Read the Docs.](https://phpunit.readthedocs.io)
|
||||
- **Use best practices when submitting pull requests**. Create a separate branch named specifically for the issue that you are addressing. Read the [GitHub manual](https://help.github.com/articles/about-pull-requests) to learn more about pull requests and GitHub. If you are new to GitHub, read [this short manual](https://help.github.com/articles/fork-a-repo) to get yourself familiar with forks and how git works in general. [This video](http://www.youtube.com/watch?v=-zvHQXnBO6c) explains how to synchronize your fork on GitHub with the upstream branch from PHPWord.
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. [Clone](https://help.github.com/en/articles/cloning-a-repository) [PHPWord](https://github.com/PHPOffice/PHPWord/)
|
||||
2. [Install Composer](https://getcomposer.org/download/) if you don't already have it
|
||||
3. Open your terminal and:
|
||||
1. Switch to the directory PHPWord was cloned to (e.g., `cd ~/Projects/PHPWord/`)
|
||||
2. Run `composer install` to install the dependencies
|
||||
|
||||
You're ready to start working on PHPWord! Tests belong in the `/tests/PhpWord/` directory, the source code is in `/src/PhpWord/`, and any documentation should go in `/docs/`. Familiarize yourself with the codebase and try your hand at fixing [one of our outstanding issues](https://github.com/PHPOffice/PHPWord/issues). Before you get started, check the [existing pull requests](https://github.com/PHPOffice/PHPWord/pulls) to make sure no one else is already working on it.
|
||||
|
||||
Once you have an issue you want to start working on, you'll need to write tests for it, and then you can start implementing the changes necessary to pass the new tests. To run the tests, you can run one of the following commands in your terminal:
|
||||
|
||||
- `composer test-no-coverage` to run all of the tests
|
||||
- `composer test` to run all of the tests and generate test coverage reports
|
||||
|
||||
When you're ready to submit your new (and fully tested) feature, ensure `composer check` passes and [submit a pull request to PHPWord](https://github.com/PHPOffice/PHPWord/issues/new).
|
||||
|
||||
That's it. Thank you for your interest in PHPWord, and welcome!
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
PHPWord, a pure PHP library for reading and writing word processing documents.
|
||||
|
||||
Copyright (c) 2010-2014 PHPWord.
|
||||
Copyright (c) 2010-2016 PHPWord.
|
||||
|
||||
PHPWord is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License version 3 as published by
|
||||
|
||||
87
README.md
87
README.md
@ -1,15 +1,18 @@
|
||||
# 
|
||||
|
||||
[](https://packagist.org/packages/phpoffice/phpword)
|
||||
[](https://travis-ci.org/PHPOffice/PHPWord)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
||||
[](https://github.com/PHPOffice/PHPWord/actions/workflows/ci.yml)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
||||
[](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)
|
||||
[](https://packagist.org/packages/phpoffice/phpword)
|
||||
[](https://packagist.org/packages/phpoffice/phpword)
|
||||
[](https://gitter.im/PHPOffice/PHPWord)
|
||||
|
||||
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](https://github.com/PHPOffice/PHPWord/blob/develop/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/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/develop/).
|
||||
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://github.com/PHPOffice/PHPWord/actions) and unit testing. 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:
|
||||
|
||||
@ -19,11 +22,10 @@ Read more about PHPWord:
|
||||
- [Getting started](#getting-started)
|
||||
- [Contributing](#contributing)
|
||||
- [Developers' Documentation](http://phpword.readthedocs.org/)
|
||||
- [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/)
|
||||
|
||||
## Features
|
||||
|
||||
With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your PHP 5.3+ scripts. Below are some of the things that you can do with PHPWord library:
|
||||
With 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:
|
||||
|
||||
- Set document properties, e.g. title, subject, and creator.
|
||||
- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
|
||||
@ -44,40 +46,34 @@ With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your
|
||||
- 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 main document part of OOXML template
|
||||
- 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+
|
||||
- [Zip extension](http://php.net/manual/en/book.zip.php)
|
||||
- PHP 7.1+
|
||||
- [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 DOCX and ODT)
|
||||
- [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](https://github.com/dompdf/dompdf) (optional, used to write PDF)
|
||||
- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)
|
||||
|
||||
## Installation
|
||||
|
||||
It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add
|
||||
the following lines to your ``composer.json``.
|
||||
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
|
||||
|
||||
```json
|
||||
{
|
||||
"require": {
|
||||
"phpoffice/phpword": "dev-master"
|
||||
}
|
||||
}
|
||||
Run the following to use the latest stable version
|
||||
```sh
|
||||
composer require phpoffice/phpword
|
||||
```
|
||||
|
||||
Alternatively, you can download the latest release from the [releases page](https://github.com/PHPOffice/PHPWord/releases).
|
||||
In this case, you will have to register the autoloader.
|
||||
|
||||
```php
|
||||
require_once 'path/to/PhpWord/src/PhpWord/Autoloader.php';
|
||||
\PhpOffice\PhpWord\Autoloader::register();
|
||||
or if you want the latest unreleased version
|
||||
```sh
|
||||
composer require phpoffice/phpword:dev-master
|
||||
```
|
||||
|
||||
## Getting started
|
||||
@ -86,8 +82,7 @@ The following is a basic usage example of the PHPWord library.
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once 'src/PhpWord/Autoloader.php';
|
||||
\PhpOffice\PhpWord\Autoloader::register();
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
// Creating the new document...
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
@ -98,11 +93,9 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
// Adding Text element to the Section having font styled by default...
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'"Learn from yesterday, live for today, hope for tomorrow. '
|
||||
. 'The important thing is not to stop questioning." '
|
||||
. '(Albert Einstein)'
|
||||
)
|
||||
'"Learn from yesterday, live for today, hope for tomorrow. '
|
||||
. 'The important thing is not to stop questioning." '
|
||||
. '(Albert Einstein)'
|
||||
);
|
||||
|
||||
/*
|
||||
@ -114,11 +107,9 @@ $section->addText(
|
||||
|
||||
// Adding Text element with font customized inline...
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'"Great achievement is usually born of great sacrifice, '
|
||||
. 'and is never the result of selfishness." '
|
||||
. '(Napoleon Hill)'
|
||||
),
|
||||
'"Great achievement is usually born of great sacrifice, '
|
||||
. 'and is never the result of selfishness." '
|
||||
. '(Napoleon Hill)',
|
||||
array('name' => 'Tahoma', 'size' => 10)
|
||||
);
|
||||
|
||||
@ -129,11 +120,9 @@ $phpWord->addFontStyle(
|
||||
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
|
||||
);
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'"The greatest accomplishment is not in never falling, '
|
||||
. 'but in rising again after you fall." '
|
||||
. '(Vince Lombardi)'
|
||||
),
|
||||
'"The greatest accomplishment is not in never falling, '
|
||||
. 'but in rising again after you fall." '
|
||||
. '(Vince Lombardi)',
|
||||
$fontStyleName
|
||||
);
|
||||
|
||||
@ -142,9 +131,7 @@ $fontStyle = new \PhpOffice\PhpWord\Style\Font();
|
||||
$fontStyle->setBold(true);
|
||||
$fontStyle->setName('Tahoma');
|
||||
$fontStyle->setSize(13);
|
||||
$myTextElement = $section->addText(
|
||||
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
|
||||
);
|
||||
$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');
|
||||
$myTextElement->setFontStyle($fontStyle);
|
||||
|
||||
// Saving the document as OOXML file...
|
||||
@ -162,15 +149,15 @@ $objWriter->save('helloWorld.html');
|
||||
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
|
||||
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
|
||||
```
|
||||
:warning: Escape any string you pass to OOXML/ODF/HTML document, otherwise it may get broken.
|
||||
|
||||
More examples are provided in the [samples folder](samples/). You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/) for more detail.
|
||||
More examples are provided in the [samples folder](samples/). For an easy access to those samples launch `php -S localhost:8000` in the samples directory then browse to [http://localhost:8000](http://localhost:8000) to view the samples.
|
||||
You can also read the [Developers' Documentation](http://phpword.readthedocs.org/) for more detail.
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome everyone to contribute to PHPWord. Below are some of the things that you can do to contribute.
|
||||
|
||||
- Read [our contributing guide](https://github.com/PHPOffice/PHPWord/blob/master/CONTRIBUTING.md).
|
||||
- [Fork us](https://github.com/PHPOffice/PHPWord/fork) and [request a pull](https://github.com/PHPOffice/PHPWord/pulls) to the [develop](https://github.com/PHPOffice/PHPWord/tree/develop) branch.
|
||||
- Read [our contributing guide](CONTRIBUTING.md).
|
||||
- [Fork us](https://github.com/PHPOffice/PHPWord/fork) and [request a pull](https://github.com/PHPOffice/PHPWord/pulls) to the [master](https://github.com/PHPOffice/PHPWord/tree/master) branch.
|
||||
- Submit [bug reports or feature requests](https://github.com/PHPOffice/PHPWord/issues) to GitHub.
|
||||
- Follow [@PHPWord](https://twitter.com/PHPWord) and [@PHPOffice](https://twitter.com/PHPOffice) on Twitter.
|
||||
|
||||
28
bootstrap.php
Normal file
28
bootstrap.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors. test bootstrap
|
||||
*
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2018 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
$vendorDirPath = realpath(__DIR__ . '/vendor');
|
||||
if (file_exists($vendorDirPath . '/autoload.php')) {
|
||||
require $vendorDirPath . '/autoload.php';
|
||||
} else {
|
||||
throw new Exception(
|
||||
sprintf(
|
||||
'Could not find file \'%s\'. It is generated by Composer. Use \'install --prefer-source\' or \'update --prefer-source\' Composer commands to move forward.',
|
||||
$vendorDirPath . '/autoload.php'
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "phpoffice/phpword",
|
||||
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (DOCX, ODT, RTF, HTML, PDF)",
|
||||
"description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)",
|
||||
"keywords": [
|
||||
"PHP", "PhpOffice", "office", "PhpWord", "word", "template", "template processor", "reader", "writer",
|
||||
"PHP", "PHPOffice", "office", "PHPWord", "word", "template", "template processor", "reader", "writer",
|
||||
"docx", "OOXML", "OpenXML", "Office Open XML", "ISO IEC 29500", "WordprocessingML",
|
||||
"RTF", "Rich Text Format", "doc", "odt", "OpenDocument", "PDF", "HTML"
|
||||
"RTF", "Rich Text Format", "doc", "odt", "ODF", "OpenDocument", "PDF", "HTML"
|
||||
],
|
||||
"homepage": "http://phpoffice.github.io",
|
||||
"homepage": "https://phpword.readthedocs.io/",
|
||||
"type": "library",
|
||||
"license": "LGPL-3.0",
|
||||
"authors": [
|
||||
@ -20,7 +20,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Franck Lefevre",
|
||||
"homepage": "http://blog.rootslabs.net"
|
||||
"homepage": "https://rootslabs.net/blog/"
|
||||
},
|
||||
{
|
||||
"name": "Ivan Lanin",
|
||||
@ -29,33 +29,68 @@
|
||||
{
|
||||
"name": "Roman Syroeshko",
|
||||
"homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/"
|
||||
},
|
||||
{
|
||||
"name": "Antoine de Troostembergh"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": [
|
||||
"phpunit --color=always"
|
||||
],
|
||||
"test-no-coverage": [
|
||||
"phpunit --color=always --no-coverage"
|
||||
],
|
||||
"check": [
|
||||
"php-cs-fixer fix --ansi --dry-run --diff",
|
||||
"phpcs --report-width=200 --report-summary --report-full samples/ src/ tests/ --ignore=src/PhpWord/Shared/PCLZip --standard=PSR2 -n",
|
||||
"phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php",
|
||||
"@test-no-coverage"
|
||||
],
|
||||
"fix": [
|
||||
"php-cs-fixer fix --ansi"
|
||||
]
|
||||
},
|
||||
"scripts-descriptions": {
|
||||
"test": "Runs all unit tests",
|
||||
"test-no-coverage": "Runs all unit tests, without code coverage",
|
||||
"check": "Runs PHP CheckStyle and PHP Mess detector",
|
||||
"fix": "Fixes issues found by PHP-CS"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"ext-xml": "*"
|
||||
"php": "^7.1|^8.0",
|
||||
"ext-dom": "*",
|
||||
"ext-json": "*",
|
||||
"ext-xml": "*",
|
||||
"laminas/laminas-escaper": ">=2.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
"phpdocumentor/phpdocumentor":"2.*",
|
||||
"squizlabs/php_codesniffer": "1.*",
|
||||
"phpmd/phpmd": "2.*",
|
||||
"sebastian/phpcpd": "2.*",
|
||||
"phploc/phploc": "2.*",
|
||||
"dompdf/dompdf":"0.6.*",
|
||||
"tecnick.com/tcpdf": "6.*",
|
||||
"mpdf/mpdf": "5.*"
|
||||
"ext-zip": "*",
|
||||
"ext-gd": "*",
|
||||
"ext-libxml": "*",
|
||||
"dompdf/dompdf": "^2.0",
|
||||
"mpdf/mpdf": "^8.1",
|
||||
"phpmd/phpmd": "^2.13",
|
||||
"phpunit/phpunit": ">=7.0",
|
||||
"tecnickcom/tcpdf": "^6.5",
|
||||
"symfony/process": "^4.4",
|
||||
"friendsofphp/php-cs-fixer": "^3.3"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zip": "Used to write DOCX and ODT",
|
||||
"ext-gd2": "Used to add images",
|
||||
"ext-xmlwriter": "Used to write DOCX and ODT",
|
||||
"ext-xsl": "Used to apply XSL style sheet to main document part of OOXML template",
|
||||
"dompdf/dompdf": "Used to write PDF"
|
||||
"ext-zip": "Allows writing OOXML and ODF",
|
||||
"ext-gd2": "Allows adding images",
|
||||
"ext-xmlwriter": "Allows writing OOXML and ODF",
|
||||
"ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template",
|
||||
"dompdf/dompdf": "Allows writing PDF"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpOffice\\PhpWord\\": "src/PhpWord"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"PhpOffice\\PhpWordTests\\": "tests/PhpWordTests"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,17 +77,17 @@ qthelp:
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PhpWord.qhcp"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PHPWord.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PhpWord.qhc"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PHPWord.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/PhpWord"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PhpWord"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/PHPWord"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PHPWord"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
|
||||
28
docs/conf.py
28
docs/conf.py
@ -40,15 +40,15 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'PhpWord'
|
||||
copyright = u'2014, PHPWord Contributors'
|
||||
project = u'PHPWord'
|
||||
copyright = u'2014-2021, PHPWord Contributors'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.12.0'
|
||||
version = '0.18.2'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = version
|
||||
|
||||
@ -120,7 +120,7 @@ html_theme = 'default'
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
#html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
@ -164,7 +164,7 @@ html_static_path = ['_static']
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'PhpWorddoc'
|
||||
htmlhelp_basename = 'PHPWorddoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output --------------------------------------------------
|
||||
@ -183,8 +183,8 @@ latex_elements = {
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'PhpWord.tex', u'PhpWord Documentation',
|
||||
u'The PhpWord Team', 'manual'),
|
||||
('index', 'PHPWord.tex', u'PHPWord Documentation',
|
||||
u'The PHPWord Team', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
@ -213,8 +213,8 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'PhpWord', u'PhpWord Documentation',
|
||||
[u'The PhpWord Team'], 1)
|
||||
('index', 'PHPWord', u'PHPWord Documentation',
|
||||
[u'The PHPWord Team'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
@ -227,8 +227,8 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'PhpWord', u'PhpWord Documentation',
|
||||
u'The PhpWord Team', 'PhpWord', 'One line description of project.',
|
||||
('index', 'PHPWord', u'PHPWord Documentation',
|
||||
u'The PHPWord Team', 'PHPWord', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
@ -244,9 +244,9 @@ texinfo_documents = [
|
||||
# -- Options for Epub output ---------------------------------------------------
|
||||
|
||||
# Bibliographic Dublin Core info.
|
||||
epub_title = u'PhpWord'
|
||||
epub_author = u'The PhpWord Team'
|
||||
epub_publisher = u'The PhpWord Team'
|
||||
epub_title = u'PHPWord'
|
||||
epub_author = u'The PHPWord Team'
|
||||
epub_publisher = u'The PHPWord Team'
|
||||
epub_copyright = copyright
|
||||
|
||||
# The language of the text. It defaults to the language option
|
||||
|
||||
@ -79,7 +79,7 @@ Below are the properties of the line numbering style.
|
||||
|
||||
- ``start`` Line numbering starting value
|
||||
- ``increment`` Line number increments
|
||||
- ``distance`` Distance between text and line numbering in twip
|
||||
- ``distance`` Distance between text and line numbering in *twip*
|
||||
- ``restart`` Line numbering restart setting
|
||||
continuous\|newPage\|newSection
|
||||
|
||||
@ -98,6 +98,18 @@ that are available for the footer. See "Footer" section for detail.
|
||||
Additionally, only inside of the header reference you can add watermarks
|
||||
or background pictures. See "Watermarks" section.
|
||||
|
||||
You can pass an optional parameter to specify where the header/footer should be applied, it can be
|
||||
|
||||
- ``Footer::AUTO`` default, all pages except if overridden by first or even
|
||||
- ``Footer::FIRST`` each first page of the section
|
||||
- ``Footer::EVEN`` each even page of the section. Will only be applied if the evenAndOddHeaders is set to true in phpWord->settings
|
||||
|
||||
To change the evenAndOddHeaders use the ``getSettings`` method to return the Settings object, and then call the ``setEvenAndOddHeaders`` method:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setEvenAndOddHeaders(true);
|
||||
|
||||
Footers
|
||||
-------
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ column shows the containers while the rows lists the elements.
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 11 | Watermark | - | v | - | - | - | - |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 12 | Object | v | v | v | v | v | v |
|
||||
| 12 | OLEObject | v | v | v | v | v | v |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 13 | TOC | v | - | - | - | - | - |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
@ -39,7 +39,7 @@ column shows the containers while the rows lists the elements.
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 15 | Endnote | v | - | - | v\*\* | v\*\* | - |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 16 | CheckBox | v | v | v | v | - | - |
|
||||
| 16 | CheckBox | v | v | v | v | v | - |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 17 | TextBox | v | v | v | v | - | - |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
@ -47,118 +47,61 @@ column shows the containers while the rows lists the elements.
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 19 | Line | v | v | v | v | v | v |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
| 20 | Chart | v | | | v | | |
|
||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||
|
||||
Legend:
|
||||
|
||||
- ``v`` Available
|
||||
- ``v*`` Available only when inside header/footer
|
||||
- ``v**`` Available only when inside section
|
||||
- ``-`` Not available
|
||||
- ``?`` Should be available
|
||||
- ``v``. Available.
|
||||
- ``v*``. Available only when inside header/footer.
|
||||
- ``v**``. Available only when inside section.
|
||||
- ``-``. Not available.
|
||||
- ``?``. Should be available.
|
||||
|
||||
Texts
|
||||
-----
|
||||
|
||||
Text can be added by using ``addText`` and ``addTextRun`` method.
|
||||
``addText`` is used for creating simple paragraphs that only contain
|
||||
texts with the same style. ``addTextRun`` is used for creating complex
|
||||
paragraphs that contain text with different style (some bold, other
|
||||
italics, etc) or other elements, e.g. images or links. The syntaxes are
|
||||
as follow:
|
||||
Text can be added by using ``addText`` and ``addTextRun`` methods.
|
||||
``addText`` is used for creating simple paragraphs that only contain texts with the same style.
|
||||
``addTextRun`` is used for creating complex paragraphs that contain text with different style (some bold, other
|
||||
italics, etc) or other elements, e.g. images or links. The syntaxes are as follow:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addText($text, [$fontStyle], [$paragraphStyle]);
|
||||
$textrun = $section->addTextRun([$paragraphStyle]);
|
||||
|
||||
Text styles
|
||||
~~~~~~~~~~~
|
||||
- ``$text``. Text to be displayed in the document.
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||
|
||||
You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to
|
||||
define text formatting. There are 2 options to style the inserted text
|
||||
elements, i.e. inline style by using array or defined style by adding
|
||||
style definition.
|
||||
For available styling options see :ref:`font-style` and :ref:`paragraph-style`.
|
||||
|
||||
Inline style examples:
|
||||
If you want to enable track changes on added text you can mark it as INSERTED or DELETED by a specific user at a given time:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$fontStyle = array('name' => 'Times New Roman', 'size' => 9);
|
||||
$paragraphStyle = array('align' => 'both');
|
||||
$section->addText('I am simple paragraph', $fontStyle, $paragraphStyle);
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('I am bold', array('bold' => true));
|
||||
$textrun->addText('I am italic', array('italic' => true));
|
||||
$textrun->addText('I am colored', array('color' => 'AACC00'));
|
||||
|
||||
Defined style examples:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$fontStyle = array('color' => '006699', 'size' => 18, 'bold' => true);
|
||||
$phpWord->addFontStyle('fStyle', $fontStyle);
|
||||
$text = $section->addText('Hello world!', 'fStyle');
|
||||
|
||||
$paragraphStyle = array('align' => 'center');
|
||||
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
|
||||
$text = $section->addText('Hello world!', 'pStyle');
|
||||
|
||||
Font style
|
||||
^^^^^^^^^^
|
||||
|
||||
Available font styles:
|
||||
|
||||
- ``name`` Font name, e.g. *Arial*
|
||||
- ``size`` Font size, e.g. *20*, *22*,
|
||||
- ``hint`` Font content type, *default*, *eastAsia*, or *cs*
|
||||
- ``bold`` Bold, *true* or *false*
|
||||
- ``italic`` Italic, *true* or *false*
|
||||
- ``superScript`` Superscript, *true* or *false*
|
||||
- ``subScript`` Subscript, *true* or *false*
|
||||
- ``underline`` Underline, *dash*, *dotted*, etc.
|
||||
- ``strikethrough`` Strikethrough, *true* or *false*
|
||||
- ``doubleStrikethrough`` Double strikethrough, *true* or *false*
|
||||
- ``color`` Font color, e.g. *FF0000*
|
||||
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
|
||||
- ``bgColor`` Font background color, e.g. *FF0000*
|
||||
- ``smallCaps`` Small caps, *true* or *false*
|
||||
- ``allCaps`` All caps, *true* or *false*
|
||||
|
||||
Paragraph style
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
Available paragraph styles:
|
||||
|
||||
- ``align`` Paragraph alignment, *left*, *right* or *center*
|
||||
- ``spaceBefore`` Space before paragraph
|
||||
- ``spaceAfter`` Space after paragraph
|
||||
- ``indent`` Indent by how much
|
||||
- ``hanging`` Hanging by how much
|
||||
- ``basedOn`` Parent style
|
||||
- ``next`` Style for next paragraph
|
||||
- ``widowControl`` Allow first/last line to display on a separate page,
|
||||
*true* or *false*
|
||||
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
|
||||
- ``keepLines`` Keep all lines on one page, *true* or *false*
|
||||
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
|
||||
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
|
||||
- ``tabs`` Set of custom tab stops
|
||||
$text = $section->addText('Hello World!');
|
||||
$text->setChanged(\PhpOffice\PhpWord\Element\ChangedElement::TYPE_INSERTED, 'Fred', (new \DateTime()));
|
||||
|
||||
Titles
|
||||
~~~~~~
|
||||
|
||||
If you want to structure your document or build table of contents, you
|
||||
need titles or headings. To add a title to the document, use the
|
||||
``addTitleStyle`` and ``addTitle`` method.
|
||||
If you want to structure your document or build table of contents, you need titles or headings.
|
||||
To add a title to the document, use the ``addTitleStyle`` and ``addTitle`` method.
|
||||
If `depth` is 0, a Title will be inserted, otherwise a Heading1, Heading2, ...
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->addTitleStyle($depth, [$fontStyle], [$paragraphStyle]);
|
||||
$section->addTitle($text, [$depth]);
|
||||
|
||||
Its necessary to add a title style to your document because otherwise
|
||||
the title won't be detected as a real title.
|
||||
- ``depth``.
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||
- ``$text``. Text to be displayed in the document. This can be `string` or a `\PhpOffice\PhpWord\Element\TextRun`
|
||||
|
||||
It's necessary to add a title style to your document because otherwise the title won't be detected as a real title.
|
||||
|
||||
Links
|
||||
~~~~~
|
||||
@ -169,16 +112,15 @@ You can add Hyperlinks to the document by using the function addLink:
|
||||
|
||||
$section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle]);
|
||||
|
||||
- ``$linkSrc`` The URL of the link.
|
||||
- ``$linkName`` Placeholder of the URL that appears in the document.
|
||||
- ``$fontStyle`` See "Font style" section.
|
||||
- ``$paragraphStyle`` See "Paragraph style" section.
|
||||
- ``$linkSrc``. The URL of the link.
|
||||
- ``$linkName``. Placeholder of the URL that appears in the document.
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||
|
||||
Preserve texts
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
The ``addPreserveText`` method is used to add a page number or page
|
||||
count to headers or footers.
|
||||
The ``addPreserveText`` method is used to add a page number or page count to headers or footers.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@ -190,90 +132,80 @@ Breaks
|
||||
Text breaks
|
||||
~~~~~~~~~~~
|
||||
|
||||
Text breaks are empty new lines. To add text breaks, use the following
|
||||
syntax. All paramaters are optional.
|
||||
Text breaks are empty new lines. To add text breaks, use the following syntax. All parameters are optional.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addTextBreak([$breakCount], [$fontStyle], [$paragraphStyle]);
|
||||
|
||||
- ``$breakCount`` How many lines
|
||||
- ``$fontStyle`` See "Font style" section.
|
||||
- ``$paragraphStyle`` See "Paragraph style" section.
|
||||
- ``$breakCount``. How many lines.
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||
|
||||
Page breaks
|
||||
~~~~~~~~~~~
|
||||
|
||||
There are two ways to insert a page breaks, using the ``addPageBreak``
|
||||
There are two ways to insert a page break, using the ``addPageBreak``
|
||||
method or using the ``pageBreakBefore`` style of paragraph.
|
||||
|
||||
:: code-block:: php
|
||||
.. code-block:: php
|
||||
|
||||
\\$section->addPageBreak();
|
||||
$section->addPageBreak();
|
||||
|
||||
Lists
|
||||
-----
|
||||
|
||||
To add a list item use the function ``addListItem``.
|
||||
Lists can be added by using ``addListItem`` and ``addListItemRun`` methods.
|
||||
``addListItem`` is used for creating lists that only contain plain text.
|
||||
``addListItemRun`` is used for creating complex list items that contains texts
|
||||
with different style (some bold, other italics, etc) or other elements, e.g.
|
||||
images or links. The syntaxes are as follow:
|
||||
|
||||
Basic usage:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addListItem($text, [$depth], [$fontStyle], [$listStyle], [$paragraphStyle]);
|
||||
$listItemRun = $section->addListItemRun([$depth], [$listStyle], [$paragraphStyle])
|
||||
|
||||
Parameters:
|
||||
|
||||
- ``$text`` Text that appears in the document.
|
||||
- ``$depth`` Depth of list item.
|
||||
- ``$fontStyle`` See "Font style" section.
|
||||
- ``$listStyle`` List style of the current element TYPE\_NUMBER,
|
||||
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in
|
||||
PHPWord\_Style\_ListItem.
|
||||
- ``$paragraphStyle`` See "Paragraph style" section.
|
||||
- ``$text``. Text that appears in the document.
|
||||
- ``$depth``. Depth of list item.
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
- ``$listStyle``. List style of the current element TYPE\_NUMBER,
|
||||
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in PHPWord\\Style\\ListItem.
|
||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||
|
||||
See ``Sample_09_Tables.php`` for more code sample.
|
||||
|
||||
Advanced usage:
|
||||
|
||||
You can also create your own numbering style by changing the
|
||||
``$listStyle`` parameter with the name of your numbering style.
|
||||
You can also create your own numbering style by changing the ``$listStyle`` parameter with the name of your numbering style.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->addNumberingStyle(
|
||||
'multilevel',
|
||||
array('type' => 'multilevel', 'levels' => array(
|
||||
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
|
||||
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
|
||||
array(
|
||||
'type' => 'multilevel',
|
||||
'levels' => array(
|
||||
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
|
||||
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$section->addListItem('List Item I', 0, null, 'multilevel');
|
||||
$section->addListItem('List Item I.a', 1, null, 'multilevel');
|
||||
$section->addListItem('List Item I.b', 1, null, 'multilevel');
|
||||
$section->addListItem('List Item II', 0, null, 'multilevel');
|
||||
|
||||
Level styles:
|
||||
|
||||
- ``start`` Starting value
|
||||
- ``format`` Numbering format
|
||||
bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter
|
||||
- ``restart`` Restart numbering level symbol
|
||||
- ``suffix`` Content between numbering symbol and paragraph text
|
||||
tab\|space\|nothing
|
||||
- ``text`` Numbering level text e.g. %1 for nonbullet or bullet
|
||||
character
|
||||
- ``align`` Numbering symbol align left\|center\|right\|both
|
||||
- ``left`` See paragraph style
|
||||
- ``hanging`` See paragraph style
|
||||
- ``tabPos`` See paragraph style
|
||||
- ``font`` Font name
|
||||
- ``hint`` See font style
|
||||
For available styling options see :ref:`numbering-level-style`.
|
||||
|
||||
Tables
|
||||
------
|
||||
|
||||
To add tables, rows, and cells, use the ``addTable``, ``addRow``, and
|
||||
``addCell`` methods:
|
||||
To add tables, rows, and cells, use the ``addTable``, ``addRow``, and ``addCell`` methods:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@ -287,46 +219,19 @@ Table style can be defined with ``addTableStyle``:
|
||||
|
||||
$tableStyle = array(
|
||||
'borderColor' => '006699',
|
||||
'borderSize' => 6,
|
||||
'cellMargin' => 50
|
||||
'borderSize' => 6,
|
||||
'cellMargin' => 50
|
||||
);
|
||||
$firstRowStyle = array('bgColor' => '66BBFF');
|
||||
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
|
||||
$table = $section->addTable('myTable');
|
||||
|
||||
Table, row, and cell styles
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Table styles:
|
||||
|
||||
- ``width`` Table width in percent
|
||||
- ``bgColor`` Background color, e.g. '9966CC'
|
||||
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
||||
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
||||
- ``cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
|
||||
|
||||
Row styles:
|
||||
|
||||
- ``tblHeader`` Repeat table row on every new page, *true* or *false*
|
||||
- ``cantSplit`` Table row cannot break across pages, *true* or *false*
|
||||
- ``exactHeight`` Row height is exact or at least
|
||||
|
||||
Cell styles:
|
||||
|
||||
- ``width`` Cell width in twips
|
||||
- ``valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
|
||||
- ``textDirection`` Direction of text
|
||||
- ``bgColor`` Background color, e.g. '9966CC'
|
||||
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
||||
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
||||
- ``gridSpan`` Number of columns spanned
|
||||
- ``vMerge`` *restart* or *continue*
|
||||
For available styling options see :ref:`table-style`.
|
||||
|
||||
Cell span
|
||||
~~~~~~~~~
|
||||
|
||||
You can span a cell on multiple columns by using ``gridSpan`` or
|
||||
multiple rows by using ``vMerge``.
|
||||
You can span a cell on multiple columns by using ``gridSpan`` or multiple rows by using ``vMerge``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@ -338,15 +243,14 @@ See ``Sample_09_Tables.php`` for more code sample.
|
||||
Images
|
||||
------
|
||||
|
||||
To add an image, use the ``addImage`` method to sections, headers,
|
||||
footers, textruns, or table cells.
|
||||
To add an image, use the ``addImage`` method to sections, headers, footers, textruns, or table cells.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addImage($src, [$style]);
|
||||
|
||||
- source String path to a local image or URL of a remote image
|
||||
- styles Array fo styles for the image. See below.
|
||||
- ``$src``. String path to a local image, URL of a remote image or the image data, as a string. Warning: Do not pass user-generated strings here, as that would allow an attacker to read arbitrary files or perform server-side request forgery by passing file paths or URLs instead of image data.
|
||||
- ``$style``. See :ref:`image-style`.
|
||||
|
||||
Examples:
|
||||
|
||||
@ -356,10 +260,10 @@ Examples:
|
||||
$section->addImage(
|
||||
'mars.jpg',
|
||||
array(
|
||||
'width' => 100,
|
||||
'height' => 100,
|
||||
'marginTop' => -1,
|
||||
'marginLeft' => -1,
|
||||
'width' => 100,
|
||||
'height' => 100,
|
||||
'marginTop' => -1,
|
||||
'marginLeft' => -1,
|
||||
'wrappingStyle' => 'behind'
|
||||
)
|
||||
);
|
||||
@ -367,19 +271,8 @@ Examples:
|
||||
$footer->addImage('http://example.com/image.php');
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addImage('http://php.net/logo.jpg');
|
||||
|
||||
Image styles
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Available image styles:
|
||||
|
||||
- ``width`` Width in pixels
|
||||
- ``height`` Height in pixels
|
||||
- ``align`` Image alignment, *left*, *right*, or *center*
|
||||
- ``marginTop`` Top margin in inches, can be negative
|
||||
- ``marginLeft`` Left margin in inches, can be negative
|
||||
- ``wrappingStyle`` Wrapping style, *inline*, *square*, *tight*,
|
||||
*behind*, or *infront*
|
||||
$source = file_get_contents('/path/to/my/images/earth.jpg');
|
||||
$textrun->addImage($source);
|
||||
|
||||
Watermarks
|
||||
~~~~~~~~~~
|
||||
@ -398,35 +291,32 @@ Objects
|
||||
-------
|
||||
|
||||
You can add OLE embeddings, such as Excel spreadsheets or PowerPoint
|
||||
presentations to the document by using ``addObject`` method.
|
||||
presentations to the document by using ``addOLEObject`` method.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addObject($src, [$style]);
|
||||
$section->addOLEObject($src, [$style]);
|
||||
|
||||
Table of contents
|
||||
-----------------
|
||||
|
||||
To add a table of contents (TOC), you can use the ``addTOC`` method.
|
||||
Your TOC can only be generated if you have add at least one title (See
|
||||
"Titles").
|
||||
Your TOC can only be generated if you have add at least one title (See "Titles").
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addTOC([$fontStyle], [$tocStyle], [$minDepth], [$maxDepth]);
|
||||
|
||||
- ``$fontStyle``: See font style section
|
||||
- ``$tocStyle``: See available options below
|
||||
- ``$minDepth``: Minimum depth of header to be shown. Default 1
|
||||
- ``$maxDepth``: Maximum depth of header to be shown. Default 9
|
||||
- ``$fontStyle``. See font style section.
|
||||
- ``$tocStyle``. See available options below.
|
||||
- ``$minDepth``. Minimum depth of header to be shown. Default 1.
|
||||
- ``$maxDepth``. Maximum depth of header to be shown. Default 9.
|
||||
|
||||
Options for ``$tocStyle``:
|
||||
|
||||
- ``tabLeader`` Fill type between the title text and the page number.
|
||||
Use the defined constants in PHPWord\_Style\_TOC.
|
||||
- ``tabPos`` The position of the tab where the page number appears in
|
||||
twips.
|
||||
- ``indent`` The indent factor of the titles in twips.
|
||||
- ``tabLeader``. Fill type between the title text and the page number. Use the defined constants in ``\PhpOffice\PhpWord\Style\TOC``.
|
||||
- ``tabPos``. The position of the tab where the page number appears in *twip*.
|
||||
- ``indent``. The indent factor of the titles in *twip*.
|
||||
|
||||
Footnotes & endnotes
|
||||
--------------------
|
||||
@ -434,7 +324,7 @@ Footnotes & endnotes
|
||||
You can create footnotes with ``addFootnote`` and endnotes with
|
||||
``addEndnote`` in texts or textruns, but it's recommended to use textrun
|
||||
to have better layout. You can use ``addText``, ``addLink``,
|
||||
``addTextBreak``, ``addImage``, ``addObject`` on footnotes and endnotes.
|
||||
``addTextBreak``, ``addImage``, ``addOLEObject`` on footnotes and endnotes.
|
||||
|
||||
On textrun:
|
||||
|
||||
@ -460,25 +350,40 @@ On text:
|
||||
$footnote = $section->addFootnote();
|
||||
$footnote->addText('Footnote text.');
|
||||
|
||||
The footnote reference number will be displayed with decimal number
|
||||
starting from 1. This number use ``FooterReference`` style which you can
|
||||
redefine by ``addFontStyle`` method. Default value for this style is
|
||||
By default the footnote reference number will be displayed with decimal number
|
||||
starting from 1. This number uses the ``FooterReference`` style which you can
|
||||
redefine with the ``addFontStyle`` method. Default value for this style is
|
||||
``array('superScript' => true)``;
|
||||
|
||||
The footnote numbering can be controlled by setting the FootnoteProperties on the Section.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$fp = new \PhpOffice\PhpWord\ComplexType\FootnoteProperties();
|
||||
//sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd)
|
||||
$fp->setPos(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::POSITION_BENEATH_TEXT);
|
||||
//set the number format to use (decimal (default), upperRoman, upperLetter, ...)
|
||||
$fp->setNumFmt(\PhpOffice\PhpWord\SimpleType\NumberFormat::LOWER_ROMAN);
|
||||
//force starting at other than 1
|
||||
$fp->setNumStart(2);
|
||||
//when to restart counting (continuous (default), eachSect, eachPage)
|
||||
$fp->setNumRestart(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::RESTART_NUMBER_EACH_PAGE);
|
||||
//And finaly, set it on the Section
|
||||
$section->setFootnoteProperties($fp);
|
||||
|
||||
Checkboxes
|
||||
----------
|
||||
|
||||
Checkbox elements can be added to sections or table cells by using
|
||||
``addCheckBox``.
|
||||
Checkbox elements can be added to sections or table cells by using ``addCheckBox``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addCheckBox($name, $text, [$fontStyle], [$paragraphStyle])
|
||||
|
||||
- ``$name`` Name of the check box.
|
||||
- ``$text`` Text following the check box
|
||||
- ``$fontStyle`` See "Font style" section.
|
||||
- ``$paragraphStyle`` See "Paragraph style" section.
|
||||
- ``$name``. Name of the check box.
|
||||
- ``$text``. Text to be displayed in the document.
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
- ``$paragraphStyle``. See :ref:`paragraph-style`.
|
||||
|
||||
Textboxes
|
||||
---------
|
||||
@ -488,25 +393,120 @@ To be completed
|
||||
Fields
|
||||
------
|
||||
|
||||
To be completed
|
||||
Currently the following fields are supported:
|
||||
|
||||
- PAGE
|
||||
- NUMPAGES
|
||||
- DATE
|
||||
- XE
|
||||
- INDEX
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$section->addField($fieldType, [$properties], [$options], [$fieldText], [$fontStyle])
|
||||
|
||||
- ``$fontStyle``. See :ref:`font-style`.
|
||||
|
||||
See ``\PhpOffice\PhpWord\Element\Field`` for list of properties and options available for each field type.
|
||||
Options which are not specifically defined can be added. Those must start with a ``\``.
|
||||
|
||||
For instance for the INDEX field, you can do the following (See `Index Field for list of available options <https://support.office.com/en-us/article/Field-codes-Index-field-adafcf4a-cb30-43f6-85c7-743da1635d9e?ui=en-US&rs=en-US&ad=US>`_ ):
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
//the $fieldText can be either a simple string
|
||||
$fieldText = 'The index value';
|
||||
|
||||
//or a 'TextRun', to be able to format the text you want in the index
|
||||
$fieldText = new TextRun();
|
||||
$fieldText->addText('My ');
|
||||
$fieldText->addText('bold index', ['bold' => true]);
|
||||
$fieldText->addText(' entry');
|
||||
$section->addField('XE', array(), array(), $fieldText);
|
||||
|
||||
//this actually adds the index
|
||||
$section->addField('INDEX', array(), array('\\e " " \\h "A" \\c "3"'), 'right click to update index');
|
||||
|
||||
Line
|
||||
------
|
||||
----
|
||||
|
||||
Line elements can be added to sections by using ``addLine``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552);
|
||||
$section->addLine($lineStyle)
|
||||
$lineStyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552);
|
||||
$section->addLine($lineStyle);
|
||||
|
||||
Available line style attributes:
|
||||
|
||||
- ``weight`` Line width in twips
|
||||
- ``color`` Defines the color of stroke
|
||||
- ``dash`` Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot
|
||||
- ``beginArrow`` Start type of arrow: block, open, classic, diamond, oval
|
||||
- ``endArrow`` End type of arrow: block, open, classic, diamond, ovel
|
||||
- ``width`` Line-object width in pt
|
||||
- ``height`` Line-object height in pt
|
||||
- ``flip`` Flip the line element: true, false
|
||||
- ``weight``. Line width in *twip*.
|
||||
- ``color``. Defines the color of stroke.
|
||||
- ``dash``. Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot.
|
||||
- ``beginArrow``. Start type of arrow: block, open, classic, diamond, oval.
|
||||
- ``endArrow``. End type of arrow: block, open, classic, diamond, oval.
|
||||
- ``width``. Line-object width in *pt*.
|
||||
- ``height``. Line-object height in *pt*.
|
||||
- ``flip``. Flip the line element: true, false.
|
||||
|
||||
Chart
|
||||
-----
|
||||
|
||||
Charts can be added using
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||
$series = array(1, 3, 2, 5, 4);
|
||||
$chart = $section->addChart('line', $categories, $series, $style);
|
||||
|
||||
For available styling options see :ref:`chart-style`.
|
||||
|
||||
check out the Sample_32_Chart.php for more options and styling.
|
||||
|
||||
Comments
|
||||
--------
|
||||
|
||||
Comments can be added to a document by using ``addComment``.
|
||||
The comment can contain formatted text. Once the comment has been added, it can be linked to any element with ``setCommentStart``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
// first create a comment
|
||||
$comment= new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
|
||||
$comment->addText('Test', array('bold' => true));
|
||||
|
||||
// add it to the document
|
||||
$phpWord->addComment($comment);
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('This ');
|
||||
$text = $textrun->addText('is');
|
||||
// link the comment to the text you just created
|
||||
$text->setCommentStart($comment);
|
||||
|
||||
If no end is set for a comment using the ``setCommentEnd``, the comment will be ended automatically at the end of the element it is started on.
|
||||
|
||||
Track Changes
|
||||
-------------
|
||||
|
||||
Track changes can be set on text elements. There are 2 ways to set the change information on an element.
|
||||
Either by calling the `setChangeInfo()`, or by setting the `TrackChange` instance on the element with `setTrackChange()`.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection();
|
||||
$textRun = $section->addTextRun();
|
||||
|
||||
$text = $textRun->addText('Hello World! Time to ');
|
||||
|
||||
$text = $textRun->addText('wake ', array('bold' => true));
|
||||
$text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800);
|
||||
|
||||
$text = $textRun->addText('up');
|
||||
$text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred'));
|
||||
|
||||
$text = $textRun->addText('go to sleep');
|
||||
$text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600)));
|
||||
|
||||
24
docs/faq.rst
24
docs/faq.rst
@ -3,24 +3,6 @@
|
||||
Frequently asked questions
|
||||
==========================
|
||||
|
||||
How contribute to PHPWord ?
|
||||
---------------------------
|
||||
|
||||
- Improve the documentation (`Sphinx Format <http://documentation-style-guide-sphinx.readthedocs.org/en/latest/index.html>`__)
|
||||
|
||||
|
||||
Is this the same with PHPWord that I found in CodePlex?
|
||||
-------------------------------------------------------
|
||||
|
||||
No. This one is much better with tons of new features that you can’t
|
||||
find in PHPWord 0.6.3. The development in CodePlex is halted and
|
||||
switched to GitHub to allow more participation from the crowd. The more
|
||||
the merrier, right?
|
||||
|
||||
I’ve been running PHPWord from CodePlex flawlessly, but I can’t use the latest PHPWord from GitHub. Why?
|
||||
--------------------------------------------------------------------------------------------------------
|
||||
|
||||
PHPWord requires PHP 5.3+ since 0.8, while PHPWord 0.6.3 from CodePlex
|
||||
can run with PHP 5.2. There’s a lot of new features that we can get from
|
||||
PHP 5.3 and it’s been around since 2009! You should upgrade your PHP
|
||||
version to use PHPWord 0.8+.
|
||||
How contribute to PHPWord?
|
||||
--------------------------
|
||||
- Improve the documentation (`Sphinx Format <http://documentation-style-guide-sphinx.readthedocs.org/en/latest/index.html>`__)
|
||||
|
||||
215
docs/general.rst
215
docs/general.rst
@ -13,8 +13,7 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
require_once 'src/PhpWord/Autoloader.php';
|
||||
\PhpOffice\PhpWord\Autoloader::register();
|
||||
require_once 'bootstrap.php';
|
||||
|
||||
// Creating the new document...
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
@ -25,11 +24,9 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
|
||||
$section = $phpWord->addSection();
|
||||
// Adding Text element to the Section having font styled by default...
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'"Learn from yesterday, live for today, hope for tomorrow. '
|
||||
. 'The important thing is not to stop questioning." '
|
||||
. '(Albert Einstein)'
|
||||
)
|
||||
'"Learn from yesterday, live for today, hope for tomorrow. '
|
||||
. 'The important thing is not to stop questioning." '
|
||||
. '(Albert Einstein)'
|
||||
);
|
||||
|
||||
/*
|
||||
@ -41,11 +38,9 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
|
||||
|
||||
// Adding Text element with font customized inline...
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'"Great achievement is usually born of great sacrifice, '
|
||||
. 'and is never the result of selfishness." '
|
||||
. '(Napoleon Hill)'
|
||||
),
|
||||
'"Great achievement is usually born of great sacrifice, '
|
||||
. 'and is never the result of selfishness." '
|
||||
. '(Napoleon Hill)',
|
||||
array('name' => 'Tahoma', 'size' => 10)
|
||||
);
|
||||
|
||||
@ -56,11 +51,9 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
|
||||
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
|
||||
);
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'"The greatest accomplishment is not in never falling, '
|
||||
. 'but in rising again after you fall." '
|
||||
. '(Vince Lombardi)'
|
||||
),
|
||||
'"The greatest accomplishment is not in never falling, '
|
||||
. 'but in rising again after you fall." '
|
||||
. '(Vince Lombardi)',
|
||||
$fontStyleName
|
||||
);
|
||||
|
||||
@ -69,9 +62,7 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
|
||||
$fontStyle->setBold(true);
|
||||
$fontStyle->setName('Tahoma');
|
||||
$fontStyle->setSize(13);
|
||||
$myTextElement = $section->addText(
|
||||
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
|
||||
);
|
||||
$myTextElement = $section->addText('"Believe you can and you\'re halfway there." (Theodor Roosevelt)');
|
||||
$myTextElement->setFontStyle($fontStyle);
|
||||
|
||||
// Saving the document as OOXML file...
|
||||
@ -89,8 +80,8 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
|
||||
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
|
||||
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
|
||||
|
||||
Settings
|
||||
--------
|
||||
PHPWord Settings
|
||||
----------------
|
||||
|
||||
The ``PhpOffice\PhpWord\Settings`` class provides some options that will
|
||||
affect the behavior of PHPWord. Below are the options.
|
||||
@ -118,15 +109,39 @@ Zip class
|
||||
By default, PHPWord uses `Zip extension <http://php.net/manual/en/book.zip.php>`__
|
||||
to deal with ZIP compressed archives and files inside them. If you can't have
|
||||
Zip extension installed on your server, you can use pure PHP library
|
||||
alternative, `PclZip <http://www.phpconcept.net/pclzip/>`__, which
|
||||
included with PHPWord.
|
||||
alternative, `PclZip <http://www.phpconcept.net/pclzip/>`__, which is
|
||||
included in PHPWord.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
\PhpOffice\PhpWord\Settings::setZipClass(\PhpOffice\PhpWord\Settings::PCLZIP);
|
||||
|
||||
Output escaping
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
Writing documents of some formats, especially XML-based, requires correct output escaping.
|
||||
Without it your document may become broken when you put special characters like ampersand, quotes, and others in it.
|
||||
|
||||
Escaping can be performed in two ways: outside of the library by a software developer and inside of the library by built-in mechanism.
|
||||
By default, the built-in mechanism is disabled for backward compatibility with versions prior to v0.13.0.
|
||||
To turn it on set ``outputEscapingEnabled`` option to ``true`` in your PHPWord configuration file or use the following instruction at runtime:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
|
||||
|
||||
Default Paper
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
By default, all sections of the document will print on A4 paper.
|
||||
You can alter the default paper by using the following function:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
\PhpOffice\PhpWord\Settings::setDefaultPaper('Letter');
|
||||
|
||||
Default font
|
||||
------------
|
||||
~~~~~~~~~~~~
|
||||
|
||||
By default, every text appears in Arial 10 point. You can alter the
|
||||
default font by using the following two functions:
|
||||
@ -136,6 +151,93 @@ default font by using the following two functions:
|
||||
$phpWord->setDefaultFontName('Times New Roman');
|
||||
$phpWord->setDefaultFontSize(12);
|
||||
|
||||
Document settings
|
||||
-----------------
|
||||
Settings for the generated document can be set using ``$phpWord->getSettings()``
|
||||
|
||||
Magnification Setting
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
The default zoom value is 100 percent. This can be changed either to another percentage
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setZoom(75);
|
||||
|
||||
Or to predefined values ``fullPage``, ``bestFit``, ``textFit``
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setZoom(Zoom::BEST_FIT);
|
||||
|
||||
Mirroring the Page Margins
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Use mirror margins to set up facing pages for double-sided documents, such as books or magazines.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setMirrorMargins(true);
|
||||
|
||||
Spelling and grammatical checks
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
By default spelling and grammatical errors are shown as soon as you open a word document.
|
||||
For big documents this can slow down the opening of the document. You can hide the spelling and/or grammatical errors with:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setHideGrammaticalErrors(true);
|
||||
$phpWord->getSettings()->setHideSpellingErrors(true);
|
||||
|
||||
You can also specify the status of the spell and grammar checks, marking spelling or grammar as dirty will force a re-check when opening the document.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$proofState = new \PhpOffice\PhpWord\ComplexType\ProofState();
|
||||
$proofState->setGrammar(\PhpOffice\PhpWord\ComplexType\ProofState::CLEAN);
|
||||
$proofState->setSpelling(\PhpOffice\PhpWord\ComplexType\ProofState::DIRTY);
|
||||
|
||||
$phpWord->getSettings()->setProofState($proofState);
|
||||
|
||||
Track Revisions
|
||||
~~~~~~~~~~~~~~~
|
||||
Track changes can be activated using ``setTrackRevisions``, you can furture specify
|
||||
|
||||
- Not to use move syntax, instead moved items will be seen as deleted in one place and added in another
|
||||
- Not track formatting revisions
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setTrackRevisions(true);
|
||||
$phpWord->getSettings()->setDoNotTrackMoves(true);
|
||||
$phpWord->getSettings()->setDoNotTrackFormatting(true);
|
||||
|
||||
Decimal Symbol
|
||||
~~~~~~~~~~~~~~
|
||||
The default symbol to represent a decimal figure is the ``.`` in english. In french you might want to change it to ``,`` for instance.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setDecimalSymbol(',');
|
||||
|
||||
Document Language
|
||||
~~~~~~~~~~~~~~~~~
|
||||
The default language of the document can be change with the following.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setThemeFontLang(new Language(Language::FR_BE));
|
||||
|
||||
``Language`` has 3 parameters, one for Latin languages, one for East Asian languages and one for Complex (Bi-Directional) languages.
|
||||
A couple of language codes are provided in the ``PhpOffice\PhpWord\Style\Language`` class but any valid code/ID can be used.
|
||||
|
||||
In case you are generating an RTF document the language need to be set differently.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$lang = new Language();
|
||||
$lang->setLangId(Language::EN_GB_ID);
|
||||
$phpWord->getSettings()->setThemeFontLang($lang);
|
||||
|
||||
Document information
|
||||
--------------------
|
||||
|
||||
@ -163,7 +265,7 @@ The base length unit in Open Office XML is twip. Twip means "TWentieth
|
||||
of an Inch Point", i.e. 1 twip = 1/1440 inch.
|
||||
|
||||
You can use PHPWord helper functions to convert inches, centimeters, or
|
||||
points to twips.
|
||||
points to twip.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@ -179,3 +281,64 @@ points to twips.
|
||||
// 2 cm right margin
|
||||
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(2));
|
||||
|
||||
Document protection
|
||||
-------------------
|
||||
|
||||
The document (or parts of it) can be password protected.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$documentProtection = $phpWord->getSettings()->getDocumentProtection();
|
||||
$documentProtection->setEditing(DocProtect::READ_ONLY);
|
||||
$documentProtection->setPassword('myPassword');
|
||||
|
||||
Automatically Recalculate Fields on Open
|
||||
----------------------------------------
|
||||
|
||||
To force an update of the fields present in the document, set updateFields to true
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setUpdateFields(true);
|
||||
|
||||
Hyphenation
|
||||
-----------
|
||||
Hyphenation describes the process of breaking words with hyphens. There are several options to control hyphenation.
|
||||
|
||||
Auto hyphenation
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
To automatically hyphenate text set ``autoHyphenation`` to ``true``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setAutoHyphenation(true);
|
||||
|
||||
Consecutive Hyphen Limit
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The maximum number of consecutive lines of text ending with a hyphen can be controlled by the ``consecutiveHyphenLimit`` option.
|
||||
There is no limit if the option is not set or the provided value is ``0``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setConsecutiveHyphenLimit(2);
|
||||
|
||||
Hyphenation Zone
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
The hyphenation zone (in *twip*) is the allowed amount of whitespace before hyphenation is applied.
|
||||
The smaller the hyphenation zone the more words are hyphenated. Or in other words, the wider the hyphenation zone the less words are hyphenated.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setHyphenationZone(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1));
|
||||
|
||||
Hyphenate Caps
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
To control whether or not words in all capital letters shall be hyphenated use the `doNotHyphenateCaps` option.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord->getSettings()->setDoNotHyphenateCaps(true);
|
||||
|
||||
@ -8,77 +8,41 @@ Requirements
|
||||
|
||||
Mandatory:
|
||||
|
||||
- PHP 5.3+
|
||||
- PHP `Zip <http://php.net/manual/en/book.zip.php>`__ extension
|
||||
- PHP `XML
|
||||
Parser <http://www.php.net/manual/en/xml.installation.php>`__
|
||||
extension
|
||||
- composer
|
||||
- PHP 7.1+
|
||||
- `XML Parser <http://www.php.net/manual/en/xml.installation.php>`__ extension
|
||||
|
||||
Optional PHP extensions:
|
||||
Optional:
|
||||
|
||||
- `GD <http://php.net/manual/en/book.image.php>`__
|
||||
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__
|
||||
- `XSL <http://php.net/manual/en/book.xsl.php>`__
|
||||
- `Zip <http://php.net/manual/en/book.zip.php>`__ extension
|
||||
- `GD <http://php.net/manual/en/book.image.php>`__ extension
|
||||
- `XMLWriter <http://php.net/manual/en/book.xmlwriter.php>`__ extension
|
||||
- `XSL <http://php.net/manual/en/book.xsl.php>`__ extension
|
||||
- `dompdf <https://github.com/dompdf/dompdf>`__ library
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
There are two ways to install PHPWord, i.e. via
|
||||
`Composer <http://getcomposer.org/>`__ or manually by downloading the
|
||||
library.
|
||||
PHPWord is installed via `Composer <https://getcomposer.org/>`__.
|
||||
You just need to `add dependency <https://getcomposer.org/doc/04-schema.md#package-links>`__ on PHPWord into your package.
|
||||
|
||||
Using Composer
|
||||
~~~~~~~~~~~~~~
|
||||
Example:
|
||||
|
||||
To install via Composer, add the following lines to your
|
||||
``composer.json``:
|
||||
.. code-block:: bash
|
||||
|
||||
.. code-block:: json
|
||||
|
||||
{
|
||||
"require": {
|
||||
"phpoffice/phpword": "dev-master"
|
||||
}
|
||||
}
|
||||
composer require phpoffice/phpword
|
||||
|
||||
If you are a developer or if you want to help us with testing then fetch the latest branch for developers.
|
||||
Notice: All contributions must be done against the developer branch.
|
||||
Notice: all contributions must be done against the developer branch.
|
||||
|
||||
.. code-block:: json
|
||||
Example:
|
||||
|
||||
{
|
||||
"require": {
|
||||
"phpoffice/phpword": "dev-develop"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Manual install
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
To install manually, you change to the webserver directory of your file system .
|
||||
Then you have 2 possibilities.
|
||||
|
||||
1. `download PHPWord package from github <https://github.com/PHPOffice/PHPWord/archive/master.zip>`__.
|
||||
Extract the package and put the contents to your machine.
|
||||
2. Alternatively you can use Git to install it:
|
||||
.. code-block:: console
|
||||
|
||||
git clone https://github.com/PHPOffice/PHPWord.git
|
||||
|
||||
To use the library, include ``src/PhpWord/Autoloader.php`` in your PHP script and
|
||||
invoke ``Autoloader::register``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
require_once '/path/to/src/PhpWord/Autoloader.php';
|
||||
\PhpOffice\PhpWord\Autoloader::register();
|
||||
.. code-block:: bash
|
||||
|
||||
composer require phpoffice/phpword:dev-master
|
||||
|
||||
Using samples
|
||||
-------------
|
||||
|
||||
After installation, you can browse and use the samples that we've
|
||||
provided, either by command line or using browser. If you can access
|
||||
your PHPWord library folder using browser, point your browser to the
|
||||
``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``.
|
||||
More examples are provided in the ``samples`` directory.
|
||||
For an easy access to those samples launch ``php -S localhost:8000`` in the samples directory then browse to http://localhost:8000 to view the samples.
|
||||
|
||||
@ -13,46 +13,43 @@ Applications <http://en.wikipedia.org/wiki/OpenDocument>`__
|
||||
Format <http://en.wikipedia.org/wiki/Rich_Text_Format>`__ (RTF).
|
||||
|
||||
PHPWord is an open source project licensed under the terms of `LGPL
|
||||
version 3 <https://github.com/PHPOffice/PHPWord/blob/develop/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/>`__.
|
||||
version 3 <https://github.com/PHPOffice/PHPWord/blob/master/COPYING.LESSER>`__.
|
||||
PHPWord is aimed to be a high quality software product.
|
||||
You can learn more about PHPWord by reading this Developers'
|
||||
Documentation and the `API
|
||||
Documentation <http://phpoffice.github.io/PHPWord/docs/develop/>`__.
|
||||
Documentation.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- 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 right-to-left text
|
||||
- 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 main document part of OOXML
|
||||
template
|
||||
- ... and many more features on progress
|
||||
- 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 right-to-left text
|
||||
- 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)
|
||||
- Insert comments
|
||||
- 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
|
||||
|
||||
File formats
|
||||
------------
|
||||
@ -63,7 +60,7 @@ Writers
|
||||
~~~~~~~
|
||||
|
||||
+---------------------------+----------------------+--------+-------+-------+--------+-------+
|
||||
| Features | | DOCX | ODT | RTF | HTML | PDF |
|
||||
| Features | | OOXML | ODF | RTF | HTML | PDF |
|
||||
+===========================+======================+========+=======+=======+========+=======+
|
||||
| **Document Properties** | Standard | ✓ | ✓ | ✓ | ✓ | ✓ |
|
||||
+---------------------------+----------------------+--------+-------+-------+--------+-------+
|
||||
@ -103,6 +100,8 @@ Writers
|
||||
+---------------------------+----------------------+--------+-------+-------+--------+-------+
|
||||
| | Endnote | ✓ | | | ✓ | |
|
||||
+---------------------------+----------------------+--------+-------+-------+--------+-------+
|
||||
| | Comments | ✓ | | | | |
|
||||
+---------------------------+----------------------+--------+-------+-------+--------+-------+
|
||||
| **Graphs** | 2D basic graphs | ✓ | | | | |
|
||||
+---------------------------+----------------------+--------+-------+-------+--------+-------+
|
||||
| | 2D advanced graphs | | | | | |
|
||||
@ -122,7 +121,7 @@ Readers
|
||||
~~~~~~~
|
||||
|
||||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
|
||||
| Features | | DOCX | DOC | ODT | RTF | HTML |
|
||||
| Features | | OOXML | DOC | ODF | RTF | HTML |
|
||||
+===========================+======================+========+=======+=======+=======+=======+
|
||||
| **Document Properties** | Standard | ✓ | | | | |
|
||||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
|
||||
@ -162,6 +161,8 @@ Readers
|
||||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
|
||||
| | Endnote | ✓ | | | | |
|
||||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
|
||||
| | Comments | | | | | |
|
||||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
|
||||
| **Graphs** | 2D basic graphs | | | | | |
|
||||
+---------------------------+----------------------+--------+-------+-------+-------+-------+
|
||||
| | 2D advanced graphs | | | | | |
|
||||
@ -183,13 +184,13 @@ Contributing
|
||||
We welcome everyone to contribute to PHPWord. Below are some of the
|
||||
things that you can do to contribute.
|
||||
|
||||
- Read `our contributing
|
||||
guide <https://github.com/PHPOffice/PHPWord/blob/master/CONTRIBUTING.md>`__.
|
||||
- `Fork us <https://github.com/PHPOffice/PHPWord/fork>`__ and `request
|
||||
a pull <https://github.com/PHPOffice/PHPWord/pulls>`__ to the
|
||||
`develop <https://github.com/PHPOffice/PHPWord/tree/develop>`__
|
||||
branch.
|
||||
- Submit `bug reports or feature
|
||||
requests <https://github.com/PHPOffice/PHPWord/issues>`__ to GitHub.
|
||||
- Follow `@PHPWord <https://twitter.com/PHPWord>`__ and
|
||||
`@PHPOffice <https://twitter.com/PHPOffice>`__ on Twitter.
|
||||
- Read `our contributing
|
||||
guide <https://github.com/PHPOffice/PHPWord/blob/master/CONTRIBUTING.md>`__.
|
||||
- `Fork us <https://github.com/PHPOffice/PHPWord/fork>`__ and `request
|
||||
a pull <https://github.com/PHPOffice/PHPWord/pulls>`__ to the
|
||||
`master <https://github.com/PHPOffice/PHPWord/tree/master>`__
|
||||
branch.
|
||||
- Submit `bug reports or feature
|
||||
requests <https://github.com/PHPOffice/PHPWord/issues>`__ to GitHub.
|
||||
- Follow `@PHPWord <https://twitter.com/PHPWord>`__ and
|
||||
`@PHPOffice <https://twitter.com/PHPOffice>`__ on Twitter.
|
||||
|
||||
@ -6,8 +6,7 @@ Recipes
|
||||
Create float left image
|
||||
-----------------------
|
||||
|
||||
Use absolute positioning relative to margin horizontally and to line
|
||||
vertically.
|
||||
Use absolute positioning relative to margin horizontally and to line vertically.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
@ -30,7 +29,7 @@ Use ``php://output`` as the filename.
|
||||
.. code-block:: php
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->createSection();
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText('Hello World!');
|
||||
$file = 'HelloWorld.docx';
|
||||
header("Content-Description: File Transfer");
|
||||
|
||||
@ -4,27 +4,25 @@ References
|
||||
==========
|
||||
|
||||
ISO/IEC 29500, Third edition, 2012-09-01
|
||||
---------------------
|
||||
----------------------------------------
|
||||
|
||||
- `Part 1: Fundamentals and Markup Language Reference
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061750_ISO_IEC_29500-1_2012.zip>`__
|
||||
- `Part 2: Open Packaging Conventions
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061796_ISO_IEC_29500-2_2012.zip>`__
|
||||
- `Part 3: Markup Compatibility and Extensibility
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061797_ISO_IEC_29500-3_2012.zip>`__
|
||||
- `Part 4: Transitional Migration Features
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061798_ISO_IEC_29500-4_2012.zip>`__
|
||||
- `Part 1: Fundamentals and Markup Language Reference
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061750_ISO_IEC_29500-1_2012.zip>`__
|
||||
- `Part 2: Open Packaging Conventions
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061796_ISO_IEC_29500-2_2012.zip>`__
|
||||
- `Part 3: Markup Compatibility and Extensibility
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061797_ISO_IEC_29500-3_2012.zip>`__
|
||||
- `Part 4: Transitional Migration Features
|
||||
<http://standards.iso.org/ittf/PubliclyAvailableStandards/c061798_ISO_IEC_29500-4_2012.zip>`__
|
||||
|
||||
Formal specifications
|
||||
---------------------
|
||||
|
||||
- `Oasis OpenDocument Standard Version
|
||||
1.2 <http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.html>`__
|
||||
- `Rich Text Format (RTF) Specification, version
|
||||
1.9.1 <http://www.microsoft.com/en-us/download/details.aspx?id=10725>`__
|
||||
- `Oasis OpenDocument Standard Version 1.2 <http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.html>`__
|
||||
- `Rich Text Format (RTF) Specification, version 1.9.1 <http://www.microsoft.com/en-us/download/details.aspx?id=10725>`__
|
||||
|
||||
Other resources
|
||||
---------------
|
||||
|
||||
- `DocumentFormat.OpenXml.Wordprocessing Namespace on
|
||||
MSDN <http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing%28v=office.14%29.aspx>`__
|
||||
- `DocumentFormat.OpenXml.Wordprocessing Namespace on
|
||||
MSDN <http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing%28v=office.14%29.aspx>`__
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
273
docs/styles.rst
273
docs/styles.rst
@ -3,132 +3,211 @@
|
||||
Styles
|
||||
======
|
||||
|
||||
.. _section-style:
|
||||
|
||||
Section
|
||||
-------
|
||||
|
||||
Below are the available styles for section:
|
||||
Available Section style options:
|
||||
|
||||
- ``pageSizeW`` Page width in twips (the default is 11906/A4 size)
|
||||
- ``pageSizeH`` Page height in twips (the default is 16838/A4 size)
|
||||
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
|
||||
'landscape'
|
||||
- ``marginTop`` Page margin top in twips
|
||||
- ``marginLeft`` Page margin left in twips
|
||||
- ``marginRight`` Page margin right in twips
|
||||
- ``marginBottom`` Page margin bottom in twips
|
||||
- ``borderTopSize`` Border top size in twips
|
||||
- ``borderTopColor`` Border top color
|
||||
- ``borderLeftSize`` Border left size in twips
|
||||
- ``borderLeftColor`` Border left color
|
||||
- ``borderRightSize`` Border right size in twips
|
||||
- ``borderRightColor`` Border right color
|
||||
- ``borderBottomSize`` Border bottom size in twips
|
||||
- ``borderBottomColor`` Border bottom color
|
||||
- ``headerHeight`` Spacing to top of header
|
||||
- ``footerHeight`` Spacing to bottom of footer
|
||||
- ``gutter`` Page gutter spacing
|
||||
- ``colsNum`` Number of columns
|
||||
- ``colsSpace`` Spacing between columns
|
||||
- ``breakType`` Section break type (nextPage, nextColumn, continuous,
|
||||
evenPage, oddPage)
|
||||
- ``borderBottomColor``. Border bottom color.
|
||||
- ``borderBottomSize``. Border bottom size in *twip*.
|
||||
- ``borderLeftColor``. Border left color.
|
||||
- ``borderLeftSize``. Border left size in *twip*.
|
||||
- ``borderRightColor``. Border right color.
|
||||
- ``borderRightSize``. Border right size in *twip*.
|
||||
- ``borderTopColor``. Border top color.
|
||||
- ``borderTopSize``. Border top size in *twip*.
|
||||
- ``breakType``. Section break type (nextPage, nextColumn, continuous, evenPage, oddPage).
|
||||
- ``colsNum``. Number of columns.
|
||||
- ``colsSpace``. Spacing between columns.
|
||||
- ``footerHeight``. Spacing to bottom of footer.
|
||||
- ``gutter``. Page gutter spacing.
|
||||
- ``headerHeight``. Spacing to top of header.
|
||||
- ``marginTop``. Page margin top in *twip*.
|
||||
- ``marginLeft``. Page margin left in *twip*.
|
||||
- ``marginRight``. Page margin right in *twip*.
|
||||
- ``marginBottom``. Page margin bottom in *twip*.
|
||||
- ``orientation``. Page orientation (``portrait``, which is default, or ``landscape``).
|
||||
See ``\PhpOffice\PhpWord\Style\Section::ORIENTATION_...`` class constants for possible values
|
||||
- ``pageSizeH``. Page height in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
|
||||
- ``pageSizeW``. Page width in *twip*. Implicitly defined by ``orientation`` option. Any changes are discouraged.
|
||||
- ``vAlign``. Vertical Page Alignment
|
||||
See ``\PhpOffice\PhpWord\SimpleType\VerticalJc`` for possible values
|
||||
|
||||
.. _font-style:
|
||||
|
||||
Font
|
||||
----
|
||||
|
||||
Available font styles:
|
||||
Available Font style options:
|
||||
|
||||
- ``name`` Font name, e.g. *Arial*
|
||||
- ``size`` Font size, e.g. *20*, *22*,
|
||||
- ``hint`` Font content type, *default*, *eastAsia*, or *cs*
|
||||
- ``bold`` Bold, *true* or *false*
|
||||
- ``italic`` Italic, *true* or *false*
|
||||
- ``superScript`` Superscript, *true* or *false*
|
||||
- ``subScript`` Subscript, *true* or *false*
|
||||
- ``underline`` Underline, *dash*, *dotted*, etc.
|
||||
- ``strikethrough`` Strikethrough, *true* or *false*
|
||||
- ``doubleStrikethrough`` Double strikethrough, *true* or *false*
|
||||
- ``color`` Font color, e.g. *FF0000*
|
||||
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
|
||||
- ``bgColor`` Font background color, e.g. *FF0000*
|
||||
- ``smallCaps`` Small caps, *true* or *false*
|
||||
- ``allCaps`` All caps, *true* or *false*
|
||||
- ``rtl`` Right to Left language, *true* or *false*
|
||||
- ``allCaps``. All caps, *true* or *false*.
|
||||
- ``bgColor``. Font background color, e.g. *FF0000*.
|
||||
- ``bold``. Bold, *true* or *false*.
|
||||
- ``color``. Font color, e.g. *FF0000*.
|
||||
- ``doubleStrikethrough``. Double strikethrough, *true* or *false*.
|
||||
- ``fgColor``. Font highlight color, e.g. *yellow*, *green*, *blue*.
|
||||
See ``\PhpOffice\PhpWord\Style\Font::FGCOLOR_...`` class constants for possible values
|
||||
- ``hint``. Font content type, *default*, *eastAsia*, or *cs*.
|
||||
- ``italic``. Italic, *true* or *false*.
|
||||
- ``name``. Font name, e.g. *Arial*.
|
||||
- ``rtl``. Right to Left language, *true* or *false*.
|
||||
- ``size``. Font size, e.g. *20*, *22*.
|
||||
- ``smallCaps``. Small caps, *true* or *false*.
|
||||
- ``strikethrough``. Strikethrough, *true* or *false*.
|
||||
- ``subScript``. Subscript, *true* or *false*.
|
||||
- ``superScript``. Superscript, *true* or *false*.
|
||||
- ``underline``. Underline, *single*, *dash*, *dotted*, etc.
|
||||
See ``\PhpOffice\PhpWord\Style\Font::UNDERLINE_...`` class constants for possible values
|
||||
- ``lang``. Language, either a language code like *en-US*, *fr-BE*, etc. or an object (or as an array) if you need to set eastAsian or bidirectional languages
|
||||
See ``\PhpOffice\PhpWord\Style\Language`` class for some language codes.
|
||||
- ``position``. The text position, raised or lowered, in half points
|
||||
- ``hidden``. Hidden text, *true* or *false*.
|
||||
|
||||
.. _paragraph-style:
|
||||
|
||||
Paragraph
|
||||
---------
|
||||
|
||||
Available paragraph styles:
|
||||
Available Paragraph style options:
|
||||
|
||||
- ``align`` Paragraph alignment, *left*, *right* or *center*
|
||||
- ``spaceBefore`` Space before paragraph
|
||||
- ``spaceAfter`` Space after paragraph
|
||||
- ``indent`` Indent by how much
|
||||
- ``hanging`` Hanging by how much
|
||||
- ``basedOn`` Parent style
|
||||
- ``next`` Style for next paragraph
|
||||
- ``widowControl`` Allow first/last line to display on a separate page,
|
||||
*true* or *false*
|
||||
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
|
||||
- ``keepLines`` Keep all lines on one page, *true* or *false*
|
||||
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
|
||||
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
|
||||
- ``tabs`` Set of custom tab stops
|
||||
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
|
||||
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
|
||||
- ``basedOn``. Parent style.
|
||||
- ``hanging``. Hanging indentation in *half inches*.
|
||||
- ``indent``. Indent (left indentation) in *half inches*.
|
||||
- ``indentation``. An array of indentation key => value pairs in *twip*. Supports *left*, *right*, *firstLine* and *hanging* indentation.
|
||||
See ``\PhpOffice\PhpWord\Style\Indentation`` for possible identation types.
|
||||
- ``keepLines``. Keep all lines on one page, *true* or *false*.
|
||||
- ``keepNext``. Keep paragraph with next paragraph, *true* or *false*.
|
||||
- ``lineHeight``. Text line height, e.g. *1.0*, *1.5*, etc.
|
||||
- ``next``. Style for next paragraph.
|
||||
- ``pageBreakBefore``. Start paragraph on next page, *true* or *false*.
|
||||
- ``spaceBefore``. Space before paragraph in *twip*.
|
||||
- ``spaceAfter``. Space after paragraph in *twip*.
|
||||
- ``spacing``. Space between lines in *twip*. If spacingLineRule is auto, 240 (height of 1 line) will be added, so if you want a double line height, set this to 240.
|
||||
- ``spacingLineRule``. Line Spacing Rule. *auto*, *exact*, *atLeast*
|
||||
See ``\PhpOffice\PhpWord\SimpleType\LineSpacingRule`` class constants for possible values.
|
||||
- ``suppressAutoHyphens``. Hyphenation for paragraph, *true* or *false*.
|
||||
- ``tabs``. Set of custom tab stops.
|
||||
- ``widowControl``. Allow first/last line to display on a separate page, *true* or *false*.
|
||||
- ``contextualSpacing``. Ignore Spacing Above and Below When Using Identical Styles, *true* or *false*.
|
||||
- ``bidi``. Right to Left Paragraph Layout, *true* or *false*.
|
||||
- ``shading``. Paragraph Shading.
|
||||
- ``textAlignment``. Vertical Character Alignment on Line.
|
||||
See ``\PhpOffice\PhpWord\SimpleType\TextAlignment`` class constants for possible values.
|
||||
|
||||
.. _table-style:
|
||||
|
||||
Table
|
||||
-----
|
||||
|
||||
Table styles:
|
||||
Available Table style options:
|
||||
|
||||
- ``width`` Table width in percent
|
||||
- ``bgColor`` Background color, e.g. '9966CC'
|
||||
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
||||
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
||||
- ``cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
|
||||
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
|
||||
See ``\PhpOffice\PhpWord\SimpleType\JcTable`` and ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
|
||||
- ``bgColor``. Background color, e.g. '9966CC'.
|
||||
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
|
||||
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
|
||||
- ``cellMargin(Top|Right|Bottom|Left)``. Cell margin in *twip*.
|
||||
- ``indent``. Table indent from leading margin. Must be an instance of ``\PhpOffice\PhpWord\ComplexType\TblWidth``.
|
||||
- ``width``. Table width in Fiftieths of a Percent or Twentieths of a Point.
|
||||
- ``unit``. The unit to use for the width. One of ``\PhpOffice\PhpWord\SimpleType\TblWidth``. Defaults to *auto*.
|
||||
- ``layout``. Table layout, either *fixed* or *autofit* See ``\PhpOffice\PhpWord\Style\Table`` for constants.
|
||||
- ``cellSpacing`` Cell spacing in *twip*
|
||||
- ``position`` Floating Table Positioning, see below for options
|
||||
- ``bidiVisual`` Present table as Right-To-Left
|
||||
|
||||
Row styles:
|
||||
Floating Table Positioning options:
|
||||
|
||||
- ``tblHeader`` Repeat table row on every new page, *true* or *false*
|
||||
- ``cantSplit`` Table row cannot break across pages, *true* or *false*
|
||||
- ``exactHeight`` Row height is exact or at least
|
||||
- ``leftFromText`` Distance From Left of Table to Text in *twip*
|
||||
- ``rightFromText`` Distance From Right of Table to Text in *twip*
|
||||
- ``topFromText`` Distance From Top of Table to Text in *twip*
|
||||
- ``bottomFromText`` Distance From Top of Table to Text in *twip*
|
||||
- ``vertAnchor`` Table Vertical Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::VANCHOR_*``
|
||||
- ``horzAnchor`` Table Horizontal Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::HANCHOR_*``
|
||||
- ``tblpXSpec`` Relative Horizontal Alignment From Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::XALIGN_*``
|
||||
- ``tblpX`` Absolute Horizontal Distance From Anchorin *twip*
|
||||
- ``tblpYSpec`` Relative Vertical Alignment From Anchor, one of ``\PhpOffice\PhpWord\Style\TablePosition::YALIGN_*``
|
||||
- ``tblpY`` Absolute Vertical Distance From Anchorin *twip*
|
||||
|
||||
Cell styles:
|
||||
Available Row style options:
|
||||
|
||||
- ``width`` Cell width in twips
|
||||
- ``valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
|
||||
- ``textDirection`` Direction of text
|
||||
- ``bgColor`` Background color, e.g. '9966CC'
|
||||
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
||||
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
||||
- ``gridSpan`` Number of columns spanned
|
||||
- ``vMerge`` *restart* or *continue*
|
||||
- ``cantSplit``. Table row cannot break across pages, *true* or *false*.
|
||||
- ``exactHeight``. Row height is exact or at least.
|
||||
- ``tblHeader``. Repeat table row on every new page, *true* or *false*.
|
||||
|
||||
Available Cell style options:
|
||||
|
||||
- ``bgColor``. Background color, e.g. '9966CC'.
|
||||
- ``border(Top|Right|Bottom|Left)Color``. Border color, e.g. '9966CC'.
|
||||
- ``border(Top|Right|Bottom|Left)Size``. Border size in *twip*.
|
||||
- ``border(Top|Right|Bottom|Left)Style``. Border style. You can use constants from ``\PhpOffice\PhpWord\SimpleType\Border``
|
||||
- ``gridSpan``. Number of columns spanned.
|
||||
- ``textDirection(btLr|tbRl)``. Direction of text.
|
||||
You can use constants ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR`` and ``\PhpOffice\PhpWord\Style\Cell::TEXT_DIR_TBRL``
|
||||
- ``valign``. Vertical alignment, *top*, *center*, *both*, *bottom*.
|
||||
- ``vMerge``. *restart* or *continue*.
|
||||
- ``width``. Cell width in *twip*.
|
||||
|
||||
.. _image-style:
|
||||
|
||||
Image
|
||||
-----
|
||||
|
||||
Available image styles:
|
||||
Available Image style options:
|
||||
|
||||
- ``width`` Width in pixels
|
||||
- ``height`` Height in pixels
|
||||
- ``align`` Image alignment, *left*, *right*, or *center*
|
||||
- ``marginTop`` Top margin in inches, can be negative
|
||||
- ``marginLeft`` Left margin in inches, can be negative
|
||||
- ``wrappingStyle`` Wrapping style, *inline*, *square*, *tight*,
|
||||
*behind*, or *infront*
|
||||
- ``alignment``. See ``\PhpOffice\PhpWord\SimpleType\Jc`` class for the details.
|
||||
- ``height``. Height in *pt*.
|
||||
- ``marginLeft``. Left margin in inches, can be negative.
|
||||
- ``marginTop``. Top margin in inches, can be negative.
|
||||
- ``width``. Width in *pt*.
|
||||
- ``wrappingStyle``. Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*.
|
||||
- ``wrapDistanceTop``. Top text wrapping in pixels.
|
||||
- ``wrapDistanceBottom``. Bottom text wrapping in pixels.
|
||||
- ``wrapDistanceLeft``. Left text wrapping in pixels.
|
||||
- ``wrapDistanceRight``. Right text wrapping in pixels.
|
||||
|
||||
.. _numbering-level-style:
|
||||
|
||||
Numbering level
|
||||
---------------
|
||||
|
||||
- ``start`` Starting value
|
||||
- ``format`` Numbering format
|
||||
bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter
|
||||
- ``restart`` Restart numbering level symbol
|
||||
- ``suffix`` Content between numbering symbol and paragraph text
|
||||
tab\|space\|nothing
|
||||
- ``text`` Numbering level text e.g. %1 for nonbullet or bullet
|
||||
character
|
||||
- ``align`` Numbering symbol align left\|center\|right\|both
|
||||
- ``left`` See paragraph style
|
||||
- ``hanging`` See paragraph style
|
||||
- ``tabPos`` See paragraph style
|
||||
- ``font`` Font name
|
||||
- ``hint`` See font style
|
||||
Available NumberingLevel style options:
|
||||
|
||||
- ``alignment``. Supports all alignment modes since 1st Edition of ECMA-376 standard up till ISO/IEC 29500:2012.
|
||||
See ``\PhpOffice\PhpWord\SimpleType\Jc`` class constants for possible values.
|
||||
- ``font``. Font name.
|
||||
- ``format``. Numbering format bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter.
|
||||
- ``hanging``. See paragraph style.
|
||||
- ``hint``. See font style.
|
||||
- ``left``. See paragraph style.
|
||||
- ``restart``. Restart numbering level symbol.
|
||||
- ``start``. Starting value.
|
||||
- ``suffix``. Content between numbering symbol and paragraph text tab\|space\|nothing.
|
||||
- ``tabPos``. See paragraph style.
|
||||
- ``text``. Numbering level text e.g. %1 for nonbullet or bullet character.
|
||||
|
||||
.. _chart-style:
|
||||
|
||||
Chart
|
||||
-----
|
||||
|
||||
Available Chart style options:
|
||||
|
||||
- ``width``. Width (in EMU).
|
||||
- ``height``. Height (in EMU).
|
||||
- ``3d``. Is 3D; applies to pie, bar, line, area, *true* or *false*.
|
||||
- ``colors``. A list of colors to use in the chart.
|
||||
- ``title``. The title for the chart.
|
||||
- ``showLegend``. Show legend, *true* or *false*.
|
||||
- ``LegendPosition``. Legend position, *r* (default), *b*, *t*, *l* or *tr*.
|
||||
- ``categoryLabelPosition``. Label position for categories, *nextTo* (default), *low* or *high*.
|
||||
- ``valueLabelPosition``. Label position for values, *nextTo* (default), *low* or *high*.
|
||||
- ``categoryAxisTitle``. The title for the category axis.
|
||||
- ``valueAxisTitle``. The title for the values axis.
|
||||
- ``majorTickMarkPos``. The position for major tick marks, *in*, *out*, *cross*, *none* (default).
|
||||
- ``showAxisLabels``. Show labels for axis, *true* or *false*.
|
||||
- ``gridX``. Show Gridlines for X-Axis, *true* or *false*.
|
||||
- ``gridY``. Show Gridlines for Y-Axis, *true* or *false*.
|
||||
|
||||
@ -3,23 +3,301 @@
|
||||
Templates processing
|
||||
====================
|
||||
|
||||
You can create a .docx document template with included search-patterns which can be replaced by any value you wish. Only single-line values can be replaced.
|
||||
|
||||
To deal with a template file, use ``new TemplateProcessor`` statement. After TemplateProcessor instance creation the document template is copied into the temporary directory. Then you can use ``TemplateProcessor::setValue`` method to change the value of a search pattern. The search-pattern model is: ``${search-pattern}``.
|
||||
|
||||
Example:
|
||||
You can create an OOXML document template with included search-patterns (macros) which can be replaced by any value you wish. Only single-line values can be replaced.
|
||||
By default Macros are defined like this: ``${search-pattern}`` but you can define custom macros.
|
||||
To load a template file, create a new instance of the TemplateProcessor.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor = new TemplateProcessor('Template.docx');
|
||||
$templateProcessor->setValue('Name', 'Somebody someone');
|
||||
$templateProcessor->setValue('Street', 'Coming-Undone-Street 32');
|
||||
|
||||
It is not possible to directly add new OOXML elements to the template file being processed, but it is possible to transform main document part of the template using XSLT (see ``TemplateProcessor::applyXslStyleSheet``).
|
||||
setValue
|
||||
""""""""
|
||||
Given a template containing
|
||||
|
||||
See ``Sample_07_TemplateCloneRow.php`` for example on how to create
|
||||
multirow from a single row in a template by using ``TemplateProcessor::cloneRow``.
|
||||
.. code-block:: clean
|
||||
|
||||
See ``Sample_23_TemplateBlock.php`` for example on how to clone a block
|
||||
of text using ``TemplateProcessor::cloneBlock`` and delete a block of text using
|
||||
``TemplateProcessor::deleteBlock``.
|
||||
Hello ${firstname} ${lastname}!
|
||||
|
||||
The following will replace ``${firstname}`` with ``John``, and ``${lastname}`` with ``Doe`` .
|
||||
The resulting document will now contain ``Hello John Doe!``
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->setValue('firstname', 'John');
|
||||
$templateProcessor->setValue('lastname', 'Doe');
|
||||
|
||||
setValues
|
||||
"""""""""
|
||||
You can also set multiple values by passing all of them in an array.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->setValues(array('firstname' => 'John', 'lastname' => 'Doe'));
|
||||
|
||||
setMacroOpeningChars
|
||||
""""""""
|
||||
You can define a custom opening macro. The following will set ``{#`` as the opening search pattern.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->setMacroOpeningChars('{#');
|
||||
|
||||
setMacroClosingChars
|
||||
""""""""
|
||||
You can define a custom closing macro. The following will set ``#}`` as the closing search pattern.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->setMacroClosingChars('#}');
|
||||
|
||||
setMacroChars
|
||||
""""""""
|
||||
You can define a custom opening and closing macro at the same time . The following will set the search-pattern like this: ``{#search-pattern#}`` .
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->setMacroChars('{#', '#}');
|
||||
|
||||
setImageValue
|
||||
"""""""""""""
|
||||
The search-pattern model for images can be like:
|
||||
- ``${search-image-pattern}``
|
||||
- ``${search-image-pattern:[width]:[height]:[ratio]}``
|
||||
- ``${search-image-pattern:[width]x[height]}``
|
||||
- ``${search-image-pattern:size=[width]x[height]}``
|
||||
- ``${search-image-pattern:width=[width]:height=[height]:ratio=false}``
|
||||
|
||||
Where:
|
||||
- [width] and [height] can be just numbers or numbers with measure, which supported by Word (cm, mm, in, pt, pc, px, %, em, ex)
|
||||
- [ratio] uses only for ``false``, ``-`` or ``f`` to turn off respect aspect ration of image. By default template image size uses as 'container' size.
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
${CompanyLogo}
|
||||
${UserLogo:50:50} ${Name} - ${City} - ${Street}
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor = new TemplateProcessor('Template.docx');
|
||||
$templateProcessor->setValue('Name', 'John Doe');
|
||||
$templateProcessor->setValue(array('City', 'Street'), array('Detroit', '12th Street'));
|
||||
|
||||
$templateProcessor->setImageValue('CompanyLogo', 'path/to/company/logo.png');
|
||||
$templateProcessor->setImageValue('UserLogo', array('path' => 'path/to/logo.png', 'width' => 100, 'height' => 100, 'ratio' => false));
|
||||
$templateProcessor->setImageValue('FeatureImage', function () {
|
||||
// Closure will only be executed if the replacement tag is found in the template
|
||||
|
||||
return array('path' => SlowFeatureImageGenerator::make(), 'width' => 100, 'height' => 100, 'ratio' => false);
|
||||
});
|
||||
|
||||
cloneBlock
|
||||
""""""""""
|
||||
Given a template containing
|
||||
See ``Sample_23_TemplateBlock.php`` for an example.
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
${block_name}
|
||||
Customer: ${customer_name}
|
||||
Address: ${customer_address}
|
||||
${/block_name}
|
||||
|
||||
The following will duplicate everything between ``${block_name}`` and ``${/block_name}`` 3 times.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->cloneBlock('block_name', 3, true, true);
|
||||
|
||||
The last parameter will rename any macro defined inside the block and add #1, #2, #3 ... to the macro name.
|
||||
The result will be
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
Customer: ${customer_name#1}
|
||||
Address: ${customer_address#1}
|
||||
|
||||
Customer: ${customer_name#2}
|
||||
Address: ${customer_address#2}
|
||||
|
||||
Customer: ${customer_name#3}
|
||||
Address: ${customer_address#3}
|
||||
|
||||
It is also possible to pass an array with the values to replace the marcros with.
|
||||
If an array with replacements is passed, the ``count`` argument is ignored, it is the size of the array that counts.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$replacements = array(
|
||||
array('customer_name' => 'Batman', 'customer_address' => 'Gotham City'),
|
||||
array('customer_name' => 'Superman', 'customer_address' => 'Metropolis'),
|
||||
);
|
||||
$templateProcessor->cloneBlock('block_name', 0, true, false, $replacements);
|
||||
|
||||
The result will then be
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
Customer: Batman
|
||||
Address: Gotham City
|
||||
|
||||
Customer: Superman
|
||||
Address: Metropolis
|
||||
|
||||
replaceBlock
|
||||
""""""""""""
|
||||
Given a template containing
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
${block_name}
|
||||
This block content will be replaced
|
||||
${/block_name}
|
||||
|
||||
The following will replace everything between ``${block_name}`` and ``${/block_name}`` with the value passed.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->replaceBlock('block_name', 'This is the replacement text.');
|
||||
|
||||
deleteBlock
|
||||
"""""""""""
|
||||
Same as previous, but it deletes the block
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->deleteBlock('block_name');
|
||||
|
||||
cloneRow
|
||||
""""""""
|
||||
Clones a table row in a template document.
|
||||
See ``Sample_07_TemplateCloneRow.php`` for an example.
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
+-----------+----------------+
|
||||
| ${userId} | ${userName} |
|
||||
| |----------------+
|
||||
| | ${userAddress} |
|
||||
+-----------+----------------+
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$templateProcessor->cloneRow('userId', 2);
|
||||
|
||||
Will result in
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
+-------------+------------------+
|
||||
| ${userId#1} | ${userName#1} |
|
||||
| |------------------+
|
||||
| | ${userAddress#1} |
|
||||
+-------------+------------------+
|
||||
| ${userId#2} | ${userName#2} |
|
||||
| |------------------+
|
||||
| | ${userAddress#2} |
|
||||
+-------------+------------------+
|
||||
|
||||
cloneRowAndSetValues
|
||||
""""""""""""""""""""
|
||||
Finds a row in a table row identified by `$search` param and clones it as many times as there are entries in `$values`.
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
+-----------+----------------+
|
||||
| ${userId} | ${userName} |
|
||||
| |----------------+
|
||||
| | ${userAddress} |
|
||||
+-----------+----------------+
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$values = [
|
||||
['userId' => 1, 'userName' => 'Batman', 'userAddress' => 'Gotham City'],
|
||||
['userId' => 2, 'userName' => 'Superman', 'userAddress' => 'Metropolis'],
|
||||
];
|
||||
$templateProcessor->cloneRowAndSetValues('userId', $values);
|
||||
|
||||
Will result in
|
||||
|
||||
.. code-block:: clean
|
||||
|
||||
+---+-------------+
|
||||
| 1 | Batman |
|
||||
| |-------------+
|
||||
| | Gotham City |
|
||||
+---+-------------+
|
||||
| 2 | Superman |
|
||||
| |-------------+
|
||||
| | Metropolis |
|
||||
+---+-------------+
|
||||
|
||||
applyXslStyleSheet
|
||||
""""""""""""""""""
|
||||
Applies the XSL stylesheet passed to header part, footer part and main part
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$xslDomDocument = new \DOMDocument();
|
||||
$xslDomDocument->load('/path/to/my/stylesheet.xsl');
|
||||
$templateProcessor->applyXslStyleSheet($xslDomDocument);
|
||||
|
||||
setComplexValue
|
||||
"""""""""""""""
|
||||
Raplaces a ${macro} with the ComplexType passed.
|
||||
See ``Sample_40_TemplateSetComplexValue.php`` for examples.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$inline = new TextRun();
|
||||
$inline->addText('by a red italic text', array('italic' => true, 'color' => 'red'));
|
||||
$templateProcessor->setComplexValue('inline', $inline);
|
||||
|
||||
setComplexBlock
|
||||
"""""""""""""""
|
||||
Raplaces a ${macro} with the ComplexType passed.
|
||||
See ``Sample_40_TemplateSetComplexValue.php`` for examples.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$table = new Table(array('borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP));
|
||||
$table->addRow();
|
||||
$table->addCell(150)->addText('Cell A1');
|
||||
$table->addCell(150)->addText('Cell A2');
|
||||
$table->addCell(150)->addText('Cell A3');
|
||||
$table->addRow();
|
||||
$table->addCell(150)->addText('Cell B1');
|
||||
$table->addCell(150)->addText('Cell B2');
|
||||
$table->addCell(150)->addText('Cell B3');
|
||||
$templateProcessor->setComplexBlock('table', $table);
|
||||
|
||||
setChartValue
|
||||
"""""""""""""
|
||||
Replace a variable by a chart.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||
$series1 = array(1, 3, 2, 5, 4);
|
||||
$chart = new Chart('doughnut', $categories, $series1);
|
||||
$templateProcessor->setChartValue('myChart', $chart);
|
||||
|
||||
save
|
||||
""""
|
||||
Saves the loaded template within the current directory. Returns the file path.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$filepath = $templateProcessor->save();
|
||||
|
||||
saveAs
|
||||
""""""
|
||||
Saves a copy of the loaded template in the indicated path.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
$pathToSave = 'path/to/save/file.ext';
|
||||
$templateProcessor->saveAs($pathToSave);
|
||||
|
||||
@ -8,35 +8,35 @@ OOXML
|
||||
|
||||
The package of OOXML document consists of the following files.
|
||||
|
||||
- \_rels/
|
||||
- \_rels/
|
||||
|
||||
- .rels
|
||||
- .rels
|
||||
|
||||
- docProps/
|
||||
- docProps/
|
||||
|
||||
- app.xml
|
||||
- core.xml
|
||||
- custom.xml
|
||||
- app.xml
|
||||
- core.xml
|
||||
- custom.xml
|
||||
|
||||
- word/
|
||||
- word/
|
||||
|
||||
- rels/
|
||||
- rels/
|
||||
|
||||
- document.rels.xml
|
||||
- document.rels.xml
|
||||
|
||||
- media/
|
||||
- theme/
|
||||
- media/
|
||||
- theme/
|
||||
|
||||
- theme1.xml
|
||||
- theme1.xml
|
||||
|
||||
- document.xml
|
||||
- fontTable.xml
|
||||
- numbering.xml
|
||||
- settings.xml
|
||||
- styles.xml
|
||||
- webSettings.xml
|
||||
- document.xml
|
||||
- fontTable.xml
|
||||
- numbering.xml
|
||||
- settings.xml
|
||||
- styles.xml
|
||||
- webSettings.xml
|
||||
|
||||
- [Content\_Types].xml
|
||||
- [Content\_Types].xml
|
||||
|
||||
OpenDocument
|
||||
------------
|
||||
@ -46,53 +46,53 @@ Package
|
||||
|
||||
The package of OpenDocument document consists of the following files.
|
||||
|
||||
- META-INF/
|
||||
- META-INF/
|
||||
|
||||
- manifest.xml
|
||||
- manifest.xml
|
||||
|
||||
- Pictures/
|
||||
- content.xml
|
||||
- meta.xml
|
||||
- styles.xml
|
||||
- Pictures/
|
||||
- content.xml
|
||||
- meta.xml
|
||||
- styles.xml
|
||||
|
||||
content.xml
|
||||
~~~~~~~~~~~
|
||||
|
||||
The structure of ``content.xml`` is described below.
|
||||
|
||||
- office:document-content
|
||||
- office:document-content
|
||||
|
||||
- office:font-facedecls
|
||||
- office:automatic-styles
|
||||
- office:body
|
||||
- office:font-facedecls
|
||||
- office:automatic-styles
|
||||
- office:body
|
||||
|
||||
- office:text
|
||||
- office:text
|
||||
|
||||
- draw:\*
|
||||
- office:forms
|
||||
- table:table
|
||||
- text:list
|
||||
- text:numbered-paragraph
|
||||
- text:p
|
||||
- text:table-of-contents
|
||||
- text:section
|
||||
- draw:\*
|
||||
- office:forms
|
||||
- table:table
|
||||
- text:list
|
||||
- text:numbered-paragraph
|
||||
- text:p
|
||||
- text:table-of-contents
|
||||
- text:section
|
||||
|
||||
- office:chart
|
||||
- office:image
|
||||
- office:drawing
|
||||
- office:chart
|
||||
- office:image
|
||||
- office:drawing
|
||||
|
||||
styles.xml
|
||||
~~~~~~~~~~
|
||||
|
||||
The structure of ``styles.xml`` is described below.
|
||||
|
||||
- office:document-styles
|
||||
- office:document-styles
|
||||
|
||||
- office:styles
|
||||
- office:automatic-styles
|
||||
- office:master-styles
|
||||
- office:styles
|
||||
- office:automatic-styles
|
||||
- office:master-styles
|
||||
|
||||
- office:master-page
|
||||
- office:master-page
|
||||
|
||||
RTF
|
||||
---
|
||||
|
||||
@ -4,15 +4,24 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
<rule ref="rulesets/naming.xml"/>
|
||||
<rule ref="rulesets/naming.xml">
|
||||
<exclude name="ShortVariable" />
|
||||
<exclude name="ShortClassName" />
|
||||
<exclude name="LongVariable" />
|
||||
</rule>
|
||||
<rule ref="rulesets/naming.xml/LongVariable">
|
||||
<properties>
|
||||
<property name="maximum" value="32" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/design.xml/ExitExpression" />
|
||||
<rule ref="rulesets/design.xml/EvalExpression" />
|
||||
<rule ref="rulesets/design.xml/GotoStatement" />
|
||||
<rule ref="rulesets/design.xml/DepthOfInheritance" />
|
||||
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
|
||||
<!-- AbstractContainer needs more coupling (default: 13) -->
|
||||
<!-- AbstractContainer and Html need more coupling (default: 13) -->
|
||||
<properties>
|
||||
<property name="minimum" value="20" />
|
||||
<property name="maximum" value="25" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/design.xml/NumberOfChildren">
|
||||
@ -21,6 +30,5 @@
|
||||
<property name="minimum" value="30" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="rulesets/unusedcode.xml" />
|
||||
<rule ref="rulesets/controversial.xml" />
|
||||
</ruleset>
|
||||
13
phpstan.neon
Normal file
13
phpstan.neon
Normal file
@ -0,0 +1,13 @@
|
||||
includes:
|
||||
- vendor/phpstan/phpstan/conf/config.level1.neon
|
||||
parameters:
|
||||
memory-limit: 20000000
|
||||
autoload_directories:
|
||||
- tests
|
||||
autoload_files:
|
||||
- tests/bootstrap.php
|
||||
excludes_analyse:
|
||||
- */pclzip.lib.php
|
||||
- src/PhpWord/Shared/OLERead.php
|
||||
- src/PhpWord/Reader/MsDoc.php
|
||||
- src/PhpWord/Writer/PDF/MPDF.php
|
||||
@ -6,23 +6,18 @@
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false">
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="PhpWord Test Suite">
|
||||
<directory>./tests/PhpWord</directory>
|
||||
<directory>./tests/PhpWordTests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">./src</directory>
|
||||
<exclude>
|
||||
<directory suffix=".php">./src/PhpWord/Shared/PCLZip</directory>
|
||||
<directory suffix=".php">./src/PhpWordTests/Shared/PCLZip</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<logging>
|
||||
<log type="coverage-html" target="./build/coverage" charset="UTF-8" highlight="true" />
|
||||
<log type="coverage-clover" target="./build/logs/clover.xml" />
|
||||
</logging>
|
||||
</phpunit>
|
||||
</phpunit>
|
||||
|
||||
@ -3,13 +3,18 @@
|
||||
|
||||
[General]
|
||||
|
||||
compatibility = true
|
||||
zipClass = ZipArchive
|
||||
pdfRendererName = DomPDF
|
||||
pdfRendererPath =
|
||||
; tempDir = "C:\PhpWordTemp"
|
||||
compatibility = true
|
||||
zipClass = ZipArchive
|
||||
pdfRendererName = DomPDF
|
||||
pdfRendererPath =
|
||||
; tempDir = "C:\PhpWordTemp"
|
||||
outputEscapingEnabled = false
|
||||
|
||||
[Font]
|
||||
|
||||
defaultFontName = Arial
|
||||
defaultFontSize = 10
|
||||
|
||||
[Paper]
|
||||
|
||||
defaultPaper = "A4"
|
||||
|
||||
@ -1,27 +1,43 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
|
||||
$languageEnGb = new \PhpOffice\PhpWord\Style\Language(\PhpOffice\PhpWord\Style\Language::EN_GB);
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true));
|
||||
$phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100));
|
||||
$phpWord->addTitleStyle(1, array('bold' => true), array('spaceAfter' => 240));
|
||||
$phpWord->getSettings()->setThemeFontLang($languageEnGb);
|
||||
|
||||
$fontStyleName = 'rStyle';
|
||||
$phpWord->addFontStyle($fontStyleName, ['bold' => true, 'italic' => true, 'size' => 16, 'allCaps' => true, 'doubleStrikethrough' => true]);
|
||||
|
||||
$paragraphStyleName = 'pStyle';
|
||||
$phpWord->addParagraphStyle($paragraphStyleName, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'spaceAfter' => 100]);
|
||||
|
||||
$phpWord->addTitleStyle(1, ['bold' => true], ['spaceAfter' => 240]);
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Simple text
|
||||
$section->addTitle(htmlspecialchars('Welcome to PhpWord'), 1);
|
||||
$section->addText(htmlspecialchars('Hello World!'));
|
||||
$section->addTitle('Welcome to PhpWord', 1);
|
||||
$section->addText('Hello World!');
|
||||
|
||||
// $pStyle = new Font();
|
||||
// $pStyle->setLang()
|
||||
$section->addText('Ce texte-ci est en français.', ['lang' => \PhpOffice\PhpWord\Style\Language::FR_BE]);
|
||||
|
||||
// Two text break
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Defined style
|
||||
$section->addText(htmlspecialchars('I am styled by a font style definition.'), 'rStyle');
|
||||
$section->addText(htmlspecialchars('I am styled by a paragraph style definition.'), null, 'pStyle');
|
||||
$section->addText(htmlspecialchars('I am styled by both font and paragraph style.'), 'rStyle', 'pStyle');
|
||||
// Define styles
|
||||
$section->addText('I am styled by a font style definition.', $fontStyleName);
|
||||
$section->addText('I am styled by a paragraph style definition.', null, $paragraphStyleName);
|
||||
$section->addText('I am styled by both font and paragraph style.', $fontStyleName, $paragraphStyleName);
|
||||
|
||||
$section->addTextBreak();
|
||||
|
||||
@ -30,43 +46,43 @@ $fontStyle['name'] = 'Times New Roman';
|
||||
$fontStyle['size'] = 20;
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('I am inline styled '), $fontStyle);
|
||||
$textrun->addText(htmlspecialchars('with '));
|
||||
$textrun->addText(htmlspecialchars('color'), array('color' => '996699'));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('bold'), array('bold' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('italic'), array('italic' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('underline'), array('underline' => 'dash'));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('strikethrough'), array('strikethrough' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('doubleStrikethrough'), array('doubleStrikethrough' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('superScript'), array('superScript' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('subScript'), array('subScript' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('smallCaps'), array('smallCaps' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('allCaps'), array('allCaps' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('fgColor'), array('fgColor' => 'yellow'));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('scale'), array('scale' => 200));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('spacing'), array('spacing' => 120));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addText(htmlspecialchars('kerning'), array('kerning' => 10));
|
||||
$textrun->addText(htmlspecialchars('. '));
|
||||
$textrun->addText('I am inline styled ', $fontStyle);
|
||||
$textrun->addText('with ');
|
||||
$textrun->addText('color', ['color' => '996699']);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('bold', ['bold' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('italic', ['italic' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('underline', ['underline' => 'dash']);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('strikethrough', ['strikethrough' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('doubleStrikethrough', ['doubleStrikethrough' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('superScript', ['superScript' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('subScript', ['subScript' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('smallCaps', ['smallCaps' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('allCaps', ['allCaps' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('fgColor', ['fgColor' => 'yellow']);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('scale', ['scale' => 200]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('spacing', ['spacing' => 120]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addText('kerning', ['kerning' => 10]);
|
||||
$textrun->addText('. ');
|
||||
|
||||
// Link
|
||||
$section->addLink('http://www.google.com', htmlspecialchars('Google'));
|
||||
$section->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
|
||||
$section->addTextBreak();
|
||||
|
||||
// Image
|
||||
$section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18));
|
||||
$section->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,37 +1,37 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Ads styles
|
||||
// Define styles
|
||||
$multipleTabsStyleName = 'multipleTab';
|
||||
$phpWord->addParagraphStyle(
|
||||
'multipleTab',
|
||||
array(
|
||||
'tabs' => array(
|
||||
$multipleTabsStyleName,
|
||||
[
|
||||
'tabs' => [
|
||||
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
|
||||
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
|
||||
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
|
||||
)
|
||||
)
|
||||
);
|
||||
$phpWord->addParagraphStyle(
|
||||
'rightTab',
|
||||
array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('right', 9090)))
|
||||
);
|
||||
$phpWord->addParagraphStyle(
|
||||
'centerTab',
|
||||
array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('center', 4680)))
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$rightTabStyleName = 'rightTab';
|
||||
$phpWord->addParagraphStyle($rightTabStyleName, ['tabs' => [new \PhpOffice\PhpWord\Style\Tab('right', 9090)]]);
|
||||
|
||||
$leftTabStyleName = 'centerTab';
|
||||
$phpWord->addParagraphStyle($leftTabStyleName, ['tabs' => [new \PhpOffice\PhpWord\Style\Tab('center', 4680)]]);
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Add listitem elements
|
||||
$section->addText(htmlspecialchars("Multiple Tabs:\tOne\tTwo\tThree"), null, 'multipleTab');
|
||||
$section->addText(htmlspecialchars("Left Aligned\tRight Aligned"), null, 'rightTab');
|
||||
$section->addText(htmlspecialchars("\tCenter Aligned"), null, 'centerTab');
|
||||
$section->addText("Multiple Tabs:\tOne\tTwo\tThree", null, $multipleTabsStyleName);
|
||||
$section->addText("Left Aligned\tRight Aligned", null, $rightTabStyleName);
|
||||
$section->addText("\tCenter Aligned", null, $leftTabStyleName);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\SimpleType\VerticalJc;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
@ -6,39 +9,41 @@ echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection(array('borderColor' => '00FF00', 'borderSize' => 12));
|
||||
$section->addText(htmlspecialchars('I am placed on a default section.'));
|
||||
$section = $phpWord->addSection(['borderColor' => '00FF00', 'borderSize' => 12]);
|
||||
$section->addText('I am placed on a default section.');
|
||||
|
||||
// New landscape section
|
||||
$section = $phpWord->addSection(array('orientation' => 'landscape'));
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'I am placed on a landscape section. Every page starting from this section will be landscape style.'
|
||||
)
|
||||
);
|
||||
$section = $phpWord->addSection(['orientation' => 'landscape']);
|
||||
$section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.');
|
||||
$section->addPageBreak();
|
||||
$section->addPageBreak();
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection(
|
||||
array('paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)
|
||||
['paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600]
|
||||
);
|
||||
$section->addText(htmlspecialchars('This section uses other margins with folio papersize.'));
|
||||
$section->addText('This section uses other margins with folio papersize.');
|
||||
|
||||
// The text of this section is vertically centered
|
||||
$section = $phpWord->addSection(
|
||||
['vAlign' => VerticalJc::CENTER]
|
||||
);
|
||||
$section->addText('This section is vertically centered.');
|
||||
|
||||
// New portrait section with Header & Footer
|
||||
$section = $phpWord->addSection(
|
||||
array(
|
||||
'marginLeft' => 200,
|
||||
'marginRight' => 200,
|
||||
'marginTop' => 200,
|
||||
[
|
||||
'marginLeft' => 200,
|
||||
'marginRight' => 200,
|
||||
'marginTop' => 200,
|
||||
'marginBottom' => 200,
|
||||
'headerHeight' => 50,
|
||||
'footerHeight' => 50,
|
||||
)
|
||||
]
|
||||
);
|
||||
$section->addText(htmlspecialchars('This section and we play with header/footer height.'));
|
||||
$section->addHeader()->addText(htmlspecialchars('Header'));
|
||||
$section->addFooter()->addText(htmlspecialchars('Footer'));
|
||||
$section->addText('This section and we play with header/footer height.');
|
||||
$section->addHeader()->addText('Header');
|
||||
$section->addFooter()->addText('Footer');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,43 +1,47 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Ads styles
|
||||
$phpWord->addParagraphStyle('pStyle', array('spacing' => 100));
|
||||
$phpWord->addFontStyle('BoldText', array('bold' => true));
|
||||
$phpWord->addFontStyle('ColoredText', array('color' => 'FF8080', 'bgColor' => 'FFFFCC'));
|
||||
$phpWord->addLinkStyle(
|
||||
'NLink',
|
||||
array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)
|
||||
);
|
||||
// Define styles
|
||||
$paragraphStyleName = 'pStyle';
|
||||
$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 100]);
|
||||
|
||||
$boldFontStyleName = 'BoldText';
|
||||
$phpWord->addFontStyle($boldFontStyleName, ['bold' => true]);
|
||||
|
||||
$coloredFontStyleName = 'ColoredText';
|
||||
$phpWord->addFontStyle($coloredFontStyleName, ['color' => 'FF8080', 'bgColor' => 'FFFFCC']);
|
||||
|
||||
$linkFontStyleName = 'NLink';
|
||||
$phpWord->addLinkStyle($linkFontStyleName, ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]);
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Add text run
|
||||
$textrun = $section->addTextRun('pStyle');
|
||||
|
||||
$textrun->addText(htmlspecialchars('Each textrun can contain native text, link elements or an image.'));
|
||||
$textrun->addText(htmlspecialchars(' No break is placed after adding an element.'), 'BoldText');
|
||||
$textrun->addText(htmlspecialchars(' Both '));
|
||||
$textrun->addText(htmlspecialchars('superscript'), array('superScript' => true));
|
||||
$textrun->addText(htmlspecialchars(' and '));
|
||||
$textrun->addText(htmlspecialchars('subscript'), array('subScript' => true));
|
||||
$textrun->addText(htmlspecialchars(' are also available.'));
|
||||
$textrun->addText(
|
||||
htmlspecialchars(' All elements are placed inside a paragraph with the optionally given p-Style.'),
|
||||
'ColoredText'
|
||||
);
|
||||
$textrun->addText(htmlspecialchars(' Sample Link: '));
|
||||
$textrun->addLink('http://www.google.com', null, 'NLink');
|
||||
$textrun->addText(htmlspecialchars(' Sample Image: '));
|
||||
$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
|
||||
$textrun->addText(htmlspecialchars(' Sample Object: '));
|
||||
$textrun = $section->addTextRun($paragraphStyleName);
|
||||
$textrun->addText('Each textrun can contain native text, link elements or an image.');
|
||||
$textrun->addText(' No break is placed after adding an element.', $boldFontStyleName);
|
||||
$textrun->addText(' Both ');
|
||||
$textrun->addText('superscript', ['superScript' => true]);
|
||||
$textrun->addText(' and ');
|
||||
$textrun->addText('subscript', ['subScript' => true]);
|
||||
$textrun->addText(' are also available.');
|
||||
$textrun->addText(' All elements are placed inside a paragraph with the optionally given paragraph style.', $coloredFontStyleName);
|
||||
$textrun->addText(' Sample Link: ');
|
||||
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName);
|
||||
$textrun->addText(' Sample Image: ');
|
||||
$textrun->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
|
||||
$textrun->addText(' Sample Object: ');
|
||||
$textrun->addObject('resources/_sheet.xls');
|
||||
$textrun->addText(htmlspecialchars(' Here is some more text. '));
|
||||
$textrun->addText(' Here is some more text. ');
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('This text is not visible.', ['hidden' => true]);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
@ -11,35 +12,35 @@ $filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
|
||||
|
||||
// Normal
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText(htmlspecialchars("Normal paragraph. {$filler}"));
|
||||
$section->addText("Normal paragraph. {$filler}");
|
||||
|
||||
// Two columns
|
||||
$section = $phpWord->addSection(
|
||||
array(
|
||||
'colsNum' => 2,
|
||||
[
|
||||
'colsNum' => 2,
|
||||
'colsSpace' => 1440,
|
||||
'breakType' => 'continuous',
|
||||
)
|
||||
]
|
||||
);
|
||||
$section->addText(htmlspecialchars("Two columns, one inch (1440 twips) spacing. {$filler}"));
|
||||
$section->addText("Two columns, one inch (1440 twips) spacing. {$filler}");
|
||||
|
||||
// Normal
|
||||
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
||||
$section->addText(htmlspecialchars("Normal paragraph again. {$filler}"));
|
||||
$section = $phpWord->addSection(['breakType' => 'continuous']);
|
||||
$section->addText("Normal paragraph again. {$filler}");
|
||||
|
||||
// Three columns
|
||||
$section = $phpWord->addSection(
|
||||
array(
|
||||
'colsNum' => 3,
|
||||
[
|
||||
'colsNum' => 3,
|
||||
'colsSpace' => 720,
|
||||
'breakType' => 'continuous',
|
||||
)
|
||||
]
|
||||
);
|
||||
$section->addText(htmlspecialchars("Three columns, half inch (720 twips) spacing. {$filler}"));
|
||||
$section->addText("Three columns, half inch (720 twips) spacing. {$filler}");
|
||||
|
||||
// Normal
|
||||
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
||||
$section->addText(htmlspecialchars('Normal paragraph again.'));
|
||||
$section = $phpWord->addSection(['breakType' => 'continuous']);
|
||||
$section->addText("Normal paragraph again. {$filler}");
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\ComplexType\FootnoteProperties;
|
||||
use PhpOffice\PhpWord\SimpleType\NumberFormat;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
@ -6,44 +10,50 @@ echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
\PhpOffice\PhpWord\Settings::setCompatibility(false);
|
||||
|
||||
// Define styles
|
||||
$paragraphStyleName = 'pStyle';
|
||||
$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 100]);
|
||||
|
||||
$boldFontStyleName = 'BoldText';
|
||||
$phpWord->addFontStyle($boldFontStyleName, ['bold' => true]);
|
||||
|
||||
$coloredFontStyleName = 'ColoredText';
|
||||
$phpWord->addFontStyle($coloredFontStyleName, ['color' => 'FF8080', 'bgColor' => 'FFFFCC']);
|
||||
|
||||
$linkFontStyleName = 'NLink';
|
||||
$phpWord->addLinkStyle($linkFontStyleName, ['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]);
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Add style definitions
|
||||
$phpWord->addParagraphStyle('pStyle', array('spacing' => 100));
|
||||
$phpWord->addFontStyle('BoldText', array('bold' => true));
|
||||
$phpWord->addFontStyle('ColoredText', array('color' => 'FF8080'));
|
||||
$phpWord->addLinkStyle(
|
||||
'NLink',
|
||||
array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)
|
||||
);
|
||||
|
||||
// Add text elements
|
||||
$textrun = $section->addTextRun('pStyle');
|
||||
$textrun->addText(htmlspecialchars('This is some lead text in a paragraph with a following footnote. '), 'pStyle');
|
||||
$textrun = $section->addTextRun($paragraphStyleName);
|
||||
$textrun->addText('This is some lead text in a paragraph with a following footnote. ', $paragraphStyleName);
|
||||
|
||||
$footnote = $textrun->addFootnote();
|
||||
$footnote->addText(htmlspecialchars('Just like a textrun, a footnote can contain native texts. '));
|
||||
$footnote->addText(htmlspecialchars('No break is placed after adding an element. '), 'BoldText');
|
||||
$footnote->addText(htmlspecialchars('All elements are placed inside a paragraph. '), 'ColoredText');
|
||||
$footnote->addText('Just like a textrun, a footnote can contain native texts. ');
|
||||
$footnote->addText('No break is placed after adding an element. ', $boldFontStyleName);
|
||||
$footnote->addText('All elements are placed inside a paragraph. ', $coloredFontStyleName);
|
||||
$footnote->addTextBreak();
|
||||
$footnote->addText(htmlspecialchars('But you can insert a manual text break like above, '));
|
||||
$footnote->addText(htmlspecialchars('links like '));
|
||||
$footnote->addLink('http://www.google.com', null, 'NLink');
|
||||
$footnote->addText(htmlspecialchars(', image like '));
|
||||
$footnote->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
|
||||
$footnote->addText(htmlspecialchars(', or object like '));
|
||||
$footnote->addText('But you can insert a manual text break like above, ');
|
||||
$footnote->addText('links like ');
|
||||
$footnote->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub', $linkFontStyleName);
|
||||
$footnote->addText(', image like ');
|
||||
$footnote->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
|
||||
$footnote->addText(', or object like ');
|
||||
$footnote->addObject('resources/_sheet.xls');
|
||||
$footnote->addText(htmlspecialchars('But you can only put footnote in section, not in header or footer.'));
|
||||
$footnote->addText('But you can only put footnote in section, not in header or footer.');
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'You can also create the footnote directly from the section making it wrap in a paragraph '
|
||||
. 'like the footnote below this paragraph. But is is best used from within a textrun.'
|
||||
)
|
||||
'You can also create the footnote directly from the section making it wrap in a paragraph '
|
||||
. 'like the footnote below this paragraph. But is best used from within a textrun.'
|
||||
);
|
||||
$footnote = $section->addFootnote();
|
||||
$footnote->addText(htmlspecialchars('The reference for this is wrapped in its own line'));
|
||||
$footnote->addText('The reference for this is wrapped in its own line');
|
||||
|
||||
$footnoteProperties = new FootnoteProperties();
|
||||
$footnoteProperties->setNumFmt(NumberFormat::DECIMAL_ENCLOSED_CIRCLE);
|
||||
$section->setFootnoteProperties($footnoteProperties);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,62 +1,87 @@
|
||||
<?php
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Template processor instance creation
|
||||
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
|
||||
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
|
||||
|
||||
// Variables on different parts of document
|
||||
$templateProcessor->setValue('weekday', htmlspecialchars(date('l'))); // On section/content
|
||||
$templateProcessor->setValue('time', htmlspecialchars(date('H:i'))); // On footer
|
||||
$templateProcessor->setValue('serverName', htmlspecialchars(realpath(__DIR__))); // On header
|
||||
|
||||
// Simple table
|
||||
$templateProcessor->cloneRow('rowValue', 10);
|
||||
|
||||
$templateProcessor->setValue('rowValue#1', htmlspecialchars('Sun'));
|
||||
$templateProcessor->setValue('rowValue#2', htmlspecialchars('Mercury'));
|
||||
$templateProcessor->setValue('rowValue#3', htmlspecialchars('Venus'));
|
||||
$templateProcessor->setValue('rowValue#4', htmlspecialchars('Earth'));
|
||||
$templateProcessor->setValue('rowValue#5', htmlspecialchars('Mars'));
|
||||
$templateProcessor->setValue('rowValue#6', htmlspecialchars('Jupiter'));
|
||||
$templateProcessor->setValue('rowValue#7', htmlspecialchars('Saturn'));
|
||||
$templateProcessor->setValue('rowValue#8', htmlspecialchars('Uranus'));
|
||||
$templateProcessor->setValue('rowValue#9', htmlspecialchars('Neptun'));
|
||||
$templateProcessor->setValue('rowValue#10', htmlspecialchars('Pluto'));
|
||||
|
||||
$templateProcessor->setValue('rowNumber#1', htmlspecialchars('1'));
|
||||
$templateProcessor->setValue('rowNumber#2', htmlspecialchars('2'));
|
||||
$templateProcessor->setValue('rowNumber#3', htmlspecialchars('3'));
|
||||
$templateProcessor->setValue('rowNumber#4', htmlspecialchars('4'));
|
||||
$templateProcessor->setValue('rowNumber#5', htmlspecialchars('5'));
|
||||
$templateProcessor->setValue('rowNumber#6', htmlspecialchars('6'));
|
||||
$templateProcessor->setValue('rowNumber#7', htmlspecialchars('7'));
|
||||
$templateProcessor->setValue('rowNumber#8', htmlspecialchars('8'));
|
||||
$templateProcessor->setValue('rowNumber#9', htmlspecialchars('9'));
|
||||
$templateProcessor->setValue('rowNumber#10', htmlspecialchars('10'));
|
||||
|
||||
// Table with a spanned cell
|
||||
$templateProcessor->cloneRow('userId', 3);
|
||||
|
||||
$templateProcessor->setValue('userId#1', htmlspecialchars('1'));
|
||||
$templateProcessor->setValue('userFirstName#1', htmlspecialchars('James'));
|
||||
$templateProcessor->setValue('userName#1', htmlspecialchars('Taylor'));
|
||||
$templateProcessor->setValue('userPhone#1', htmlspecialchars('+1 428 889 773'));
|
||||
|
||||
$templateProcessor->setValue('userId#2', htmlspecialchars('2'));
|
||||
$templateProcessor->setValue('userFirstName#2', htmlspecialchars('Robert'));
|
||||
$templateProcessor->setValue('userName#2', htmlspecialchars('Bell'));
|
||||
$templateProcessor->setValue('userPhone#2', htmlspecialchars('+1 428 889 774'));
|
||||
|
||||
$templateProcessor->setValue('userId#3', htmlspecialchars('3'));
|
||||
$templateProcessor->setValue('userFirstName#3', htmlspecialchars('Michael'));
|
||||
$templateProcessor->setValue('userName#3', htmlspecialchars('Ray'));
|
||||
$templateProcessor->setValue('userPhone#3', htmlspecialchars('+1 428 889 775'));
|
||||
|
||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');
|
||||
|
||||
echo getEndingNotes(array('Word2007' => 'docx'));
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Template processor instance creation
|
||||
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
|
||||
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_07_TemplateCloneRow.docx');
|
||||
|
||||
// Variables on different parts of document
|
||||
$templateProcessor->setValue('weekday', date('l')); // On section/content
|
||||
$templateProcessor->setValue('time', date('H:i')); // On footer
|
||||
$templateProcessor->setValue('serverName', realpath(__DIR__)); // On header
|
||||
|
||||
// Simple table
|
||||
$templateProcessor->cloneRow('rowValue', 10);
|
||||
|
||||
$templateProcessor->setValue('rowValue#1', 'Sun');
|
||||
$templateProcessor->setValue('rowValue#2', 'Mercury');
|
||||
$templateProcessor->setValue('rowValue#3', 'Venus');
|
||||
$templateProcessor->setValue('rowValue#4', 'Earth');
|
||||
$templateProcessor->setValue('rowValue#5', 'Mars');
|
||||
$templateProcessor->setValue('rowValue#6', 'Jupiter');
|
||||
$templateProcessor->setValue('rowValue#7', 'Saturn');
|
||||
$templateProcessor->setValue('rowValue#8', 'Uranus');
|
||||
$templateProcessor->setValue('rowValue#9', 'Neptun');
|
||||
$templateProcessor->setValue('rowValue#10', 'Pluto');
|
||||
|
||||
$templateProcessor->setValue('rowNumber#1', '1');
|
||||
$templateProcessor->setValue('rowNumber#2', '2');
|
||||
$templateProcessor->setValue('rowNumber#3', '3');
|
||||
$templateProcessor->setValue('rowNumber#4', '4');
|
||||
$templateProcessor->setValue('rowNumber#5', '5');
|
||||
$templateProcessor->setValue('rowNumber#6', '6');
|
||||
$templateProcessor->setValue('rowNumber#7', '7');
|
||||
$templateProcessor->setValue('rowNumber#8', '8');
|
||||
$templateProcessor->setValue('rowNumber#9', '9');
|
||||
$templateProcessor->setValue('rowNumber#10', '10');
|
||||
|
||||
// Table with a spanned cell
|
||||
$values = [
|
||||
[
|
||||
'userId' => 1,
|
||||
'userFirstName' => 'James',
|
||||
'userName' => 'Taylor',
|
||||
'userPhone' => '+1 428 889 773',
|
||||
],
|
||||
[
|
||||
'userId' => 2,
|
||||
'userFirstName' => 'Robert',
|
||||
'userName' => 'Bell',
|
||||
'userPhone' => '+1 428 889 774',
|
||||
],
|
||||
[
|
||||
'userId' => 3,
|
||||
'userFirstName' => 'Michael',
|
||||
'userName' => 'Ray',
|
||||
'userPhone' => '+1 428 889 775',
|
||||
],
|
||||
];
|
||||
|
||||
$templateProcessor->cloneRowAndSetValues('userId', $values);
|
||||
|
||||
//this is equivalent to cloning and settings values with cloneRowAndSetValues
|
||||
// $templateProcessor->cloneRow('userId', 3);
|
||||
|
||||
// $templateProcessor->setValue('userId#1', '1');
|
||||
// $templateProcessor->setValue('userFirstName#1', 'James');
|
||||
// $templateProcessor->setValue('userName#1', 'Taylor');
|
||||
// $templateProcessor->setValue('userPhone#1', '+1 428 889 773');
|
||||
|
||||
// $templateProcessor->setValue('userId#2', '2');
|
||||
// $templateProcessor->setValue('userFirstName#2', 'Robert');
|
||||
// $templateProcessor->setValue('userName#2', 'Bell');
|
||||
// $templateProcessor->setValue('userPhone#2', '+1 428 889 774');
|
||||
|
||||
// $templateProcessor->setValue('userId#3', '3');
|
||||
// $templateProcessor->setValue('userFirstName#3', 'Michael');
|
||||
// $templateProcessor->setValue('userName#3', 'Ray');
|
||||
// $templateProcessor->setValue('userPhone#3', '+1 428 889 775');
|
||||
|
||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_07_TemplateCloneRow.docx');
|
||||
|
||||
echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_07_TemplateCloneRow.docx');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
||||
@ -1,75 +1,66 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->setDefaultParagraphStyle(
|
||||
array(
|
||||
'align' => 'both',
|
||||
[
|
||||
'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::BOTH,
|
||||
'spaceAfter' => \PhpOffice\PhpWord\Shared\Converter::pointToTwip(12),
|
||||
'spacing' => 120,
|
||||
)
|
||||
'spacing' => 120,
|
||||
]
|
||||
);
|
||||
|
||||
// Sample
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'Below are the samples on how to control your paragraph '
|
||||
. 'pagination. See "Line and Page Break" tab on paragraph properties '
|
||||
. 'window to see the attribute set by these controls.'
|
||||
),
|
||||
array('bold' => true),
|
||||
array('space' => array('before' => 360, 'after' => 480))
|
||||
'Below are the samples on how to control your paragraph '
|
||||
. 'pagination. See "Line and Page Break" tab on paragraph properties '
|
||||
. 'window to see the attribute set by these controls.',
|
||||
['bold' => true],
|
||||
['space' => ['before' => 360, 'after' => 480]]
|
||||
);
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'Paragraph with widowControl = false (default: true). '
|
||||
. 'A "widow" is the last line of a paragraph printed by itself at the top '
|
||||
. 'of a page. An "orphan" is the first line of a paragraph printed by '
|
||||
. 'itself at the bottom of a page. Set this option to "false" if you want '
|
||||
. 'to disable this automatic control.'
|
||||
),
|
||||
'Paragraph with widowControl = false (default: true). '
|
||||
. 'A "widow" is the last line of a paragraph printed by itself at the top '
|
||||
. 'of a page. An "orphan" is the first line of a paragraph printed by '
|
||||
. 'itself at the bottom of a page. Set this option to "false" if you want '
|
||||
. 'to disable this automatic control.',
|
||||
null,
|
||||
array('widowControl' => false, 'indentation' => array('left' => 240, 'right' => 120))
|
||||
['widowControl' => false, 'indentation' => ['left' => 240, 'right' => 120]]
|
||||
);
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'Paragraph with keepNext = true (default: false). '
|
||||
. '"Keep with next" is used to prevent Word from inserting automatic page '
|
||||
. 'breaks between paragraphs. Set this option to "true" if you do not want '
|
||||
. 'your paragraph to be separated with the next paragraph.'
|
||||
),
|
||||
'Paragraph with keepNext = true (default: false). '
|
||||
. '"Keep with next" is used to prevent Word from inserting automatic page '
|
||||
. 'breaks between paragraphs. Set this option to "true" if you do not want '
|
||||
. 'your paragraph to be separated with the next paragraph.',
|
||||
null,
|
||||
array('keepNext' => true, 'indentation' => array('firstLine' => 240))
|
||||
['keepNext' => true, 'indentation' => ['firstLine' => 240]]
|
||||
);
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'Paragraph with keepLines = true (default: false). '
|
||||
. '"Keep lines together" will prevent Word from inserting an automatic page '
|
||||
. 'break within a paragraph. Set this option to "true" if you do not want '
|
||||
. 'all lines of your paragraph to be in the same page.'
|
||||
),
|
||||
'Paragraph with keepLines = true (default: false). '
|
||||
. '"Keep lines together" will prevent Word from inserting an automatic page '
|
||||
. 'break within a paragraph. Set this option to "true" if you do not want '
|
||||
. 'all lines of your paragraph to be in the same page.',
|
||||
null,
|
||||
array('keepLines' => true, 'indentation' => array('left' => 240, 'hanging' => 240))
|
||||
['keepLines' => true, 'indentation' => ['left' => 240, 'hanging' => 240]]
|
||||
);
|
||||
|
||||
$section->addText(htmlspecialchars('Keep scrolling. More below.'));
|
||||
$section->addText('Keep scrolling. More below.');
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'Paragraph with pageBreakBefore = true (default: false). '
|
||||
. 'Different with all other control above, "page break before" separates '
|
||||
. 'your paragraph into the next page. This option is most useful for '
|
||||
. 'heading styles.'
|
||||
),
|
||||
'Paragraph with pageBreakBefore = true (default: false). '
|
||||
. 'Different with all other control above, "page break before" separates '
|
||||
. 'your paragraph into the next page. This option is most useful for '
|
||||
. 'heading styles.',
|
||||
null,
|
||||
array('pageBreakBefore' => true)
|
||||
['pageBreakBefore' => true]
|
||||
);
|
||||
|
||||
// Save file
|
||||
|
||||
@ -1,99 +1,156 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Shared\Converter;
|
||||
use PhpOffice\PhpWord\Style\TablePosition;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$header = array('size' => 16, 'bold' => true);
|
||||
$header = ['size' => 16, 'bold' => true];
|
||||
|
||||
// 1. Basic table
|
||||
|
||||
$rows = 10;
|
||||
$cols = 5;
|
||||
$section->addText(htmlspecialchars('Basic table'), $header);
|
||||
$section->addText('Basic table', $header);
|
||||
|
||||
$table = $section->addTable();
|
||||
for ($r = 1; $r <= 8; $r++) {
|
||||
for ($r = 1; $r <= $rows; ++$r) {
|
||||
$table->addRow();
|
||||
for ($c = 1; $c <= 5; $c++) {
|
||||
$table->addCell(1750)->addText(htmlspecialchars("Row {$r}, Cell {$c}"));
|
||||
for ($c = 1; $c <= $cols; ++$c) {
|
||||
$table->addCell(1750)->addText("Row {$r}, Cell {$c}");
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Advanced table
|
||||
|
||||
$section->addTextBreak(1);
|
||||
$section->addText(htmlspecialchars('Fancy table'), $header);
|
||||
$section->addText('Fancy table', $header);
|
||||
|
||||
$styleTable = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80);
|
||||
$styleFirstRow = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF');
|
||||
$styleCell = array('valign' => 'center');
|
||||
$styleCellBTLR = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR);
|
||||
$fontStyle = array('bold' => true, 'align' => 'center');
|
||||
$phpWord->addTableStyle('Fancy Table', $styleTable, $styleFirstRow);
|
||||
$table = $section->addTable('Fancy Table');
|
||||
$fancyTableStyleName = 'Fancy Table';
|
||||
$fancyTableStyle = ['borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER, 'cellSpacing' => 50];
|
||||
$fancyTableFirstRowStyle = ['borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'];
|
||||
$fancyTableCellStyle = ['valign' => 'center'];
|
||||
$fancyTableCellBtlrStyle = ['valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR];
|
||||
$fancyTableFontStyle = ['bold' => true];
|
||||
$phpWord->addTableStyle($fancyTableStyleName, $fancyTableStyle, $fancyTableFirstRowStyle);
|
||||
$table = $section->addTable($fancyTableStyleName);
|
||||
$table->addRow(900);
|
||||
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 1'), $fontStyle);
|
||||
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 2'), $fontStyle);
|
||||
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 3'), $fontStyle);
|
||||
$table->addCell(2000, $styleCell)->addText(htmlspecialchars('Row 4'), $fontStyle);
|
||||
$table->addCell(500, $styleCellBTLR)->addText(htmlspecialchars('Row 5'), $fontStyle);
|
||||
for ($i = 1; $i <= 8; $i++) {
|
||||
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 1', $fancyTableFontStyle);
|
||||
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 2', $fancyTableFontStyle);
|
||||
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 3', $fancyTableFontStyle);
|
||||
$table->addCell(2000, $fancyTableCellStyle)->addText('Row 4', $fancyTableFontStyle);
|
||||
$table->addCell(500, $fancyTableCellBtlrStyle)->addText('Row 5', $fancyTableFontStyle);
|
||||
for ($i = 1; $i <= 8; ++$i) {
|
||||
$table->addRow();
|
||||
$table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
|
||||
$table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
|
||||
$table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
|
||||
$table->addCell(2000)->addText(htmlspecialchars("Cell {$i}"));
|
||||
$text = (0== $i % 2) ? 'X' : '';
|
||||
$table->addCell(500)->addText(htmlspecialchars($text));
|
||||
$table->addCell(2000)->addText("Cell {$i}");
|
||||
$table->addCell(2000)->addText("Cell {$i}");
|
||||
$table->addCell(2000)->addText("Cell {$i}");
|
||||
$table->addCell(2000)->addText("Cell {$i}");
|
||||
$text = (0 == $i % 2) ? 'X' : '';
|
||||
$table->addCell(500)->addText($text);
|
||||
}
|
||||
|
||||
// 3. colspan (gridSpan) and rowspan (vMerge)
|
||||
/*
|
||||
* 3. colspan (gridSpan) and rowspan (vMerge)
|
||||
* ---------------------
|
||||
* | | B | |
|
||||
* | A |--------| E |
|
||||
* | | C | D | |
|
||||
* ---------------------
|
||||
*/
|
||||
|
||||
$section->addPageBreak();
|
||||
$section->addText(htmlspecialchars('Table with colspan and rowspan'), $header);
|
||||
$section->addText('Table with colspan and rowspan', $header);
|
||||
|
||||
$styleTable = array('borderSize' => 6, 'borderColor' => '999999');
|
||||
$cellRowSpan = array('vMerge' => 'restart', 'valign' => 'center', 'bgColor' => 'FFFF00');
|
||||
$cellRowContinue = array('vMerge' => 'continue');
|
||||
$cellColSpan = array('gridSpan' => 2, 'valign' => 'center');
|
||||
$cellHCentered = array('align' => 'center');
|
||||
$cellVCentered = array('valign' => 'center');
|
||||
$fancyTableStyle = ['borderSize' => 6, 'borderColor' => '999999'];
|
||||
$cellRowSpan = ['vMerge' => 'restart', 'valign' => 'center', 'bgColor' => 'FFFF00'];
|
||||
$cellRowContinue = ['vMerge' => 'continue'];
|
||||
$cellColSpan = ['gridSpan' => 2, 'valign' => 'center'];
|
||||
$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER];
|
||||
$cellVCentered = ['valign' => 'center'];
|
||||
|
||||
$phpWord->addTableStyle('Colspan Rowspan', $styleTable);
|
||||
$table = $section->addTable('Colspan Rowspan');
|
||||
$spanTableStyleName = 'Colspan Rowspan';
|
||||
$phpWord->addTableStyle($spanTableStyleName, $fancyTableStyle);
|
||||
$table = $section->addTable($spanTableStyleName);
|
||||
|
||||
$table->addRow();
|
||||
|
||||
$cell1 = $table->addCell(2000, $cellRowSpan);
|
||||
$textrun1 = $cell1->addTextRun($cellHCentered);
|
||||
$textrun1->addText(htmlspecialchars('A'));
|
||||
$textrun1->addFootnote()->addText(htmlspecialchars('Row span'));
|
||||
$textrun1->addText('A');
|
||||
$textrun1->addFootnote()->addText('Row span');
|
||||
|
||||
$cell2 = $table->addCell(4000, $cellColSpan);
|
||||
$textrun2 = $cell2->addTextRun($cellHCentered);
|
||||
$textrun2->addText(htmlspecialchars('B'));
|
||||
$textrun2->addFootnote()->addText(htmlspecialchars('Colspan span'));
|
||||
$textrun2->addText('B');
|
||||
$textrun2->addFootnote()->addText('Column span');
|
||||
|
||||
$table->addCell(2000, $cellRowSpan)->addText(htmlspecialchars('E'), null, $cellHCentered);
|
||||
$table->addCell(2000, $cellRowSpan)->addText('E', null, $cellHCentered);
|
||||
|
||||
$table->addRow();
|
||||
$table->addCell(null, $cellRowContinue);
|
||||
$table->addCell(2000, $cellVCentered)->addText(htmlspecialchars('C'), null, $cellHCentered);
|
||||
$table->addCell(2000, $cellVCentered)->addText(htmlspecialchars('D'), null, $cellHCentered);
|
||||
$table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered);
|
||||
$table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered);
|
||||
$table->addCell(null, $cellRowContinue);
|
||||
|
||||
// 4. Nested table
|
||||
/*
|
||||
* 4. colspan (gridSpan) and rowspan (vMerge)
|
||||
* ---------------------
|
||||
* | | B | 1 |
|
||||
* | A | |----|
|
||||
* | | | 2 |
|
||||
* | |---|----|----|
|
||||
* | | C | D | 3 |
|
||||
* ---------------------
|
||||
* @see https://github.com/PHPOffice/PHPWord/issues/806
|
||||
*/
|
||||
|
||||
$section->addPageBreak();
|
||||
$section->addText('Table with colspan and rowspan', $header);
|
||||
|
||||
$styleTable = ['borderSize' => 6, 'borderColor' => '999999'];
|
||||
$phpWord->addTableStyle('Colspan Rowspan', $styleTable);
|
||||
$table = $section->addTable('Colspan Rowspan');
|
||||
|
||||
$row = $table->addRow();
|
||||
$row->addCell(1000, ['vMerge' => 'restart'])->addText('A');
|
||||
$row->addCell(1000, ['gridSpan' => 2, 'vMerge' => 'restart'])->addText('B');
|
||||
$row->addCell(1000)->addText('1');
|
||||
|
||||
$row = $table->addRow();
|
||||
$row->addCell(1000, ['vMerge' => 'continue']);
|
||||
$row->addCell(1000, ['vMerge' => 'continue', 'gridSpan' => 2]);
|
||||
$row->addCell(1000)->addText('2');
|
||||
|
||||
$row = $table->addRow();
|
||||
$row->addCell(1000, ['vMerge' => 'continue']);
|
||||
$row->addCell(1000)->addText('C');
|
||||
$row->addCell(1000)->addText('D');
|
||||
$row->addCell(1000)->addText('3');
|
||||
|
||||
// 5. Nested table
|
||||
|
||||
$section->addTextBreak(2);
|
||||
$section->addText(htmlspecialchars('Nested table in a centered and 50% width table.'), $header);
|
||||
$section->addText('Nested table in a centered and 50% width table.', $header);
|
||||
|
||||
$table = $section->addTable(array('width' => 50 * 50, 'unit' => 'pct', 'align' => 'center'));
|
||||
$table = $section->addTable(['width' => 50 * 50, 'unit' => 'pct', 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER]);
|
||||
$cell = $table->addRow()->addCell();
|
||||
$cell->addText(htmlspecialchars('This cell contains nested table.'));
|
||||
$innerCell = $cell->addTable(array('align' => 'center'))->addRow()->addCell();
|
||||
$innerCell->addText(htmlspecialchars('Inside nested table'));
|
||||
$cell->addText('This cell contains nested table.');
|
||||
$innerCell = $cell->addTable(['alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER])->addRow()->addCell();
|
||||
$innerCell->addText('Inside nested table');
|
||||
|
||||
// 6. Table with floating position
|
||||
|
||||
$section->addTextBreak(2);
|
||||
$section->addText('Table with floating positioning.', $header);
|
||||
|
||||
$table = $section->addTable(['borderSize' => 6, 'borderColor' => '999999', 'position' => ['vertAnchor' => TablePosition::VANCHOR_TEXT, 'bottomFromText' => Converter::cmToTwip(1)]]);
|
||||
$cell = $table->addRow()->addCell();
|
||||
$cell->addText('This is a single cell.');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$header = array('size' => 16, 'bold' => true);
|
||||
$header = ['size' => 16, 'bold' => true];
|
||||
//1.Use EastAisa FontStyle
|
||||
$section->addText(htmlspecialchars('中文楷体样式测试'), array('name' => '楷体', 'size' => 16, 'color' => '1B2232'));
|
||||
$section->addText('中文楷体样式测试', ['name' => '楷体', 'size' => 16, 'color' => '1B2232', 'lang' => ['latin' => 'en-US', 'eastAsia' => 'zh-CN']]);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Read contents
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Read contents
|
||||
@ -7,13 +8,8 @@ $source = "resources/{$name}.doc";
|
||||
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
|
||||
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'MsDoc');
|
||||
|
||||
// (Re)write contents
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
||||
include_once 'Sample_Footer.php';
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
@ -15,50 +16,47 @@ $table = $header->addTable();
|
||||
$table->addRow();
|
||||
$cell = $table->addCell(4500);
|
||||
$textrun = $cell->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('This is the header with '));
|
||||
$textrun->addLink('http://google.com', htmlspecialchars('link to Google'));
|
||||
$table->addCell(4500)->addImage(
|
||||
'resources/PhpWord.png',
|
||||
array('width' => 80, 'height' => 80, 'align' => 'right')
|
||||
);
|
||||
$textrun->addText('This is the header with ');
|
||||
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
|
||||
$table->addCell(4500)->addImage('resources/PhpWord.png', ['width' => 80, 'height' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]);
|
||||
|
||||
// Add header for all other pages
|
||||
$subsequent = $section->addHeader();
|
||||
$subsequent->addText(htmlspecialchars('Subsequent pages in Section 1 will Have this!'));
|
||||
$subsequent->addImage('resources/_mars.jpg', array('width' => 80, 'height' => 80));
|
||||
$subsequent->addText('Subsequent pages in Section 1 will Have this!');
|
||||
$subsequent->addImage('resources/_mars.jpg', ['width' => 80, 'height' => 80]);
|
||||
|
||||
// Add footer
|
||||
$footer = $section->addFooter();
|
||||
$footer->addPreserveText(htmlspecialchars('Page {PAGE} of {NUMPAGES}.'), null, array('align' => 'center'));
|
||||
$footer->addLink('http://google.com', htmlspecialchars('Direct Google'));
|
||||
$footer->addPreserveText('Page {PAGE} of {NUMPAGES}.', null, ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
|
||||
$footer->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
|
||||
|
||||
// Write some text
|
||||
$section->addTextBreak();
|
||||
$section->addText(htmlspecialchars('Some text...'));
|
||||
$section->addText('Some text...');
|
||||
|
||||
// Create a second page
|
||||
$section->addPageBreak();
|
||||
|
||||
// Write some text
|
||||
$section->addTextBreak();
|
||||
$section->addText(htmlspecialchars('Some text...'));
|
||||
$section->addText('Some text...');
|
||||
|
||||
// Create a third page
|
||||
$section->addPageBreak();
|
||||
|
||||
// Write some text
|
||||
$section->addTextBreak();
|
||||
$section->addText(htmlspecialchars('Some text...'));
|
||||
$section->addText('Some text...');
|
||||
|
||||
// New portrait section
|
||||
$section2 = $phpWord->addSection();
|
||||
|
||||
$sec2Header = $section2->addHeader();
|
||||
$sec2Header->addText(htmlspecialchars('All pages in Section 2 will Have this!'));
|
||||
$sec2Header->addText('All pages in Section 2 will Have this!');
|
||||
|
||||
// Write some text
|
||||
$section2->addTextBreak();
|
||||
$section2->addText(htmlspecialchars('Some text...'));
|
||||
$section2->addText('Some text...');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Element\Section;
|
||||
use PhpOffice\PhpWord\Shared\Converter;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
@ -7,73 +11,90 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText(htmlspecialchars('Local image without any styles:'));
|
||||
$section->addText('Local image without any styles:');
|
||||
$section->addImage('resources/_mars.jpg');
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addText(htmlspecialchars('Local image with styles:'));
|
||||
$section->addImage('resources/_earth.jpg', array('width' => 210, 'height' => 210, 'align' => 'center'));
|
||||
$section->addTextBreak(2);
|
||||
printSeparator($section);
|
||||
$section->addText('Local image with styles:');
|
||||
$section->addImage('resources/_earth.jpg', ['width' => 210, 'height' => 210, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
|
||||
|
||||
// Remote image
|
||||
printSeparator($section);
|
||||
$source = 'http://php.net/images/logos/php-med-trans-light.gif';
|
||||
$section->addText(htmlspecialchars("Remote image from: {$source}"));
|
||||
$section->addText("Remote image from: {$source}");
|
||||
$section->addImage($source);
|
||||
|
||||
// Image from string
|
||||
printSeparator($section);
|
||||
$source = 'resources/_mars.jpg';
|
||||
$fileContent = file_get_contents($source);
|
||||
$section->addText('Image from string');
|
||||
$section->addImage($fileContent);
|
||||
|
||||
//Wrapping style
|
||||
$text = str_repeat('Hello World! ', 15);
|
||||
$wrappingStyles = array('inline', 'behind', 'infront', 'square', 'tight');
|
||||
printSeparator($section);
|
||||
$text = str_repeat('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ', 2);
|
||||
$wrappingStyles = ['inline', 'behind', 'infront', 'square', 'tight'];
|
||||
foreach ($wrappingStyles as $wrappingStyle) {
|
||||
$section->addTextBreak(5);
|
||||
$section->addText(htmlspecialchars("Wrapping style {$wrappingStyle}"));
|
||||
$section->addText("Wrapping style {$wrappingStyle}");
|
||||
$section->addImage(
|
||||
'resources/_earth.jpg',
|
||||
array(
|
||||
'positioning' => 'relative',
|
||||
'marginTop' => -1,
|
||||
'marginLeft' => 1,
|
||||
'width' => 80,
|
||||
'height' => 80,
|
||||
[
|
||||
'positioning' => 'relative',
|
||||
'marginTop' => -1,
|
||||
'marginLeft' => 1,
|
||||
'width' => 80,
|
||||
'height' => 80,
|
||||
'wrappingStyle' => $wrappingStyle,
|
||||
)
|
||||
'wrapDistanceRight' => Converter::cmToPoint(1),
|
||||
'wrapDistanceBottom' => Converter::cmToPoint(1),
|
||||
]
|
||||
);
|
||||
$section->addText(htmlspecialchars($text));
|
||||
$section->addText($text);
|
||||
printSeparator($section);
|
||||
}
|
||||
|
||||
//Absolute positioning
|
||||
$section->addTextBreak(3);
|
||||
$section->addText(htmlspecialchars('Absolute positioning: see top right corner of page'));
|
||||
$section->addText('Absolute positioning: see top right corner of page');
|
||||
$section->addImage(
|
||||
'resources/_mars.jpg',
|
||||
array(
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
|
||||
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_RIGHT,
|
||||
[
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_ABSOLUTE,
|
||||
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_RIGHT,
|
||||
'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE,
|
||||
'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE,
|
||||
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15.5),
|
||||
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1.55),
|
||||
)
|
||||
'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_PAGE,
|
||||
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15.5),
|
||||
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1.55),
|
||||
]
|
||||
);
|
||||
|
||||
//Relative positioning
|
||||
$section->addTextBreak(3);
|
||||
$section->addText(htmlspecialchars('Relative positioning: Horizontal position center relative to column,'));
|
||||
$section->addText(htmlspecialchars('Vertical position top relative to line'));
|
||||
printSeparator($section);
|
||||
$section->addText('Relative positioning: Horizontal position center relative to column,');
|
||||
$section->addText('Vertical position top relative to line');
|
||||
$section->addImage(
|
||||
'resources/_mars.jpg',
|
||||
array(
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE,
|
||||
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER,
|
||||
[
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(3),
|
||||
'positioning' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE,
|
||||
'posHorizontal' => \PhpOffice\PhpWord\Style\Image::POSITION_HORIZONTAL_CENTER,
|
||||
'posHorizontalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_COLUMN,
|
||||
'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP,
|
||||
'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_LINE,
|
||||
)
|
||||
'posVertical' => \PhpOffice\PhpWord\Style\Image::POSITION_VERTICAL_TOP,
|
||||
'posVerticalRel' => \PhpOffice\PhpWord\Style\Image::POSITION_RELATIVE_TO_LINE,
|
||||
]
|
||||
);
|
||||
|
||||
function printSeparator(Section $section): void
|
||||
{
|
||||
$section->addTextBreak();
|
||||
$lineStyle = ['weight' => 0.2, 'width' => 150, 'height' => 0, 'align' => 'center'];
|
||||
$section->addLine($lineStyle);
|
||||
$section->addTextBreak(2);
|
||||
}
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
|
||||
@ -1,92 +1,99 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
// Define styles
|
||||
$fontStyleName = 'myOwnStyle';
|
||||
$phpWord->addFontStyle($fontStyleName, ['color' => 'FF0000']);
|
||||
|
||||
$paragraphStyleName = 'P-Style';
|
||||
$phpWord->addParagraphStyle($paragraphStyleName, ['spaceAfter' => 95]);
|
||||
|
||||
$multilevelNumberingStyleName = 'multilevel';
|
||||
$phpWord->addNumberingStyle(
|
||||
$multilevelNumberingStyleName,
|
||||
[
|
||||
'type' => 'multilevel',
|
||||
'levels' => [
|
||||
['format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360],
|
||||
['format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$predefinedMultilevelStyle = ['listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED];
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Style definition
|
||||
|
||||
$phpWord->addFontStyle('myOwnStyle', array('color' => 'FF0000'));
|
||||
$phpWord->addParagraphStyle('P-Style', array('spaceAfter' => 95));
|
||||
$phpWord->addNumberingStyle(
|
||||
'multilevel',
|
||||
array(
|
||||
'type' => 'multilevel',
|
||||
'levels' => array(
|
||||
array('format' => 'decimal', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360),
|
||||
array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720),
|
||||
),
|
||||
)
|
||||
);
|
||||
$predefinedMultilevel = array('listType' => \PhpOffice\PhpWord\Style\ListItem::TYPE_NUMBER_NESTED);
|
||||
|
||||
// Lists
|
||||
|
||||
$section->addText(htmlspecialchars('Multilevel list.'));
|
||||
$section->addListItem(htmlspecialchars('List Item I'), 0, null, 'multilevel');
|
||||
$section->addListItem(htmlspecialchars('List Item I.a'), 1, null, 'multilevel');
|
||||
$section->addListItem(htmlspecialchars('List Item I.b'), 1, null, 'multilevel');
|
||||
$section->addListItem(htmlspecialchars('List Item II'), 0, null, 'multilevel');
|
||||
$section->addListItem(htmlspecialchars('List Item II.a'), 1, null, 'multilevel');
|
||||
$section->addListItem(htmlspecialchars('List Item III'), 0, null, 'multilevel');
|
||||
$section->addText('Multilevel list.');
|
||||
$section->addListItem('List Item I', 0, null, $multilevelNumberingStyleName);
|
||||
$section->addListItem('List Item I.a', 1, null, $multilevelNumberingStyleName);
|
||||
$section->addListItem('List Item I.b', 1, null, $multilevelNumberingStyleName);
|
||||
$section->addListItem('List Item II', 0, null, $multilevelNumberingStyleName);
|
||||
$section->addListItem('List Item II.a', 1, null, $multilevelNumberingStyleName);
|
||||
$section->addListItem('List Item III', 0, null, $multilevelNumberingStyleName);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addText(htmlspecialchars('Basic simple bulleted list.'));
|
||||
$section->addListItem(htmlspecialchars('List Item 1'));
|
||||
$section->addListItem(htmlspecialchars('List Item 2'));
|
||||
$section->addListItem(htmlspecialchars('List Item 3'));
|
||||
$section->addText('Basic simple bulleted list.');
|
||||
$section->addListItem('List Item 1');
|
||||
$section->addListItem('List Item 2');
|
||||
$section->addListItem('List Item 3');
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addText(htmlspecialchars('Continue from multilevel list above.'));
|
||||
$section->addListItem(htmlspecialchars('List Item IV'), 0, null, 'multilevel');
|
||||
$section->addListItem(htmlspecialchars('List Item IV.a'), 1, null, 'multilevel');
|
||||
$section->addText('Continue from multilevel list above.');
|
||||
$section->addListItem('List Item IV', 0, null, $multilevelNumberingStyleName);
|
||||
$section->addListItem('List Item IV.a', 1, null, $multilevelNumberingStyleName);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addText(htmlspecialchars('Multilevel predefined list.'));
|
||||
$section->addListItem(htmlspecialchars('List Item 1'), 0, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addListItem(htmlspecialchars('List Item 2'), 0, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addListItem(htmlspecialchars('List Item 3'), 1, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addListItem(htmlspecialchars('List Item 4'), 1, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addListItem(htmlspecialchars('List Item 5'), 2, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addListItem(htmlspecialchars('List Item 6'), 1, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addListItem(htmlspecialchars('List Item 7'), 0, 'myOwnStyle', $predefinedMultilevel, 'P-Style');
|
||||
$section->addText('Multilevel predefined list.');
|
||||
$section->addListItem('List Item 1', 0, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addListItem('List Item 2', 0, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addListItem('List Item 3', 1, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addListItem('List Item 4', 1, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addListItem('List Item 5', 2, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addListItem('List Item 6', 1, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addListItem('List Item 7', 0, $fontStyleName, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addText(htmlspecialchars('List with inline formatting.'));
|
||||
$section->addText('List with inline formatting.');
|
||||
$listItemRun = $section->addListItemRun();
|
||||
$listItemRun->addText(htmlspecialchars('List item 1'));
|
||||
$listItemRun->addText(htmlspecialchars(' in bold'), array('bold' => true));
|
||||
$listItemRun->addText('List item 1');
|
||||
$listItemRun->addText(' in bold', ['bold' => true]);
|
||||
$listItemRun = $section->addListItemRun(1, $predefinedMultilevelStyle, $paragraphStyleName);
|
||||
$listItemRun->addText('List item 2');
|
||||
$listItemRun->addText(' in italic', ['italic' => true]);
|
||||
$footnote = $listItemRun->addFootnote();
|
||||
$footnote->addText('this is a footnote on a list item');
|
||||
$listItemRun = $section->addListItemRun();
|
||||
$listItemRun->addText(htmlspecialchars('List item 2'));
|
||||
$listItemRun->addText(htmlspecialchars(' in italic'), array('italic' => true));
|
||||
$listItemRun = $section->addListItemRun();
|
||||
$listItemRun->addText(htmlspecialchars('List item 3'));
|
||||
$listItemRun->addText(htmlspecialchars(' underlined'), array('underline' => 'dash'));
|
||||
$listItemRun->addText('List item 3');
|
||||
$listItemRun->addText(' underlined', ['underline' => 'dash']);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Numbered heading
|
||||
|
||||
$headingNumberingStyleName = 'headingNumbering';
|
||||
$phpWord->addNumberingStyle(
|
||||
'headingNumbering',
|
||||
array('type' => 'multilevel',
|
||||
'levels' => array(
|
||||
array('pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'),
|
||||
array('pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'),
|
||||
array('pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'),
|
||||
),
|
||||
)
|
||||
$headingNumberingStyleName,
|
||||
['type' => 'multilevel',
|
||||
'levels' => [
|
||||
['pStyle' => 'Heading1', 'format' => 'decimal', 'text' => '%1'],
|
||||
['pStyle' => 'Heading2', 'format' => 'decimal', 'text' => '%1.%2'],
|
||||
['pStyle' => 'Heading3', 'format' => 'decimal', 'text' => '%1.%2.%3'],
|
||||
],
|
||||
]
|
||||
);
|
||||
$phpWord->addTitleStyle(1, array('size' => 16), array('numStyle' => 'headingNumbering', 'numLevel' => 0));
|
||||
$phpWord->addTitleStyle(2, array('size' => 14), array('numStyle' => 'headingNumbering', 'numLevel' => 1));
|
||||
$phpWord->addTitleStyle(3, array('size' => 12), array('numStyle' => 'headingNumbering', 'numLevel' => 2));
|
||||
$phpWord->addTitleStyle(1, ['size' => 16], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 0]);
|
||||
$phpWord->addTitleStyle(2, ['size' => 14], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 1]);
|
||||
$phpWord->addTitleStyle(3, ['size' => 12], ['numStyle' => $headingNumberingStyleName, 'numLevel' => 2]);
|
||||
|
||||
$section->addTitle(htmlspecialchars('Heading 1'), 1);
|
||||
$section->addTitle(htmlspecialchars('Heading 2'), 2);
|
||||
$section->addTitle(htmlspecialchars('Heading 3'), 3);
|
||||
$section->addTitle('Heading 1', 1);
|
||||
$section->addTitle('Heading 2', 2);
|
||||
$section->addTitle('Heading 3', 3);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,24 +1,27 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
// Define styles
|
||||
$linkFontStyleName = 'myOwnLinStyle';
|
||||
$phpWord->addLinkStyle($linkFontStyleName, ['bold' => true, 'color' => '808000']);
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Add hyperlink elements
|
||||
$section->addLink(
|
||||
'http://www.google.com',
|
||||
htmlspecialchars('Best search engine'),
|
||||
array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)
|
||||
'https://github.com/PHPOffice/PHPWord',
|
||||
'PHPWord on GitHub',
|
||||
['color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE]
|
||||
);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$phpWord->addLinkStyle('myOwnLinkStyle', array('bold' => true, 'color' => '808000'));
|
||||
$section->addLink('http://www.bing.com', null, 'myOwnLinkStyle');
|
||||
$section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
|
||||
$section->addLink('http://www.bing.com', null, $linkFontStyleName);
|
||||
$section->addLink('http://www.yahoo.com', null, $linkFontStyleName);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
@ -7,9 +8,9 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText(htmlspecialchars('You can open this OLE object by double clicking on the icon:'));
|
||||
$section->addText('You can open this OLE object by double clicking on the icon:');
|
||||
$section->addTextBreak(2);
|
||||
$section->addObject('resources/_sheet.xls');
|
||||
$section->addOLEObject('resources/_sheet.xls');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,70 +1,70 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->getSettings()->setUpdateFields(true);
|
||||
|
||||
// Begin code
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Define the TOC font style
|
||||
$fontStyle = array('spaceAfter' => 60, 'size' => 12);
|
||||
$fontStyle2 = array('size' => 10);
|
||||
|
||||
// Add title styles
|
||||
$phpWord->addTitleStyle(1, array('size' => 20, 'color' => '333333', 'bold' => true));
|
||||
$phpWord->addTitleStyle(2, array('size' => 16, 'color' => '666666'));
|
||||
$phpWord->addTitleStyle(3, array('size' => 14, 'italic' => true));
|
||||
$phpWord->addTitleStyle(4, array('size' => 12));
|
||||
// Define styles
|
||||
$fontStyle12 = ['spaceAfter' => 60, 'size' => 12];
|
||||
$fontStyle10 = ['size' => 10];
|
||||
$phpWord->addTitleStyle(null, ['size' => 22, 'bold' => true]);
|
||||
$phpWord->addTitleStyle(1, ['size' => 20, 'color' => '333333', 'bold' => true]);
|
||||
$phpWord->addTitleStyle(2, ['size' => 16, 'color' => '666666']);
|
||||
$phpWord->addTitleStyle(3, ['size' => 14, 'italic' => true]);
|
||||
$phpWord->addTitleStyle(4, ['size' => 12]);
|
||||
|
||||
// Add text elements
|
||||
$section->addText(htmlspecialchars('Table of contents 1'));
|
||||
$section->addTitle('Table of contents 1', 0);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Add TOC #1
|
||||
$toc = $section->addTOC($fontStyle);
|
||||
$toc = $section->addTOC($fontStyle12);
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Filler
|
||||
$section->addText(htmlspecialchars('Text between TOC'));
|
||||
$section->addText('Text between TOC');
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Add TOC #1
|
||||
$section->addText(htmlspecialchars('Table of contents 2'));
|
||||
$section->addText('Table of contents 2');
|
||||
$section->addTextBreak(2);
|
||||
$toc2 = $section->addTOC($fontStyle2);
|
||||
$toc2 = $section->addTOC($fontStyle10);
|
||||
$toc2->setMinDepth(2);
|
||||
$toc2->setMaxDepth(3);
|
||||
|
||||
|
||||
// Add Titles
|
||||
$section->addPageBreak();
|
||||
$section->addTitle(htmlspecialchars('Foo & Bar'), 1);
|
||||
$section->addText(htmlspecialchars('Some text...'));
|
||||
$section->addTitle('Foo n Bar', 1);
|
||||
$section->addText('Some text...');
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addTitle(htmlspecialchars('I am a Subtitle of Title 1'), 2);
|
||||
$section->addTitle('I am a Subtitle of Title 1', 2);
|
||||
$section->addTextBreak(2);
|
||||
$section->addText(htmlspecialchars('Some more text...'));
|
||||
$section->addText('Some more text...');
|
||||
$section->addTextBreak(2);
|
||||
|
||||
$section->addTitle(htmlspecialchars('Another Title (Title 2)'), 1);
|
||||
$section->addText(htmlspecialchars('Some text...'));
|
||||
$section->addTitle('Another Title (Title 2)', 1);
|
||||
$section->addText('Some text...');
|
||||
$section->addPageBreak();
|
||||
$section->addTitle(htmlspecialchars('I am Title 3'), 1);
|
||||
$section->addText(htmlspecialchars('And more text...'));
|
||||
$section->addTitle('I am Title 3', 1);
|
||||
$section->addText('And more text...');
|
||||
$section->addTextBreak(2);
|
||||
$section->addTitle(htmlspecialchars('I am a Subtitle of Title 3'), 2);
|
||||
$section->addText(htmlspecialchars('Again and again, more text...'));
|
||||
$section->addTitle(htmlspecialchars('Subtitle 3.1.1'), 3);
|
||||
$section->addText(htmlspecialchars('Text'));
|
||||
$section->addTitle(htmlspecialchars('Subtitle 3.1.1.1'), 4);
|
||||
$section->addText(htmlspecialchars('Text'));
|
||||
$section->addTitle(htmlspecialchars('Subtitle 3.1.1.2'), 4);
|
||||
$section->addText(htmlspecialchars('Text'));
|
||||
$section->addTitle(htmlspecialchars('Subtitle 3.1.2'), 3);
|
||||
$section->addText(htmlspecialchars('Text'));
|
||||
$section->addTitle('I am a Subtitle of Title 3', 2);
|
||||
$section->addText('Again and again, more text...');
|
||||
$section->addTitle('Subtitle 3.1.1', 3);
|
||||
$section->addText('Text');
|
||||
$section->addTitle('Subtitle 3.1.1.1', 4);
|
||||
$section->addText('Text');
|
||||
$section->addTitle('Subtitle 3.1.1.2', 4);
|
||||
$section->addText('Text');
|
||||
$section->addTitle('Subtitle 3.1.2', 3);
|
||||
$section->addText('Text');
|
||||
|
||||
echo date('H:i:s'), ' Note: Please refresh TOC manually.', EOL;
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
@ -6,11 +7,10 @@ echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
$header = $section->addHeader();
|
||||
$header->addWatermark('resources/_earth.jpg', array('marginTop' => 200, 'marginLeft' => 55));
|
||||
$section->addText(htmlspecialchars('The header reference to the current section includes a watermark image.'));
|
||||
$header->addWatermark('resources/_earth.jpg', ['marginTop' => 200, 'marginLeft' => 55]);
|
||||
$section->addText('The header reference to the current section includes a watermark image.');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,29 +1,36 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
$fontStyle = array('size' => 24);
|
||||
$paragraphStyle = array('spacing' => 240, 'size' => 24);
|
||||
$phpWord->addFontStyle('fontStyle', array('size' => 9));
|
||||
$phpWord->addParagraphStyle('paragraphStyle', array('spacing' => 480));
|
||||
$fontStyle = array('size' => 24);
|
||||
// Define styles
|
||||
$fontStyle24 = ['size' => 24];
|
||||
|
||||
$paragraphStyle24 = ['spacing' => 240, 'size' => 24];
|
||||
|
||||
$fontStyleName = 'fontStyle';
|
||||
$phpWord->addFontStyle($fontStyleName, ['size' => 9]);
|
||||
|
||||
$paragraphStyleName = 'paragraphStyle';
|
||||
$phpWord->addParagraphStyle($paragraphStyleName, ['spacing' => 480]);
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText(htmlspecialchars('Text break with no style:'));
|
||||
|
||||
$section->addText('Text break with no style:');
|
||||
$section->addTextBreak();
|
||||
$section->addText(htmlspecialchars('Text break with defined font style:'));
|
||||
$section->addTextBreak(1, 'fontStyle');
|
||||
$section->addText(htmlspecialchars('Text break with defined paragraph style:'));
|
||||
$section->addTextBreak(1, null, 'paragraphStyle');
|
||||
$section->addText(htmlspecialchars('Text break with inline font style:'));
|
||||
$section->addTextBreak(1, $fontStyle);
|
||||
$section->addText(htmlspecialchars('Text break with inline paragraph style:'));
|
||||
$section->addTextBreak(1, null, $paragraphStyle);
|
||||
$section->addText(htmlspecialchars('Done.'));
|
||||
$section->addText('Text break with defined font style:');
|
||||
$section->addTextBreak(1, $fontStyleName);
|
||||
$section->addText('Text break with defined paragraph style:');
|
||||
$section->addTextBreak(1, null, $paragraphStyleName);
|
||||
$section->addText('Text break with inline font style:');
|
||||
$section->addTextBreak(1, $fontStyle24);
|
||||
$section->addText('Text break with inline paragraph style:');
|
||||
$section->addTextBreak(1, null, $paragraphStyle24);
|
||||
$section->addText('Done.');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
$section->addText(
|
||||
htmlspecialchars('This is some text highlighted using fgColor (limited to 15 colors) '),
|
||||
array('fgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW)
|
||||
'This is some text highlighted using fgColor (limited to 15 colors)',
|
||||
['fgColor' => \PhpOffice\PhpWord\Style\Font::FGCOLOR_YELLOW]
|
||||
);
|
||||
$section->addText(
|
||||
htmlspecialchars('This one uses bgColor and is using hex value (0xfbbb10)'),
|
||||
array('bgColor' => 'fbbb10')
|
||||
);
|
||||
$section->addText(htmlspecialchars('Compatible with font colors'), array('color' => '0000ff', 'bgColor' => 'fbbb10'));
|
||||
$section->addText('This one uses bgColor and is using hex value (0xfbbb10)', ['bgColor' => 'fbbb10']);
|
||||
$section->addText('Compatible with font colors', ['color' => '0000ff', 'bgColor' => 'fbbb10']);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,51 +1,44 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
$section->addText(htmlspecialchars('By default, when you insert an image, it adds a textbreak after its content.'));
|
||||
$section->addText('By default, when you insert an image, it adds a textbreak after its content.');
|
||||
$section->addText('If we want a simple border around an image, we wrap the image inside a table->row->cell');
|
||||
$section->addText(
|
||||
htmlspecialchars('If we want a simple border around an image, we wrap the image inside a table->row->cell')
|
||||
);
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
'On the image with the red border, even if we set the row height to the height of the image, '
|
||||
. 'the textbreak is still there:'
|
||||
)
|
||||
'On the image with the red border, even if we set the row height to the height of the image, '
|
||||
. 'the textbreak is still there:'
|
||||
);
|
||||
|
||||
$table1 = $section->addTable(array('cellMargin' => 0, 'cellMarginRight' => 0, 'cellMarginBottom' => 0, 'cellMarginLeft' => 0));
|
||||
$table1 = $section->addTable(['cellMargin' => 0, 'cellMarginRight' => 0, 'cellMarginBottom' => 0, 'cellMarginLeft' => 0]);
|
||||
$table1->addRow(3750);
|
||||
$cell1 = $table1->addCell(null, array('valign' => 'top', 'borderSize' => 30, 'borderColor' => 'ff0000'));
|
||||
$cell1->addImage('./resources/_earth.jpg', array('width' => 250, 'height' => 250, 'align' => 'center'));
|
||||
$cell1 = $table1->addCell(null, ['valign' => 'top', 'borderSize' => 30, 'borderColor' => 'ff0000']);
|
||||
$cell1->addImage('./resources/_earth.jpg', ['width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
|
||||
|
||||
$section->addTextBreak();
|
||||
$section->addText(
|
||||
htmlspecialchars(
|
||||
"But if we set the rowStyle 'exactHeight' to true, the real row height is used, removing the textbreak:"
|
||||
)
|
||||
);
|
||||
$section->addText("But if we set the rowStyle 'exactHeight' to true, the real row height is used, removing the textbreak:");
|
||||
|
||||
$table2 = $section->addTable(
|
||||
array(
|
||||
'cellMargin' => 0,
|
||||
'cellMarginRight' => 0,
|
||||
[
|
||||
'cellMargin' => 0,
|
||||
'cellMarginRight' => 0,
|
||||
'cellMarginBottom' => 0,
|
||||
'cellMarginLeft' => 0,
|
||||
)
|
||||
'cellMarginLeft' => 0,
|
||||
]
|
||||
);
|
||||
$table2->addRow(3750, array('exactHeight' => true));
|
||||
$cell2 = $table2->addCell(null, array('valign' => 'top', 'borderSize' => 30, 'borderColor' => '00ff00'));
|
||||
$cell2->addImage('./resources/_earth.jpg', array('width' => 250, 'height' => 250, 'align' => 'center'));
|
||||
$table2->addRow(3750, ['exactHeight' => true]);
|
||||
$cell2 = $table2->addCell(null, ['valign' => 'top', 'borderSize' => 30, 'borderColor' => '00ff00']);
|
||||
$cell2->addImage('./resources/_earth.jpg', ['width' => 250, 'height' => 250, 'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
|
||||
|
||||
$section->addTextBreak();
|
||||
$section->addText(
|
||||
htmlspecialchars('In this example, image is 250px height. Rows are calculated in twips, and 1px = 15twips.')
|
||||
);
|
||||
$section->addText(htmlspecialchars('So: $' . "table2->addRow(3750, array('exactHeight'=>true));"));
|
||||
$section->addText('In this example, image is 250px height. Rows are calculated in twips, and 1px = 15twips.');
|
||||
$section->addText('So: $' . "table2->addRow(3750, array('exactHeight'=>true));");
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText(htmlspecialchars('Check box in section'));
|
||||
$section->addCheckBox('chkBox1', htmlspecialchars('Checkbox 1'));
|
||||
$section->addText(htmlspecialchars('Check box in table cell'));
|
||||
|
||||
$section->addText('Check box in section');
|
||||
$section->addCheckBox('chkBox1', 'Checkbox 1');
|
||||
$section->addText('Check box in table cell');
|
||||
$table = $section->addTable();
|
||||
$table->addRow();
|
||||
$cell = $table->addCell();
|
||||
$cell->addCheckBox('chkBox2', htmlspecialchars('Checkbox 2'));
|
||||
$cell->addCheckBox('chkBox2', 'Checkbox 2');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Template processor instance creation
|
||||
@ -14,7 +15,7 @@ $templateProcessor->deleteBlock('DELETEME');
|
||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
|
||||
|
||||
echo getEndingNotes(array('Word2007' => 'docx'));
|
||||
echo getEndingNotes(['Word2007' => 'docx'], 'Sample_23_TemplateBlock');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Read contents
|
||||
|
||||
@ -1,44 +1,46 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// In section
|
||||
$textbox = $section->addTextBox(
|
||||
array(
|
||||
'align' => 'center',
|
||||
'width' => 400,
|
||||
'height' => 150,
|
||||
'borderSize' => 1,
|
||||
[
|
||||
'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER,
|
||||
'width' => 400,
|
||||
'height' => 150,
|
||||
'borderSize' => 1,
|
||||
'borderColor' => '#FF0000',
|
||||
)
|
||||
]
|
||||
);
|
||||
$textbox->addText(htmlspecialchars('Text box content in section.'));
|
||||
$textbox->addText(htmlspecialchars('Another line.'));
|
||||
$textbox->addText('Text box content in section.');
|
||||
$textbox->addText('Another line.');
|
||||
$cell = $textbox->addTable()->addRow()->addCell();
|
||||
$cell->addText(htmlspecialchars('Table inside textbox'));
|
||||
$cell->addText('Table inside textbox');
|
||||
|
||||
// Inside table
|
||||
$section->addTextBreak(2);
|
||||
$cell = $section->addTable()->addRow()->addCell(300);
|
||||
$textbox = $cell->addTextBox(array('borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100));
|
||||
$textbox->addText(htmlspecialchars('Textbox inside table'));
|
||||
$textbox = $cell->addTextBox(['borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100]);
|
||||
$textbox->addText('Textbox inside table');
|
||||
|
||||
// Inside header with textrun
|
||||
$header = $section->addHeader();
|
||||
$textbox = $header->addTextBox(array('width' => 600, 'borderSize' => 1, 'borderColor' => '#00FF00'));
|
||||
$textbox = $header->addTextBox(['width' => 600, 'borderSize' => 1, 'borderColor' => '#00FF00']);
|
||||
$textrun = $textbox->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('TextBox in header. TextBox can contain a TextRun '));
|
||||
$textrun->addText(htmlspecialchars('with bold text'), array('bold' => true));
|
||||
$textrun->addText(htmlspecialchars(', '));
|
||||
$textrun->addLink('http://www.google.com', htmlspecialchars('link'));
|
||||
$textrun->addText(htmlspecialchars(', and image '));
|
||||
$textrun->addImage('resources/_earth.jpg', array('width' => 18, 'height' => 18));
|
||||
$textrun->addText(htmlspecialchars('.'));
|
||||
$textrun->addText('TextBox in header. TextBox can contain a TextRun ');
|
||||
$textrun->addText('with bold text', ['bold' => true]);
|
||||
$textrun->addText(', ');
|
||||
$textrun->addLink('https://github.com/PHPOffice/PHPWord', 'PHPWord on GitHub');
|
||||
$textrun->addText(', and image ');
|
||||
$textrun->addImage('resources/_earth.jpg', ['width' => 18, 'height' => 18]);
|
||||
$textrun->addText('.');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,20 +1,99 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->addParagraphStyle('Heading2', ['alignment' => 'center']);
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
$html = '<h1>Adding element via HTML</h1>';
|
||||
$html .= '<p>Some well formed HTML snippet needs to be used</p>';
|
||||
$html .= '<p>Some well-formed HTML snippet needs to be used</p>';
|
||||
$html .= '<p>With for example <strong>some<sup>1</sup> <em>inline</em> formatting</strong><sub>1</sub></p>';
|
||||
$html .= '<p>Unordered (bulleted) list:</p>';
|
||||
$html .= '<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>';
|
||||
$html .= '<p>Ordered (numbered) list:</p>';
|
||||
$html .= '<ol><li>Item 1</li><li>Item 2</li></ol>';
|
||||
|
||||
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html);
|
||||
$html .= '<p>A link to <a href="http://phpword.readthedocs.io/" style="text-decoration: underline">Read the docs</a></p>';
|
||||
|
||||
$html .= '<p lang="he-IL" style="text-align: right; direction: rtl">היי, זה פסקה מימין לשמאל</p>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">Unordered (bulleted) list:</p>';
|
||||
$html .= '<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">1.5 line height with first line text indent:</p>';
|
||||
$html .= '<p style="text-align: justify; text-indent: 70.9pt; line-height: 150%;">Lorem ipsum dolor sit amet, <strong>consectetur adipiscing elit</strong>, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>';
|
||||
|
||||
$html .= '<h2 style="align: center">centered title</h2>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">Ordered (numbered) list:</p>';
|
||||
$html .= '<ol>
|
||||
<li><p style="font-weight: bold;">List 1 item 1</p></li>
|
||||
<li>List 1 item 2</li>
|
||||
<ol>
|
||||
<li>sub list 1</li>
|
||||
<li>sub list 2</li>
|
||||
</ol>
|
||||
<li>List 1 item 3</li>
|
||||
</ol>
|
||||
<p style="margin-top: 15px;">A second list, numbering should restart</p>
|
||||
<ol>
|
||||
<li>List 2 item 1</li>
|
||||
<li>List 2 item 2</li>
|
||||
<li>
|
||||
<ol>
|
||||
<li>sub list 1</li>
|
||||
<li>sub list 2</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>List 2 item 3</li>
|
||||
<ol>
|
||||
<li>sub list 1, restarts with a</li>
|
||||
<li>sub list 2</li>
|
||||
</ol>
|
||||
</ol>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">List with formatted content:</p>';
|
||||
$html .= '<ul>
|
||||
<li>
|
||||
<span style="font-family: arial,helvetica,sans-serif;">
|
||||
<span style="font-size: 16px;">big list item1</span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span style="font-family: arial,helvetica,sans-serif;">
|
||||
<span style="font-size: 10px; font-weight: bold;">list item2 in bold</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">A table with formatting:</p>';
|
||||
$html .= '<table align="center" style="width: 50%; border: 6px #0000FF double;">
|
||||
<thead>
|
||||
<tr style="background-color: #FF0000; text-align: center; color: #FFFFFF; font-weight: bold; ">
|
||||
<th style="width: 50pt">header a</th>
|
||||
<th style="width: 50">header b</th>
|
||||
<th style="background-color: #FFFF00; border-width: 12px"><span style="background-color: #00FF00;">header c</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td style="border-style: dotted; border-color: #FF0000">1</td><td colspan="2">2</td></tr>
|
||||
<tr><td>This is <b>bold</b> text</td><td></td><td>6</td></tr>
|
||||
</tbody>
|
||||
</table>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">Table inside another table:</p>';
|
||||
$html .= '<table align="center" style="width: 80%; border: 6px #0000FF double;">
|
||||
<tr><td>
|
||||
<table style="width: 100%; border: 4px #FF0000 dotted;">
|
||||
<tr><td>column 1</td><td>column 2</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
<tr><td style="text-align: center;">Cell in parent table</td></tr>
|
||||
</table>';
|
||||
|
||||
$html .= '<p style="margin-top: 240pt;">The text below is not visible, click on show/hide to reveil it:</p>';
|
||||
$html .= '<p style="display: none">This is hidden text</p>';
|
||||
|
||||
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,28 +1,68 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Element\TextRun;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
PhpOffice\PhpWord\Style::addTitleStyle(1, ['size' => 14]);
|
||||
|
||||
// Begin code
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
$section->addTitle('This page demos fields');
|
||||
|
||||
// Add Field elements
|
||||
// See Element/Field.php for all options
|
||||
$section->addText(htmlspecialchars('Date field:'));
|
||||
$section->addField('DATE', array('dateformat' => 'dddd d MMMM yyyy H:mm:ss'), array('PreserveFormat'));
|
||||
$section->addText('Date field:');
|
||||
$section->addField('DATE', ['dateformat' => 'dddd d MMMM yyyy H:mm:ss'], ['PreserveFormat']);
|
||||
|
||||
$section->addText(htmlspecialchars('Page field:'));
|
||||
$section->addField('PAGE', array('format' => 'ArabicDash'));
|
||||
$section->addText('Style Ref field:');
|
||||
$section->addField('STYLEREF', ['StyleIdentifier' => 'Heading 1']);
|
||||
|
||||
$section->addText(htmlspecialchars('Number of pages field:'));
|
||||
$section->addField('NUMPAGES', array('format' => 'Arabic', 'numformat' => '0,00'), array('PreserveFormat'));
|
||||
$section->addText('Page field:');
|
||||
$section->addField('PAGE', ['format' => 'Arabic']);
|
||||
|
||||
$textrun = $section->addTextRun(array('align' => 'center'));
|
||||
$textrun->addText(htmlspecialchars('This is the date of lunar calendar '));
|
||||
$textrun->addField('DATE', array('dateformat' => 'd-M-yyyy H:mm:ss'), array('PreserveFormat', 'LunarCalendar'));
|
||||
$textrun->addText(htmlspecialchars(' written in a textrun.'));
|
||||
$section->addText('Number of pages field:');
|
||||
$section->addField('NUMPAGES', ['numformat' => '0,00', 'format' => 'Arabic'], ['PreserveFormat']);
|
||||
$section->addTextBreak();
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('An index field is ');
|
||||
$textrun->addField('XE', [], ['Italic'], 'My first index');
|
||||
$textrun->addText('here:');
|
||||
|
||||
$indexEntryText = new TextRun();
|
||||
$indexEntryText->addText('My ');
|
||||
$indexEntryText->addText('bold index', ['bold' => true]);
|
||||
$indexEntryText->addText(' entry');
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('A complex index field is ');
|
||||
$textrun->addField('XE', [], ['Bold'], $indexEntryText);
|
||||
$textrun->addText('here:');
|
||||
|
||||
$section->addText('The actual index:');
|
||||
$section->addField('INDEX', [], ['\\e " "'], 'right click to update the index');
|
||||
|
||||
$textrun = $section->addTextRun(['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER]);
|
||||
$textrun->addText('This is the date of lunar calendar ');
|
||||
$textrun->addField('DATE', ['dateformat' => 'd-M-yyyy H:mm:ss'], ['PreserveFormat', 'LunarCalendar']);
|
||||
$textrun->addText(' written in a textrun.');
|
||||
$section->addTextBreak();
|
||||
|
||||
$macroText = new TextRun();
|
||||
$macroText->addText('Double click', ['bold' => true]);
|
||||
$macroText->addText(' to ');
|
||||
$macroText->addText('zoom to 100%', ['italic' => true]);
|
||||
|
||||
$section->addText('A macro button with styled text:');
|
||||
$section->addField('MACROBUTTON', ['macroname' => 'Zoom100'], [], $macroText);
|
||||
$section->addTextBreak();
|
||||
|
||||
$section->addText('A macro button with simple text:');
|
||||
$section->addField('MACROBUTTON', ['macroname' => 'Zoom100'], [], 'double click to zoom');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Read contents
|
||||
|
||||
@ -1,60 +1,61 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Add Line elements
|
||||
// See Element/Line.php for all options
|
||||
$section->addText(htmlspecialchars('Horizontal Line (Inline style):'));
|
||||
$section->addText('Horizontal Line (Inline style):');
|
||||
$section->addLine(
|
||||
array(
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
|
||||
[
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
|
||||
'positioning' => 'absolute',
|
||||
)
|
||||
]
|
||||
);
|
||||
$section->addText(htmlspecialchars('Vertical Line (Inline style):'));
|
||||
$section->addText('Vertical Line (Inline style):');
|
||||
$section->addLine(
|
||||
array(
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1),
|
||||
[
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1),
|
||||
'positioning' => 'absolute',
|
||||
)
|
||||
]
|
||||
);
|
||||
// Two text break
|
||||
$section->addTextBreak(1);
|
||||
|
||||
$section->addText(htmlspecialchars('Positioned Line (red):'));
|
||||
$section->addText('Positioned Line (red):');
|
||||
$section->addLine(
|
||||
array(
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1),
|
||||
'positioning' => 'absolute',
|
||||
[
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(4),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(1),
|
||||
'positioning' => 'absolute',
|
||||
'posHorizontalRel' => 'page',
|
||||
'posVerticalRel' => 'page',
|
||||
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(10),
|
||||
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(8),
|
||||
'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE,
|
||||
'color' => 'red',
|
||||
)
|
||||
'posVerticalRel' => 'page',
|
||||
'marginLeft' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(10),
|
||||
'marginTop' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(8),
|
||||
'wrappingStyle' => \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE,
|
||||
'color' => 'red',
|
||||
]
|
||||
);
|
||||
|
||||
$section->addText(htmlspecialchars('Horizontal Formatted Line'));
|
||||
$section->addText('Horizontal Formatted Line');
|
||||
$section->addLine(
|
||||
array(
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
|
||||
[
|
||||
'width' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(15),
|
||||
'height' => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(0),
|
||||
'positioning' => 'absolute',
|
||||
'beginArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_BLOCK,
|
||||
'endArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_OVAL,
|
||||
'dash' => \PhpOffice\PhpWord\Style\Line::DASH_STYLE_LONG_DASH_DOT_DOT,
|
||||
'weight' => 10,
|
||||
)
|
||||
'beginArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_BLOCK,
|
||||
'endArrow' => \PhpOffice\PhpWord\Style\Line::ARROW_STYLE_OVAL,
|
||||
'dash' => \PhpOffice\PhpWord\Style\Line::DASH_STYLE_LONG_DASH_DOT_DOT,
|
||||
'weight' => 10,
|
||||
]
|
||||
);
|
||||
|
||||
// Save file
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Read contents
|
||||
|
||||
@ -1,91 +1,94 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->addTitleStyle(1, array('size' => 14, 'bold' => true));
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
// Define styles
|
||||
$phpWord->addTitleStyle(1, ['size' => 14, 'bold' => true]);
|
||||
|
||||
// Arc
|
||||
$section->addTitle(htmlspecialchars('Arc'), 1);
|
||||
$section->addTitle('Arc', 1);
|
||||
$section->addShape(
|
||||
'arc',
|
||||
array(
|
||||
'points' => '-90 20',
|
||||
'frame' => array('width' => 120, 'height' => 120),
|
||||
'outline' => array('color' => '#333333', 'weight' => 2, 'startArrow' => 'oval', 'endArrow' => 'open'),
|
||||
)
|
||||
[
|
||||
'points' => '-90 20',
|
||||
'frame' => ['width' => 120, 'height' => 120],
|
||||
'outline' => ['color' => '#333333', 'weight' => 2, 'startArrow' => 'oval', 'endArrow' => 'open'],
|
||||
]
|
||||
);
|
||||
|
||||
// Curve
|
||||
$section->addTitle(htmlspecialchars('Curve'), 1);
|
||||
$section->addTitle('Curve', 1);
|
||||
$section->addShape(
|
||||
'curve',
|
||||
array(
|
||||
'points' => '1,100 200,1 1,50 200,50',
|
||||
[
|
||||
'points' => '1,100 200,1 1,50 200,50',
|
||||
'connector' => 'elbow',
|
||||
'outline' => array(
|
||||
'color' => '#66cc00',
|
||||
'weight' => 2,
|
||||
'dash' => 'dash',
|
||||
'outline' => [
|
||||
'color' => '#66cc00',
|
||||
'weight' => 2,
|
||||
'dash' => 'dash',
|
||||
'startArrow' => 'diamond',
|
||||
'endArrow' => 'block',
|
||||
),
|
||||
)
|
||||
'endArrow' => 'block',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Line
|
||||
$section->addTitle(htmlspecialchars('Line'), 1);
|
||||
$section->addTitle('Line', 1);
|
||||
$section->addShape(
|
||||
'line',
|
||||
array(
|
||||
'points' => '1,1 150,30',
|
||||
'outline' => array(
|
||||
'color' => '#cc00ff',
|
||||
'line' => 'thickThin',
|
||||
'weight' => 3,
|
||||
[
|
||||
'points' => '1,1 150,30',
|
||||
'outline' => [
|
||||
'color' => '#cc00ff',
|
||||
'line' => 'thickThin',
|
||||
'weight' => 3,
|
||||
'startArrow' => 'oval',
|
||||
'endArrow' => 'classic',
|
||||
),
|
||||
)
|
||||
'endArrow' => 'classic',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
// Polyline
|
||||
$section->addTitle(htmlspecialchars('Polyline'), 1);
|
||||
$section->addTitle('Polyline', 1);
|
||||
$section->addShape(
|
||||
'polyline',
|
||||
array(
|
||||
'points' => '1,30 20,10 55,20 75,10 100,40 115,50, 120,15 200,50',
|
||||
'outline' => array('color' => '#cc6666', 'weight' => 2, 'startArrow' => 'none', 'endArrow' => 'classic'),
|
||||
)
|
||||
[
|
||||
'points' => '1,30 20,10 55,20 75,10 100,40 115,50, 120,15 200,50',
|
||||
'outline' => ['color' => '#cc6666', 'weight' => 2, 'startArrow' => 'none', 'endArrow' => 'classic'],
|
||||
]
|
||||
);
|
||||
|
||||
// Rectangle
|
||||
$section->addTitle(htmlspecialchars('Rectangle'), 1);
|
||||
$section->addTitle('Rectangle', 1);
|
||||
$section->addShape(
|
||||
'rect',
|
||||
array(
|
||||
[
|
||||
'roundness' => 0.2,
|
||||
'frame' => array('width' => 100, 'height' => 100, 'left' => 1, 'top' => 1),
|
||||
'fill' => array('color' => '#FFCC33'),
|
||||
'outline' => array('color' => '#990000', 'weight' => 1),
|
||||
'shadow' => array(),
|
||||
)
|
||||
'frame' => ['width' => 100, 'height' => 100, 'left' => 1, 'top' => 1],
|
||||
'fill' => ['color' => '#FFCC33'],
|
||||
'outline' => ['color' => '#990000', 'weight' => 1],
|
||||
'shadow' => [],
|
||||
]
|
||||
);
|
||||
|
||||
// Oval
|
||||
$section->addTitle(htmlspecialchars('Oval'), 1);
|
||||
$section->addTitle('Oval', 1);
|
||||
$section->addShape(
|
||||
'oval',
|
||||
array(
|
||||
'frame' => array('width' => 100, 'height' => 70, 'left' => 1, 'top' => 1),
|
||||
'fill' => array('color' => '#33CC99'),
|
||||
'outline' => array('color' => '#333333', 'weight' => 2),
|
||||
'extrusion' => array(),
|
||||
)
|
||||
[
|
||||
'frame' => ['width' => 100, 'height' => 70, 'left' => 1, 'top' => 1],
|
||||
'fill' => ['color' => '#33CC99'],
|
||||
'outline' => ['color' => '#333333', 'weight' => 2],
|
||||
'extrusion' => [],
|
||||
]
|
||||
);
|
||||
|
||||
// Save file
|
||||
|
||||
@ -1,32 +1,44 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
use PhpOffice\PhpWord\Shared\Converter;
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->addTitleStyle(1, array('size' => 14, 'bold' => true), array('keepNext' => true, 'spaceBefore' => 240));
|
||||
$phpWord->addTitleStyle(2, array('size' => 14, 'bold' => true), array('keepNext' => true, 'spaceBefore' => 240));
|
||||
|
||||
// Define styles
|
||||
$phpWord->addTitleStyle(1, ['size' => 14, 'bold' => true], ['keepNext' => true, 'spaceBefore' => 240]);
|
||||
$phpWord->addTitleStyle(2, ['size' => 14, 'bold' => true], ['keepNext' => true, 'spaceBefore' => 240]);
|
||||
|
||||
// 2D charts
|
||||
$section = $phpWord->addSection();
|
||||
$section->addTitle(htmlspecialchars('2D charts'), 1);
|
||||
$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous'));
|
||||
$section->addTitle('2D charts', 1);
|
||||
$section = $phpWord->addSection(['colsNum' => 2, 'breakType' => 'continuous']);
|
||||
|
||||
$chartTypes = array('pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar');
|
||||
$twoSeries = array('bar', 'column', 'line', 'area', 'scatter', 'radar');
|
||||
$threeSeries = array('bar', 'line');
|
||||
$categories = array('A', 'B', 'C', 'D', 'E');
|
||||
$series1 = array(1, 3, 2, 5, 4);
|
||||
$series2 = array(3, 1, 7, 2, 6);
|
||||
$series3 = array(8, 3, 2, 5, 4);
|
||||
$chartTypes = ['pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
|
||||
$twoSeries = ['bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
|
||||
$threeSeries = ['bar', 'line'];
|
||||
$categories = ['A', 'B', 'C', 'D', 'E'];
|
||||
$series1 = [1, 3, 2, 5, 4];
|
||||
$series2 = [3, 1, 7, 2, 6];
|
||||
$series3 = [8, 3, 2, 5, 4];
|
||||
$showGridLines = false;
|
||||
$showAxisLabels = false;
|
||||
$showLegend = true;
|
||||
$legendPosition = 't';
|
||||
// r = right, l = left, t = top, b = bottom, tr = top right
|
||||
|
||||
foreach ($chartTypes as $chartType) {
|
||||
$section->addTitle(ucfirst($chartType), 2);
|
||||
$chart = $section->addChart($chartType, $categories, $series1);
|
||||
$chart->getStyle()->setWidth(Converter::inchToEmu(2.5))->setHeight(Converter::inchToEmu(2));
|
||||
$chart->getStyle()->setShowGridX($showGridLines);
|
||||
$chart->getStyle()->setShowGridY($showGridLines);
|
||||
$chart->getStyle()->setShowAxisLabels($showAxisLabels);
|
||||
$chart->getStyle()->setShowLegend($showLegend);
|
||||
$chart->getStyle()->setLegendPosition($legendPosition);
|
||||
if (in_array($chartType, $twoSeries)) {
|
||||
$chart->addSeries($categories, $series2);
|
||||
}
|
||||
@ -37,13 +49,20 @@ foreach ($chartTypes as $chartType) {
|
||||
}
|
||||
|
||||
// 3D charts
|
||||
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
||||
$section->addTitle(htmlspecialchars('3D charts'), 1);
|
||||
$section = $phpWord->addSection(array('colsNum' => 2, 'breakType' => 'continuous'));
|
||||
$section = $phpWord->addSection(['breakType' => 'continuous']);
|
||||
$section->addTitle('3D charts', 1);
|
||||
$section = $phpWord->addSection(['colsNum' => 2, 'breakType' => 'continuous']);
|
||||
|
||||
$chartTypes = array('pie', 'bar', 'column', 'line', 'area');
|
||||
$multiSeries = array('bar', 'column', 'line', 'area');
|
||||
$style = array('width' => Converter::cmToEmu(5), 'height' => Converter::cmToEmu(4), '3d' => true);
|
||||
$chartTypes = ['pie', 'bar', 'column', 'line', 'area'];
|
||||
$multiSeries = ['bar', 'column', 'line', 'area'];
|
||||
$style = [
|
||||
'width' => Converter::cmToEmu(5),
|
||||
'height' => Converter::cmToEmu(4),
|
||||
'3d' => true,
|
||||
'showAxisLabels' => $showAxisLabels,
|
||||
'showGridX' => $showGridLines,
|
||||
'showGridY' => $showGridLines,
|
||||
];
|
||||
foreach ($chartTypes as $chartType) {
|
||||
$section->addTitle(ucfirst($chartType), 2);
|
||||
$chart = $section->addChart($chartType, $categories, $series1, $style);
|
||||
|
||||
@ -1,23 +1,25 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->getProtection()->setEditing('forms');
|
||||
$phpWord->getSettings()->getDocumentProtection()->setEditing('forms');
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('Form fields can be added in a text run and can be in form of textinput '));
|
||||
$textrun->addText('Form fields can be added in a text run and can be in form of textinput ');
|
||||
$textrun->addFormField('textinput')->setName('MyTextBox');
|
||||
$textrun->addText(htmlspecialchars(', checkbox '));
|
||||
$textrun->addText(', checkbox ');
|
||||
$textrun->addFormField('checkbox')->setDefault(true);
|
||||
$textrun->addText(htmlspecialchars(', or dropdown '));
|
||||
$textrun->addFormField('dropdown')->setEntries(array('Choice 1', 'Choice 2', 'Choice 3'));
|
||||
$textrun->addText(htmlspecialchars('. You have to set document protection to "forms" to enable dropdown.'));
|
||||
$textrun->addText(', or dropdown ');
|
||||
$textrun->addFormField('dropdown')->setEntries(['Choice 1', 'Choice 2', 'Choice 3']);
|
||||
$textrun->addText('. You have to set document protection to "forms" to enable dropdown.');
|
||||
|
||||
$section->addText(htmlspecialchars('They can also be added as a stand alone paragraph.'));
|
||||
$section->addText('They can also be added as a stand alone paragraph.');
|
||||
$section->addFormField('textinput')->setValue('Your name');
|
||||
|
||||
// Save file
|
||||
|
||||
@ -1,23 +1,31 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('Combobox: '));
|
||||
$textrun->addSDT('comboBox')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2'));
|
||||
$textrun->addText('Combobox: ');
|
||||
$textrun->addSDT('comboBox')->setListItems(['1' => 'Choice 1', '2' => 'Choice 2']);
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('Date: '));
|
||||
$textrun->addText('Date: ');
|
||||
$textrun->addSDT('date');
|
||||
$textrun->addTextBreak(1);
|
||||
$textrun->addText('Date with pre set value: ');
|
||||
$textrun->addSDT('date')->setValue('03/30/2017');
|
||||
$textrun->addTextBreak(1);
|
||||
$textrun->addText('Date with pre set value: ');
|
||||
$textrun->addSDT('date')->setValue('30.03.2017');
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('Drop down list: '));
|
||||
$textrun->addSDT('dropDownList')->setListItems(array('1' => 'Choice 1', '2' => 'Choice 2'));
|
||||
$textrun->addText('Drop down list: ');
|
||||
$textrun->addSDT('dropDownList')->setListItems(['1' => 'Choice 1', '2' => 'Choice 2'])->setValue('Choice 1');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
@ -6,13 +7,13 @@ echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
$section->addTitle(htmlspecialchars('This is page 1'), 1);
|
||||
$section->addTitle('This is page 1', 1);
|
||||
$linkIsInternal = true;
|
||||
$section->addLink('MyBookmark', htmlspecialchars('Take me to page 3'), null, null, $linkIsInternal);
|
||||
$section->addLink('MyBookmark', 'Take me to page 3', null, null, $linkIsInternal);
|
||||
$section->addPageBreak();
|
||||
$section->addTitle(htmlspecialchars('This is page 2'), 1);
|
||||
$section->addTitle('This is page 2', 1);
|
||||
$section->addPageBreak();
|
||||
$section->addTitle(htmlspecialchars('This is page 3'), 1);
|
||||
$section->addTitle('This is page 3', 1);
|
||||
$section->addBookmark('MyBookmark');
|
||||
|
||||
// Save file
|
||||
|
||||
@ -1,16 +1,42 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText(htmlspecialchars('This is a Left to Right paragraph.'));
|
||||
|
||||
$textrun = $section->addTextRun(array('align' => 'right'));
|
||||
$textrun->addText(htmlspecialchars('سلام این یک پاراگراف راست به چپ است'), array('rtl' => true));
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('This is a Left to Right paragraph.');
|
||||
|
||||
$textrun = $section->addTextRun(['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END]);
|
||||
$textrun->addText('سلام این یک پاراگراف راست به چپ است', ['rtl' => true]);
|
||||
|
||||
$section->addText('Table visually presented as RTL');
|
||||
$style = ['rtl' => true, 'size' => 12];
|
||||
$tableStyle = ['borderSize' => 6, 'borderColor' => '000000', 'width' => 5000, 'unit' => \PhpOffice\PhpWord\SimpleType\TblWidth::PERCENT, 'bidiVisual' => true];
|
||||
|
||||
$table = $section->addTable($tableStyle);
|
||||
$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER];
|
||||
$cellHEnd = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END];
|
||||
$cellVCentered = ['valign' => \PhpOffice\PhpWord\SimpleType\VerticalJc::CENTER];
|
||||
|
||||
//Vidually bidirectinal table
|
||||
$table->addRow();
|
||||
$cell = $table->addCell(500, $cellVCentered);
|
||||
$textrun = $cell->addTextRun($cellHCentered);
|
||||
$textrun->addText('ردیف', $style);
|
||||
|
||||
$cell = $table->addCell(11000);
|
||||
$textrun = $cell->addTextRun($cellHEnd);
|
||||
$textrun->addText('سوالات', $style);
|
||||
|
||||
$cell = $table->addCell(500, $cellVCentered);
|
||||
$textrun = $cell->addTextRun($cellHCentered);
|
||||
$textrun->addText('بارم', $style);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
|
||||
63
samples/Sample_37_Comments.php
Normal file
63
samples/Sample_37_Comments.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// A comment
|
||||
$comment = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
|
||||
$comment->addText('Test', ['bold' => true]);
|
||||
$phpWord->addComment($comment);
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
$textrun = $section->addTextRun();
|
||||
$textrun->addText('This ');
|
||||
$text = $textrun->addText('is');
|
||||
$text->setCommentRangeStart($comment);
|
||||
$textrun->addText(' a test');
|
||||
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Let's create a comment that we will link to a start element and an end element
|
||||
$commentWithStartAndEnd = new \PhpOffice\PhpWord\Element\Comment('Foo Bar', new \DateTime());
|
||||
$commentWithStartAndEnd->addText('A comment with a start and an end');
|
||||
$phpWord->addComment($commentWithStartAndEnd);
|
||||
|
||||
$textrunWithEnd = $section->addTextRun();
|
||||
$textrunWithEnd->addText('This ');
|
||||
$textToStartOn = $textrunWithEnd->addText('is', ['bold' => true]);
|
||||
$textToStartOn->setCommentRangeStart($commentWithStartAndEnd);
|
||||
$textrunWithEnd->addText(' another', ['italic' => true]);
|
||||
$textToEndOn = $textrunWithEnd->addText(' test');
|
||||
$textToEndOn->setCommentRangeEnd($commentWithStartAndEnd);
|
||||
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// Let's add a comment on an image
|
||||
$commentOnImage = new \PhpOffice\PhpWord\Element\Comment('Mr Smart', new \DateTime());
|
||||
$imageComment = $commentOnImage->addTextRun();
|
||||
$imageComment->addText('Hey, Mars does look ');
|
||||
$imageComment->addText('red', ['color' => 'FF0000']);
|
||||
$phpWord->addComment($commentOnImage);
|
||||
$image = $section->addImage('resources/_mars.jpg');
|
||||
$image->setCommentRangeStart($commentOnImage);
|
||||
|
||||
$section->addTextBreak(2);
|
||||
|
||||
// We can also do things the other way round, link the comment to the element
|
||||
$anotherText = $section->addText('another text');
|
||||
|
||||
$comment1 = new \PhpOffice\PhpWord\Element\Comment('Authors name', new \DateTime(), 'my_initials');
|
||||
$comment1->addText('Test', ['bold' => true]);
|
||||
$comment1->setStartElement($anotherText);
|
||||
$comment1->setEndElement($anotherText);
|
||||
$phpWord->addComment($comment1);
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
22
samples/Sample_38_Protection.php
Normal file
22
samples/Sample_38_Protection.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\SimpleType\DocProtect;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
$documentProtection = $phpWord->getSettings()->getDocumentProtection();
|
||||
$documentProtection->setEditing(DocProtect::READ_ONLY);
|
||||
$documentProtection->setPassword('myPassword');
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
$section->addText('this document is password protected');
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
30
samples/Sample_39_TrackChanges.php
Normal file
30
samples/Sample_39_TrackChanges.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Element\TrackChange;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New portrait section
|
||||
$section = $phpWord->addSection();
|
||||
$textRun = $section->addTextRun();
|
||||
|
||||
$text = $textRun->addText('Hello World! Time to ');
|
||||
|
||||
$text = $textRun->addText('wake ', ['bold' => true]);
|
||||
$text->setChangeInfo(TrackChange::INSERTED, 'Fred', time() - 1800);
|
||||
|
||||
$text = $textRun->addText('up');
|
||||
$text->setTrackChange(new TrackChange(TrackChange::INSERTED, 'Fred'));
|
||||
|
||||
$text = $textRun->addText('go to sleep');
|
||||
$text->setChangeInfo(TrackChange::DELETED, 'Barney', new \DateTime('@' . (time() - 3600)));
|
||||
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
46
samples/Sample_40_TemplateSetComplexValue.php
Normal file
46
samples/Sample_40_TemplateSetComplexValue.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Element\Field;
|
||||
use PhpOffice\PhpWord\Element\Table;
|
||||
use PhpOffice\PhpWord\Element\TextRun;
|
||||
use PhpOffice\PhpWord\SimpleType\TblWidth;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Template processor instance creation
|
||||
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
|
||||
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_40_TemplateSetComplexValue.docx');
|
||||
|
||||
$title = new TextRun();
|
||||
$title->addText('This title has been set ', ['bold' => true, 'italic' => true, 'color' => 'blue']);
|
||||
$title->addText('dynamically', ['bold' => true, 'italic' => true, 'color' => 'red', 'underline' => 'single']);
|
||||
$templateProcessor->setComplexBlock('title', $title);
|
||||
|
||||
$inline = new TextRun();
|
||||
$inline->addText('by a red italic text', ['italic' => true, 'color' => 'red']);
|
||||
$templateProcessor->setComplexValue('inline', $inline);
|
||||
|
||||
$table = new Table(['borderSize' => 12, 'borderColor' => 'green', 'width' => 6000, 'unit' => TblWidth::TWIP]);
|
||||
$table->addRow();
|
||||
$table->addCell(150)->addText('Cell A1');
|
||||
$table->addCell(150)->addText('Cell A2');
|
||||
$table->addCell(150)->addText('Cell A3');
|
||||
$table->addRow();
|
||||
$table->addCell(150)->addText('Cell B1');
|
||||
$table->addCell(150)->addText('Cell B2');
|
||||
$table->addCell(150)->addText('Cell B3');
|
||||
$templateProcessor->setComplexBlock('table', $table);
|
||||
|
||||
$field = new Field('DATE', ['dateformat' => 'dddd d MMMM yyyy H:mm:ss'], ['PreserveFormat']);
|
||||
$templateProcessor->setComplexValue('field', $field);
|
||||
|
||||
// $link = new Link('https://github.com/PHPOffice/PHPWord');
|
||||
// $templateProcessor->setComplexValue('link', $link);
|
||||
|
||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_40_TemplateSetComplexValue.docx');
|
||||
|
||||
echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_40_TemplateSetComplexValue.docx');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
46
samples/Sample_41_TemplateSetChart.php
Normal file
46
samples/Sample_41_TemplateSetChart.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpWord\Element\Chart;
|
||||
use PhpOffice\PhpWord\Shared\Converter;
|
||||
|
||||
include_once 'Sample_Header.php';
|
||||
|
||||
// Template processor instance creation
|
||||
echo date('H:i:s'), ' Creating new TemplateProcessor instance...', EOL;
|
||||
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor('resources/Sample_41_TemplateSetChart.docx');
|
||||
|
||||
$chartTypes = ['pie', 'doughnut', 'bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
|
||||
$twoSeries = ['bar', 'column', 'line', 'area', 'scatter', 'radar', 'stacked_bar', 'percent_stacked_bar', 'stacked_column', 'percent_stacked_column'];
|
||||
$threeSeries = ['bar', 'line'];
|
||||
|
||||
$categories = ['A', 'B', 'C', 'D', 'E'];
|
||||
$series1 = [1, 3, 2, 5, 4];
|
||||
$series2 = [3, 1, 7, 2, 6];
|
||||
$series3 = [8, 3, 2, 5, 4];
|
||||
|
||||
$i = 0;
|
||||
foreach ($chartTypes as $chartType) {
|
||||
$chart = new Chart($chartType, $categories, $series1);
|
||||
|
||||
if (in_array($chartType, $twoSeries)) {
|
||||
$chart->addSeries($categories, $series2);
|
||||
}
|
||||
if (in_array($chartType, $threeSeries)) {
|
||||
$chart->addSeries($categories, $series3);
|
||||
}
|
||||
|
||||
$chart->getStyle()
|
||||
->setWidth(Converter::inchToEmu(3))
|
||||
->setHeight(Converter::inchToEmu(3));
|
||||
|
||||
$templateProcessor->setChart("chart{$i}", $chart);
|
||||
++$i;
|
||||
}
|
||||
|
||||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_41_TemplateSetChart.docx');
|
||||
|
||||
echo getEndingNotes(['Word2007' => 'docx'], 'results/Sample_41_TemplateSetChart.docx');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
@ -1,7 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* Footer file
|
||||
*/
|
||||
if (CLI) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,31 +1,34 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../src/PhpWord/Autoloader.php';
|
||||
require_once __DIR__ . '/../bootstrap.php';
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
|
||||
/**
|
||||
* Header file
|
||||
*/
|
||||
use PhpOffice\PhpWord\Autoloader;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
|
||||
date_default_timezone_set('UTC');
|
||||
error_reporting(E_ALL);
|
||||
define('CLI', (PHP_SAPI == 'cli') ? true : false);
|
||||
define('EOL', CLI ? PHP_EOL : '<br />');
|
||||
define('SCRIPT_FILENAME', basename($_SERVER['SCRIPT_FILENAME'], '.php'));
|
||||
define('IS_INDEX', SCRIPT_FILENAME == 'index');
|
||||
|
||||
Autoloader::register();
|
||||
Settings::loadConfig();
|
||||
|
||||
$dompdfPath = $vendorDirPath . '/dompdf/dompdf';
|
||||
if (file_exists($dompdfPath)) {
|
||||
define('DOMPDF_ENABLE_AUTOLOAD', false);
|
||||
Settings::setPdfRenderer(Settings::PDF_RENDERER_DOMPDF, $vendorDirPath . '/dompdf/dompdf');
|
||||
}
|
||||
|
||||
// Set writers
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf');
|
||||
$writers = ['Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf', 'HTML' => 'html', 'PDF' => 'pdf'];
|
||||
|
||||
// Set PDF renderer
|
||||
if (null === Settings::getPdfRendererPath()) {
|
||||
$writers['PDF'] = null;
|
||||
}
|
||||
|
||||
// Turn output escaping on
|
||||
Settings::setOutputEscapingEnabled(true);
|
||||
|
||||
// Return to the caller script when runs by CLI
|
||||
if (CLI) {
|
||||
return;
|
||||
@ -40,17 +43,23 @@ $pageHeading = IS_INDEX ? '' : "<h1>{$pageHeading}</h1>";
|
||||
// Populate samples
|
||||
$files = '';
|
||||
if ($handle = opendir('.')) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
$sampleFiles = [];
|
||||
while (false !== ($sampleFile = readdir($handle))) {
|
||||
$sampleFiles[] = $sampleFile;
|
||||
}
|
||||
sort($sampleFiles);
|
||||
closedir($handle);
|
||||
|
||||
foreach ($sampleFiles as $file) {
|
||||
if (preg_match('/^Sample_\d+_/', $file)) {
|
||||
$name = str_replace('_', ' ', preg_replace('/(Sample_|\.php)/', '', $file));
|
||||
$files .= "<li><a href='{$file}'>{$name}</a></li>";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write documents
|
||||
* Write documents.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
||||
* @param string $filename
|
||||
@ -74,26 +83,27 @@ function write($phpWord, $filename, $writers)
|
||||
$result .= EOL;
|
||||
}
|
||||
|
||||
$result .= getEndingNotes($writers);
|
||||
$result .= getEndingNotes($writers, $filename);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ending notes
|
||||
* Get ending notes.
|
||||
*
|
||||
* @param array $writers
|
||||
* @param mixed $filename
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getEndingNotes($writers)
|
||||
function getEndingNotes($writers, $filename)
|
||||
{
|
||||
$result = '';
|
||||
|
||||
// Do not show execution time for index
|
||||
if (!IS_INDEX) {
|
||||
$result .= date('H:i:s') . " Done writing file(s)" . EOL;
|
||||
$result .= date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" . EOL;
|
||||
$result .= date('H:i:s') . ' Done writing file(s)' . EOL;
|
||||
$result .= date('H:i:s') . ' Peak memory usage: ' . (memory_get_peak_usage(true) / 1024 / 1024) . ' MB' . EOL;
|
||||
}
|
||||
|
||||
// Return
|
||||
@ -105,7 +115,7 @@ function getEndingNotes($writers)
|
||||
$result .= '<p> </p>';
|
||||
$result .= '<p>Results: ';
|
||||
foreach ($types as $type) {
|
||||
if (!is_null($type)) {
|
||||
if (null !== $type) {
|
||||
$resultFile = 'results/' . SCRIPT_FILENAME . '.' . $type;
|
||||
if (file_exists($resultFile)) {
|
||||
$result .= "<a href='{$resultFile}' class='btn btn-primary'>{$type}</a> ";
|
||||
@ -113,6 +123,12 @@ function getEndingNotes($writers)
|
||||
}
|
||||
}
|
||||
$result .= '</p>';
|
||||
|
||||
$result .= '<pre>';
|
||||
if (file_exists($filename . '.php')) {
|
||||
$result .= highlight_file($filename . '.php', true);
|
||||
}
|
||||
$result .= '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,17 +3,17 @@ include_once 'Sample_Header.php';
|
||||
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
|
||||
$requirements = array(
|
||||
'php' => array('PHP 5.3.3', version_compare(PHP_VERSION, '5.3.3', '>=')),
|
||||
'xml' => array('PHP extension XML', extension_loaded('xml')),
|
||||
'temp' => array('Temp folder "<code>' . Settings::getTempDir() . '</code>" is writable', is_writable(Settings::getTempDir())),
|
||||
'zip' => array('PHP extension ZipArchive (optional)', extension_loaded('zip')),
|
||||
'gd' => array('PHP extension GD (optional)', extension_loaded('gd')),
|
||||
'xmlw' => array('PHP extension XMLWriter (optional)', extension_loaded('xmlwriter')),
|
||||
'xsl' => array('PHP extension XSL (optional)', extension_loaded('xsl')),
|
||||
);
|
||||
$requirements = [
|
||||
'php' => ['PHP 7.1', version_compare(PHP_VERSION, '7.1', '>=')],
|
||||
'xml' => ['PHP extension XML', extension_loaded('xml')],
|
||||
'temp' => ['Temp folder "<code>' . Settings::getTempDir() . '</code>" is writable', is_writable(Settings::getTempDir())],
|
||||
'zip' => ['PHP extension ZipArchive (optional)', extension_loaded('zip')],
|
||||
'gd' => ['PHP extension GD (optional)', extension_loaded('gd')],
|
||||
'xmlw' => ['PHP extension XMLWriter (optional)', extension_loaded('xmlwriter')],
|
||||
'xsl' => ['PHP extension XSL (optional)', extension_loaded('xsl')],
|
||||
];
|
||||
if (!CLI) {
|
||||
?>
|
||||
?>
|
||||
<div class="jumbotron">
|
||||
<p>Welcome to PHPWord, a library written in pure PHP that provides a set of classes to write to and read from different document file formats, i.e. Office Open XML (.docx), Open Document Format (.odt), and Rich Text Format (.rtf).</p>
|
||||
<p> </p>
|
||||
@ -22,22 +22,22 @@ if (!CLI) {
|
||||
<a class="btn btn-lg btn-primary" href="http://phpword.readthedocs.org/" role="button"><i class="fa fa-book fa-lg" title="Docs"></i> Read the Docs</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
if (!CLI) {
|
||||
echo "<h3>Requirement check:</h3>";
|
||||
echo "<ul>";
|
||||
echo '<h3>Requirement check:</h3>';
|
||||
echo '<ul>';
|
||||
foreach ($requirements as $key => $value) {
|
||||
list($label, $result) = $value;
|
||||
[$label, $result] = $value;
|
||||
$status = $result ? 'passed' : 'failed';
|
||||
echo "<li>{$label} ... <span class='{$status}'>{$status}</span></li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
echo '</ul>';
|
||||
include_once 'Sample_Footer.php';
|
||||
} else {
|
||||
echo 'Requirement check:' . PHP_EOL;
|
||||
foreach ($requirements as $key => $value) {
|
||||
list($label, $result) = $value;
|
||||
[$label, $result] = $value;
|
||||
$label = strip_tags($label);
|
||||
$status = $result ? '32m passed' : '31m failed';
|
||||
echo "{$label} ... \033[{$status}\033[0m" . PHP_EOL;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -16,6 +16,6 @@
|
||||
\pard\nowidctlpar\qc\sa100{\cf0\f0\fs32\b\i I am styled by both font and paragraph style.}\par
|
||||
\pard\nowidctlpar{\cf1\f1\fs40\b\i\ul\strike\super I am inline styled.}\par
|
||||
\par
|
||||
{\field {\*\fldinst {HYPERLINK "http://www.google.com"}}{\fldrslt {Google}}}\par
|
||||
{\field {\*\fldinst {HYPERLINK "https://github.com/PHPOffice/PHPWord"}}{\fldrslt {PHPWord on GitHub}}}\par
|
||||
\par
|
||||
}
|
||||
@ -11,5 +11,15 @@
|
||||
<ul><li>Item 1</li><li>Item 2</li><ul><li>Item 2.1</li><li>Item 2.1</li></ul></ul>
|
||||
<p>Ordered (numbered) list:</p>
|
||||
<ol><li>Item 1</li><li>Item 2</li></ol>
|
||||
|
||||
<p style="line-height:2">Double height</p>
|
||||
|
||||
<h2>Includes images</h2>
|
||||
<img src="https://phpword.readthedocs.io/en/latest/_images/phpword.png" alt=""/>
|
||||
|
||||
<img src="http://php.net/images/logos/php-med-trans-light.gif" name="Imagen 12" align="bottom" width="208" height="183" border="0"/>
|
||||
<img src="http://php.net/images/logos/php-icon.png" name="Imagen 13" align="bottom" width="143" height="202" border="0"/>
|
||||
<img src="http://php.net/images/logos/php-med-trans-light.gif" name="Imagen 14" align="bottom" width="194" height="188" border="0"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
BIN
samples/resources/Sample_40_TemplateSetComplexValue.docx
Normal file
BIN
samples/resources/Sample_40_TemplateSetComplexValue.docx
Normal file
Binary file not shown.
BIN
samples/resources/Sample_41_TemplateSetChart.docx
Normal file
BIN
samples/resources/Sample_41_TemplateSetChart.docx
Normal file
Binary file not shown.
0
samples/results/.gitignore
vendored
Normal file → Executable file
0
samples/results/.gitignore
vendored
Normal file → Executable file
17
sonar-project.properties
Normal file
17
sonar-project.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# must be unique in a given SonarQube instance
|
||||
sonar.projectKey=phpoffice:phpword
|
||||
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
|
||||
sonar.projectName=PHPWord
|
||||
sonar.projectVersion=0.16
|
||||
|
||||
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
|
||||
# This property is optional if sonar.modules is set.
|
||||
sonar.sources=src
|
||||
sonar.tests=tests
|
||||
sonar.php.coverage.reportPaths=build/logs/clover.xml
|
||||
sonar.php.tests.reportPath=build/logs/logfile.xml
|
||||
|
||||
# Encoding of the source code. Default is default system encoding
|
||||
#sonar.sourceEncoding=UTF-8
|
||||
|
||||
sonar.host.url=http://localhost:9000
|
||||
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
/**
|
||||
* Autoloader
|
||||
*/
|
||||
class Autoloader
|
||||
{
|
||||
/** @const string */
|
||||
const NAMESPACE_PREFIX = 'PhpOffice\\PhpWord\\';
|
||||
|
||||
/**
|
||||
* Register
|
||||
*
|
||||
* @param bool $throw
|
||||
* @param bool $prepend
|
||||
* @return void
|
||||
*/
|
||||
public static function register($throw = true, $prepend = false)
|
||||
{
|
||||
spl_autoload_register(array(new self, 'autoload'), $throw, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoload
|
||||
*
|
||||
* @param string $class
|
||||
* @return void
|
||||
*/
|
||||
public static function autoload($class)
|
||||
{
|
||||
$prefixLength = strlen(self::NAMESPACE_PREFIX);
|
||||
if (0 === strncmp(self::NAMESPACE_PREFIX, $class, $prefixLength)) {
|
||||
$file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength));
|
||||
$file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php');
|
||||
if (file_exists($file)) {
|
||||
/** @noinspection PhpIncludeInspection Dynamic includes */
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,31 +10,31 @@
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Collection;
|
||||
|
||||
/**
|
||||
* Collection abstract class
|
||||
* Collection abstract class.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
abstract class AbstractCollection
|
||||
{
|
||||
/**
|
||||
* Items
|
||||
* Items.
|
||||
*
|
||||
* @var array
|
||||
* @var \PhpOffice\PhpWord\Element\AbstractContainer[]
|
||||
*/
|
||||
private $items = array();
|
||||
private $items = [];
|
||||
|
||||
/**
|
||||
* Get items
|
||||
* Get items.
|
||||
*
|
||||
* @return array
|
||||
* @return \PhpOffice\PhpWord\Element\AbstractContainer[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
@ -42,28 +42,28 @@ abstract class AbstractCollection
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item by index
|
||||
* Get item by index.
|
||||
*
|
||||
* @param int $index
|
||||
* @return mixed
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Element\AbstractContainer
|
||||
*/
|
||||
public function getItem($index)
|
||||
{
|
||||
if (array_key_exists($index, $this->items)) {
|
||||
return $this->items[$index];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set item.
|
||||
*
|
||||
* @param int $index
|
||||
* @param mixed $item
|
||||
* @return void
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractContainer $item
|
||||
*/
|
||||
public function setItem($index, $item)
|
||||
public function setItem($index, $item): void
|
||||
{
|
||||
if (array_key_exists($index, $this->items)) {
|
||||
$this->items[$index] = $item;
|
||||
@ -71,9 +71,10 @@ abstract class AbstractCollection
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new item
|
||||
* Add new item.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractContainer $item
|
||||
*
|
||||
* @param mixed $item
|
||||
* @return int
|
||||
*/
|
||||
public function addItem($item)
|
||||
@ -85,7 +86,7 @@ abstract class AbstractCollection
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item count
|
||||
* Get item count.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
||||
@ -10,15 +10,15 @@
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Collection;
|
||||
|
||||
/**
|
||||
* Bookmarks collection
|
||||
* Bookmarks collection.
|
||||
*
|
||||
* @since 0.12.0
|
||||
*/
|
||||
|
||||
@ -10,15 +10,15 @@
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Collection;
|
||||
|
||||
/**
|
||||
* Charts collection
|
||||
* Charts collection.
|
||||
*
|
||||
* @since 0.12.0
|
||||
*/
|
||||
|
||||
@ -10,16 +10,18 @@
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord;
|
||||
namespace PhpOffice\PhpWord\Collection;
|
||||
|
||||
/**
|
||||
* @deprecated 0.12.0 Use \PhpOffice\PhpWord\TemplateProcessor instead.
|
||||
* Comments collection.
|
||||
*
|
||||
* @since 0.12.0
|
||||
*/
|
||||
class Template extends TemplateProcessor
|
||||
class Comments extends AbstractCollection
|
||||
{
|
||||
}
|
||||
@ -10,15 +10,15 @@
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Collection;
|
||||
|
||||
/**
|
||||
* Endnotes collection
|
||||
* Endnotes collection.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
|
||||
@ -10,15 +10,15 @@
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2014 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Collection;
|
||||
|
||||
/**
|
||||
* Footnotes collection
|
||||
* Footnotes collection.
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user