FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
PHPWord/samples/Sample_20_BGColor.php at develop · ynphp/PHPWord · GitHub
ynphp
PHPWord
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
PHPWord
/
samples
/
Sample_20_BGColor.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
22 lines (18 loc) · 715 Bytes
Breadcrumbs
PHPWord
/
samples
/
Sample_20_BGColor.php
Copy path
File metadata and controls
22 lines (18 loc) · 715 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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
(
'
This is some text highlighted using fgColor (limited to 15 colors)
'
,
array
(
'
fgColor
'
=> \
PhpOffice
\
PhpWord
\
Style
\Font::
FGCOLOR_YELLOW
)
);
$
section
->
addText
(
'
This one uses bgColor and is using hex value (0xfbbb10)
'
,
array
(
'
bgColor
'
=>
'
fbbb10
'
));
$
section
->
addText
(
'
Compatible with font colors
'
,
array
(
'
color
'
=>
'
0000ff
'
,
'
bgColor
'
=>
'
fbbb10
'
));
// Save file
echo
write
(
$
phpWord
,
basename
(
__FILE__
,
'
.php
'
),
$
writers
);
if
(!
CLI
) {
include_once
'
Sample_Footer.php
'
;
}
Back
|
FazBrowse Home
|
New Git URL