本文整理汇总了PHP中PHPWord::addFontStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWord::addFontStyle方法的具体用法?PHP PHPWord::addFontStyle怎么用?PHP PHPWord::addFontStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWord
的用法示例。
在下文中一共展示了PHPWord::addFontStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public function test()
{
// Include the PHPWord.php, all other classes were loaded by an autoloader
require_once APPPATH . '/libraries/PHPWord.php';
//$this->load->library('PHPWord');
// Create a new PHPWord Object
$PHPWord = new PHPWord();
//$PHPWord = $this->phpword;
// Every element you want to append to the word document is placed in a section. So you need a section:
$section = $PHPWord->createSection();
// After creating a section, you can append elements:
$section->addText('Hello world!');
// You can directly style your text by giving the addText function an array:
$section->addText('Hello world! I am formatted.', array('name' => 'Tahoma', 'size' => 16, 'bold' => true));
// If you often need the same style again you can create a user defined style to the word document
// and give the addText function the name of the style:
$PHPWord->addFontStyle('myOwnStyle', array('name' => 'Verdana', 'size' => 14, 'color' => '1B2232'));
$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle');
// You can also putthe appended element to local object an call functions like this:
$myTextElement = $section->addText('Hello World!');
//$myTextElement->setBold();
//$myTextElement->setName('Verdana');
//$myTextElement->setSize(22);
$styleTable = array('borderColor' => '006699', 'borderSize' => 6, 'cellMargin' => 50);
$styleFirstRow = array('bgColor' => '66BBFF');
$PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow);
$table = $section->addTable('myTable');
$table->addRow();
$cell = $table->addCell(2000);
$cell->addText('Cell 1');
$cell = $table->addCell(2000);
$cell->addText('Cell 2');
// $cell = $table->addCell(2000);
//$cell->addText('Cell 3');
// Add image elements
$section->addImage(APPPATH . '/images/side/jqxs-l.JPG');
$section->addTextBreak(1);
//$section->addImage(APPPATH.'/images/side/jqxs-l.JPG', array('width'=>210, 'height'=>210, 'align'=>'center'));
//$section->addTextBreak(1);
//$section->addImage(APPPATH.'/images/side/jqxs-l.jpg', array('width'=>100, 'height'=>100, 'align'=>'right'));
// At least write the document to webspace:
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('helloWorld.docx');
exit;
//download
/*
$filename='just_some_random_name.docx'; //save our document as this file name
header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document'); //mime type
header('Content-Disposition: attachment;filename="'.$filename.'"'); //tell browser what's the file name
header('Cache-Control: max-age=0'); //no cache
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('php://output');
*/
//force download
// $this->load->helper('download');
// $data = file_get_contents("helloWorld.docx"); // Read the file's contents
// $name = 'helloWorld.docx';
// force_download($name, $data);
}
示例2: array
$sectionStyle = $section->getSettings();
// Add header
$header = $section->createHeader();
$styleTable = array('borderColor' => '006699', 'borderSize' => 2);
$styleFirstRow = array('bgColor' => '66BBFF');
$PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow);
$table = $header->addTable();
$table->addRow();
//$table->addCell(1510)->addImage('./../img/logo.gif', array('width'=>151, 'height'=>43, 'align'=>'left'));
replaceHtml($table->addCell(1510), '<img src="./../img/logo.jpg">');
// $table->addCell(4500)->addText('Proyecto FONDEF D08i-1074', array('size'=>12), array('align'=>'right'));
// $table->addCell(4500)->addText('www.kelluwen.cl', array('size'=>10), array('align'=>'right'));
$table->addCell(2500)->addText('');
$text = "<p><b><" . $lang_crear_diseno_word_proyecto . "</b></p><p>" . $lang_crear_diseno_url_kelluwen . "</p>";
replaceHtml($table->addCell(3700), $text, array('align' => 'right', 'border' => false, 'spaceAfter' => 10));
$PHPWord->addFontStyle('tamano_titulo', array('bold' => true, 'italic' => false, 'size' => 12));
$PHPWord->addParagraphStyle('parrafo_titulo', array('align' => 'center'));
$section->addTextBreak(1);
$section->addText($lang_crear_diseno_word_estructura . ": " . $fcd_nombre, 'tamano_titulo', 'pStyle');
// $section->addTextBreak(1);
/*TABLA CON EL RESUMEN DE LAS ACTIVIDADES*/
/*Estilo tabla de resumen de actividades*/
$styleTableDiseno = array('borderSize' => 6, 'borderColor' => '000000', 'cellMargin' => 80);
$styleFirstRowTableDiseno = array('bgColor' => 'D9D9D9');
/*Estilo celda nombre actividad*/
$styleCelda = array('bold' => true);
$PHPWord->addTableStyle('StyleTableDiseno', $styleTableDiseno, $styleFirstRowTableDiseno);
$tableDiseno = $section->addTable('StyleTableDiseno');
$tableDiseno->addRow(400);
$tableDiseno->addCell(2890)->addText($lang_crear_diseno_word_etapa . ' 1', array('bold' => true, 'italic' => false, 'size' => 11));
$tableDiseno->addCell(2890)->addText($lang_crear_diseno_word_etapa . ' 2', array('bold' => true, 'italic' => false, 'size' => 11));
示例3: generate
public function generate($id = 0)
{
$this->load->library('PHPWord');
$this->load->helper('util');
$date = date('Y-m-d_H-i-s');
$no = 1;
$no2 = 1;
//if ($id==0);
$conf = $this->db->get($this->cms_complete_table_name('konfigurasi'))->result();
$cont = $this->db->get($this->cms_complete_table_name('master_cont_pkl'))->result();
$mhs = $this->db->where('fk_id_pkl', $id)->join($this->cms_complete_table_name('mas_jurusan'), 'mas_jurusan.id_jurusan=mhs_pkl.id_jurusan', 'left')->get($this->cms_complete_table_name('mhs_pkl'))->result();
$data = $this->db->where('id_pkl', $id)->join($this->cms_complete_table_name('mhs_pkl'), 'fk_id_pkl=fk_id_pkl', 'left')->join($this->cms_complete_table_name('mas_jurusan'), 'mas_jurusan.id_jurusan=mhs_pkl.id_jurusan', 'left')->get($this->cms_complete_table_name('pkl'))->result();
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection(array('pageSizeH' => 20500));
// Define the TOC font style
// Add title styles
$styleTable = array('cellMargin' => 20);
$styleTable_mhs = array('cellMargin' => 20, 'borderSize' => 6);
$PHPWord->addFontStyle(1, array('size' => 16, 'color' => '333333', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$PHPWord->addFontStyle(2, array('size' => 12, 'bold' => true));
$PHPWord->addFontStyle('underline', array('size' => 11.5, 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$PHPWord->addFontStyle('bold', array('size' => 11.5, 'bold' => true));
$PHPWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 10));
$PHPWord->addParagraphStyle('pHead', array('spaceAfter' => 0));
$PHPWord->addParagraphStyle('pTempat', array('spaceAfter' => 10, 'marginLeft' => 3000));
$PHPWord->addParagraphStyle('pStyle_footer', array('tabs' => array(new PHPWord_Style_Tab('left', 5700)), 'align' => 'center', 'spaceAfter' => 10));
$PHPWord->addParagraphStyle('pStyle_tbs', array('size' => 11, 'align' => 'left', 'spaceAfter' => 10));
$fontStyle = array('size' => 11.5);
//Content
foreach ($data as $d) {
$section->addText('', 'pHead');
$table = $section->addTable();
$table->addRow();
$table->addCell(1250, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(20, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(9000, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(1250, $styleTable)->addText("Nomor", $fontStyle, 'pHead');
$table->addCell(20, $styleTable)->addText(": ", $fontStyle, 'pHead');
$table->addCell(9000, $styleTable)->addText("{$d->nomor}", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(1250, $styleTable)->addText("Lamp", $fontStyle, 'pHead');
$table->addCell(20, $styleTable)->addText(": ", $fontStyle, 'pHead');
$table->addCell(9000, $styleTable)->addText("{$d->lampiran}", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(1250, $styleTable)->addText("Hal", $fontStyle, 'pHead');
$table->addCell(20, $styleTable)->addText(": ", $fontStyle, 'pHead');
$table->addCell(9000, $styleTable)->addText("Permohonan PKL/Magang Mahasiswa", 'underline', 'pHead');
$section->addText('', 'pHead');
$table = $section->addTable();
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(8200, $styleTable)->addText("Kepada Yth.", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(8200, $styleTable)->addText("{$d->kepada}", 'bold', 'pHead');
$section->addText('', $fontStyle, 'pHead');
$table = $section->addTable();
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(400, $styleTable)->addText("Di -", $fontStyle, 'pHead');
$table->addCell(8200, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(8200, $styleTable)->addText("{$d->di}", 'underline', 'pHead');
$section->addText('', $fontStyle, 'pHead');
$table = $section->addTable();
$table->addRow();
$table->addCell(400)->addText("");
$table->addCell(10000)->addText("Dengan Hormat,", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(10000, $styleTable)->addText("Pertama sekali kami do’akan agar Bapak/Ibu senantiasa dalam keadaan sehat dan sukses selalu dalam menjalankan aktifitas, Amin.", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(400)->addText("");
$table->addCell(10000)->addText("Selanjutnya kami memperkenalkan diri bahwa kami adalah Perguruan Tinggi Ilmu Komputer (STMIK-AMIK Riau) yang berlokasi di Jalan Purwodadi Indah Km. 10 Panam Pekanbaru Riau.", $fontStyle);
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(10000, $styleTable)->addText("Sesuai dengan kalender akademik, setiap mahasiswa Jenjang Strata I (S.1) dan Diploma III (D.3) yang akan memasuki tahap akhir diwajibkan untuk melaksanakan Praktek Kerja Lapangan (PKL) / Magang dalam rangka mengasah kemampuan mereka untuk mengenal dunia kerja yang sesungguhnya.", $fontStyle, 'pHead');
$table->addRow();
$table->addCell(400)->addText("");
$table->addCell(10000)->addText("Sebagai upaya pelaksanaan kegiatan magang tersebut, kami mohon kiranya Bapak/Ibu dapat berkenan memberikan kesempatan kepada para mahasiswa kami untuk dapat melaksanakan PKL/Magang dari tangal 01 Juli s/d 24 Agustus 2013.", $fontStyle);
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(10000, $styleTable)->addText("Perhatian dan binaan dari Bapak/Ibu sangat kami harapkan nantinya selama kegiatan tersebut dilaksanakan. Untuk Konfirmasi Selanjutnya Bapak/Ibu dapat menghubungi STMIK-AMIK Riau. Melalui :", $fontStyle, 'pHead');
//Kontak Dosen
$section->addText('', $fontStyle, 'pHead');
$table = $section->addTable();
foreach ($cont as $cnt) {
$table->addRow();
$table->addCell(400, $styleTable)->addText("", $fontStyle, 'pHead');
$table->addCell(400, $styleTable)->addText("{$no}. ", $fontStyle, 'pHead');
$table->addCell(4300, $styleTable)->addText("{$cnt->nama_dosen}", $fontStyle, 'pHead');
$table->addCell(4300, $styleTable)->addText("Hp ({$cnt->nomor_telp})", $fontStyle, 'pHead');
$no++;
}
$section->addText('', $fontStyle, 'pHead');
$table = $section->addTable();
//.........这里部分代码省略.........
示例4: array
$styleFirstRow = array('borderBottomSize'=>18, 'borderBottomColor'=>'0000FF', 'bgColor'=>'66BBFF');
*/
// Define cell style arrays
$styleCell = array('valign' => 'center');
$styleCellBTLR = array('valign' => 'center', 'textDirection' => PHPWord_Style_Cell::TEXT_DIR_BTLR);
// Define font style for first row
// label 的样式
$titleFontStyle = array('bold' => true, 'align' => 'center');
$valueFontStyle = array();
//
$cellValueMergeStartStyle = array_merge($valueFontStyle, array('cellMerge' => 'restart'));
$cellTitleMergeStartStyle = array_merge($titleFontStyle, array('cellMerge' => 'restart'));
$rowTitleMergeStartStyle = array_merge($titleFontStyle, array('rowMerge' => 'restart'));
define('CELL_LABEL_TITLE_WIDTH', 3500);
// 标题
$PHPWord->addFontStyle('headTitleFontStyle', array('bold' => true, 'size' => 16));
$PHPWord->addParagraphStyle('headTitlePStyle', array('align' => 'center', 'spaceAfter' => 100));
$section->addText('澳 通 人 才 网 登 记 表', 'headTitleFontStyle', 'headTitlePStyle');
// 备注
$PHPWord->addFontStyle('markFontStyle', array('size' => 12));
$PHPWord->addParagraphStyle('markPStyle', array('align' => 'right', 'spaceAfter' => 100));
$section->addText('填表日期: 年 月 日', 'markFontStyle', 'markPStyle');
// 添加表格的样式
$PHPWord->addTableStyle('myOwnTableStyle', array('borderSize' => 6, 'cellMargin' => 80), array());
// 添加一个表格
$table = $section->addTable('myOwnTableStyle');
// 第一行
$table->addRow();
// Add cells
$table->addCell(CELL_LABEL_TITLE_WIDTH, $styleCell)->addText('姓名', $titleFontStyle);
$table->addCell(2000, $styleCell)->addText('曾繁斌', $valueFontStyle);
示例5: PHPWord
<?php
require_once '../PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Add text elements
$section->addText('Hello World!');
$section->addTextBreak(2);
$section->addText('I am inline styled.', array('name' => 'Verdana', 'color' => '006699'));
$section->addTextBreak(2);
$PHPWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16));
$PHPWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100));
$section->addText('I am styled by two style definitions.', 'rStyle', 'pStyle');
$section->addText('I have only a paragraph style definition.', null, 'pStyle');
header('Content-Type: application/vnd.ms-word');
header('Content-Disposition: attachment;filename="myfile.docx"');
header('Cache-Control: max-age=0');
// output the file to the browser
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('php://output');
exit;
//you must have the exit!
示例6: makePaper
public static function makePaper($questions, $subCode, $date, $time, $session, $internal, $sec)
{
$sem = $questions[1][1]->subject()->first()->sem;
$subject = $questions[1][1]->subject()->first()->name;
// Create a new PHPWord Object
$PHPWord = new PHPWord();
// Every element you want to append to the word document is placed in a section. So you need a section:
$section = $PHPWord->createSection();
$PHPWord->addFontStyle('myNoteStyle', array('name' => 'Calibri', 'size' => 11, 'bold' => true, 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$PHPWord->addFontStyle('myOwnStyle', array('name' => 'Calibri', 'size' => 11, 'bold' => true));
$PHPWord->addParagraphStyle('myGapTStyle', array('name' => 'Calibri', 'size' => 5, 'bold' => true));
$PHPWord->addParagraphStyle('myGapPStyle', array('spaceAfter' => 0));
$PHPWord->addParagraphStyle('myHeaderStyle', array('spaceAfter' => 0));
$PHPWord->addParagraphStyle('myQuestionStyle', array('spaceAfter' => 0));
// Header
$table = $section->addTable();
$table->addRow();
$table->addCell(4200)->addText('USN: [ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]', 'myOwnStyle');
$table->addCell(8000)->addText('');
$table->addCell(700)->addText($subCode, 'myOwnStyle');
$center = array('spaceAfter' => 0, 'align' => 'center');
$table_block_format = array('cellMarginTop' => -10, 'cellMarginLeft' => 30, 'valign' => 'center');
$table_block_format2 = array('cellMarginBottom' => 0, 'cellMarginLeft' => 100, 'valign' => 'center');
$questionTextStyle = array('bold' => false, 'size' => 10.5, 'name' => 'Calibri');
$cellTextStyleBigBold = array('bold' => true, 'size' => 13, 'name' => 'Calibri');
$PHPWord->addTableStyle('myTable', $table_block_format, array('align' => 'center'));
$PHPWord->addTableStyle('myQuestionTable', $table_block_format, array('align' => 'center'));
// $table = $section->addTable('myTable');
// $table->addRow();
// $table->addCell(10000)->addText('Semester '.$sem.', B.E Degree Examination, '.$date, $cellTextStyleBigBold, $center);
// $table->addRow();
// $table->addCell(10000)->addText($subject, $cellTextStyleBigBold, $center);
$section->addText('Dayananda Sagar College of Engineering, Bangalore - 78', $cellTextStyleBigBold, $center);
$section->addText('Department of Computer Science & Engineering', $cellTextStyleBigBold, $center);
$section->addText('Session: ' . $session, $cellTextStyleBigBold, $center);
$section->addText('Internal Assessment - ' . $internal, $cellTextStyleBigBold, $center);
$table = $section->addTable();
$table->addRow();
$cell = $table->addCell(6000);
// $textrun = $cell->createTextRun();
$cell->addText('Semester: ' . $sem, 'myOwnStyle', 'myHeaderStyle');
$cell->addText('Subject: ' . $subject, 'myOwnStyle', 'myHeaderStyle');
$cell->addText('Time: ' . $time, 'myOwnStyle', 'myHeaderStyle');
$table->addCell(4000)->addText('');
$cell = $table->addCell(2100);
// $textrun = $cell->createTextRun();
$cell->addText('Section: ' . $sec, 'myOwnStyle', 'myHeaderStyle');
$cell->addText('Date: ' . $date, 'myOwnStyle', 'myHeaderStyle');
$cell->addText('Max Marks: 50', 'myOwnStyle', 'myHeaderStyle');
// After creating a section, you can append elements:
$listStyle = array('listType' => PHPWord_Style_ListItem::TYPE_NUMBER_NESTED);
$section->addText('PART A', 'myOwnStyle', $center);
$section->addText('Answer any 2 questions out of 3. Each question carries 20 Marks', 'myNoteStyle', $center);
$table = $section->addTable('myQuestionTable');
for ($i = 1; $i <= 3; $i++) {
$letter = 'a';
for ($j = 1; $j <= sizeof($questions[$i]); $j++) {
$table->addRow();
if (sizeof($questions[$i]) == 1) {
$table->addCell(100)->addText($i . '.');
} elseif ($j == 1) {
$table->addCell(100)->addText($i . '.' . $letter++ . ")");
} else {
$table->addCell(100)->addText(" " . $letter++ . ")");
}
$subQuestions = preg_split('/[\\n]/', $questions[$i][$j]->question, -1, NULL);
$cell = $table->addCell(9000);
foreach ($subQuestions as $subQuestion) {
$cell->addText($subQuestion, $questionTextStyle, 'myQuestionStyle');
}
if ($questions[$i][$j]->images()->first()) {
$cell->addImage('images/' . $questions[$i][$j]->images()->first()->path, array('align' => 'center'));
}
if ($j == sizeof($questions[$i])) {
$cell->addText('', 'myGapTStyle', 'myGapPStyle');
}
$table->addCell(100)->addText('(' . $questions[$i][$j]->marks . ')');
}
}
$section->addText('PART B', 'myOwnStyle', $center);
$section->addText('Answer any 1 question out of 2. Each question carries 10 Marks', 'myNoteStyle', $center);
$table = $section->addTable('myQuestionTable');
for ($i = 4; $i <= 5; $i++) {
$letter = 'a';
for ($j = 1; $j <= sizeof($questions[$i]); $j++) {
$table->addRow();
if (sizeof($questions[$i]) == 1) {
$table->addCell(100)->addText($i . '.');
} elseif ($j == 1) {
$table->addCell(100)->addText($i . '.' . $letter++ . ")");
} else {
$table->addCell(100)->addText(" " . $letter++ . ")");
}
$subQuestions = preg_split('/[\\n]/', $questions[$i][$j]->question, -1, NULL);
$cell = $table->addCell(9000);
foreach ($subQuestions as $subQuestion) {
$cell->addText($subQuestion, $questionTextStyle, 'myQuestionStyle');
}
if ($questions[$i][$j]->images()->first()) {
$cell->addImage('images/' . $questions[$i][$j]->images()->first()->path, array('align' => 'center'));
//.........这里部分代码省略.........
示例7: writeContent
/**
* Write content file to XML format
*
* @param PHPWord $pPHPWord
* @return string XML Output
* @throws Exception
*/
public function writeContent(PHPWord $pPHPWord = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_MEMORY);
}
// XML header
$objWriter->startDocument('1.0', 'UTF-8');
// office:document-content
$objWriter->startElement('office:document-content');
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
$objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0');
$objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0');
$objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0');
$objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0');
$objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0');
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
$objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
$objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0');
$objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0');
$objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0');
$objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0');
$objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML');
$objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0');
$objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0');
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
$objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer');
$objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc');
$objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events');
$objWriter->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms');
$objWriter->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report');
$objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2');
$objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
$objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
$objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table');
$objWriter->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0');
$objWriter->writeAttribute('xmlns:formx', 'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0');
$objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/');
$objWriter->writeAttribute('office:version', '1.2');
// We firstly search all fonts used
$_sections = $pPHPWord->getSections();
$countSections = count($_sections);
if ($countSections > 0) {
$pSection = 0;
$numPStyles = 0;
$numFStyles = 0;
foreach ($_sections as $section) {
$pSection++;
$_elements = $section->getElements();
foreach ($_elements as $element) {
if ($element instanceof PHPWord_Section_Text) {
$fStyle = $element->getFontStyle();
$pStyle = $element->getParagraphStyle();
if ($fStyle instanceof PHPWord_Style_Font) {
$numFStyles++;
$arrStyle = array('color' => $fStyle->getColor(), 'name' => $fStyle->getName());
$pPHPWord->addFontStyle('T' . $numFStyles, $arrStyle);
$element->setFontStyle('T' . $numFStyles);
} elseif ($pStyle instanceof PHPWord_Style_Paragraph) {
$numPStyles++;
$pPHPWord->addParagraphStyle('P' . $numPStyles, array());
$element->setParagraph('P' . $numPStyles);
}
}
}
}
}
// office:font-face-decls
$objWriter->startElement('office:font-face-decls');
$arrFonts = array();
$styles = PHPWord_Style::getStyles();
$numFonts = 0;
if (count($styles) > 0) {
foreach ($styles as $styleName => $style) {
// PHPWord_Style_Font
if ($style instanceof PHPWord_Style_Font) {
$numFonts++;
$name = $style->getName();
if (!in_array($name, $arrFonts)) {
$arrFonts[] = $name;
// style:font-face
$objWriter->startElement('style:font-face');
$objWriter->writeAttribute('style:name', $name);
$objWriter->writeAttribute('svg:font-family', $name);
$objWriter->endElement();
}
}
//.........这里部分代码省略.........
示例8: process_wizard_form_one
public function process_wizard_form_one()
{
if ($_POST) {
// Sanitize form
$form = $this->toolbox('Sanitize')->form($_POST);
$this->company = $form['company'];
$this->url = $form['url'];
$this->cosultant = $form['consultant'];
$this->toolbox('session')->set('assessment_company', $form['company']);
$this->toolbox('session')->set('assessment_url', $form['url']);
// We want to assemble the file name here in the following format:
// Intials_Web_Assess_MMDDYY
// Get the first letter of each word (including hyphenated/underscored words)
$corpname = preg_split("/[\\s,_ -]+/", $form['company']);
$initials = "";
foreach ($corpname as $firstletter) {
$initials .= $firstletter[0];
}
$this->file_name = $initials . '_Web_Assess_' . date("mdY") . $this->file_extension;
$this->toolbox('session')->set('assessment_file_name', $this->file_name);
// Now let's create the file
$file = $this->file_name;
// Create a new PHPWord Object
$PHPWord = new PHPWord();
// Every element you want to append to the word document is placed in a section. So you need a section:
$section = $PHPWord->createSection();
// After creating a section, you can append elements:
$section->addImage('http://www.dynamicartisans.com/area51/public/template/update/assets/images/dynamicartisans-logo-mobi.png', array('width' => 100, 'height' => 100, 'marginTop' => -1, 'marginLeft' => -1, 'wrappingStyle' => 'behind'));
$section->addTextBreak(1);
// You can directly style your text by giving the addText function an array:
$section->addText('sight, sound, color, motion, and emotion.', array('name' => 'Tahoma', 'size' => 12, 'bold' => false));
// If you often need the same style again you can create a user defined style to the word document
// and give the addText function the name of the style:
$PHPWord->addFontStyle('date-style', array('text-align' => 'right', 'size' => 12, 'color' => '1B2232'));
$section->addText(date("F d, Y"), 'date-style');
$section->addTextBreak(1);
$section->addText('Contact:' . $this->company, array('bold' => true));
#$section->addText( $this->company );
$section->addText('Consultant:' . $form['consultant'], array('bold' => true));
#$section->addText( $form['consultant'] );
$section->addTextBreak(1);
$section->addText('We took a moment to assess the website for ' . $this->toolbox('session')->get('assessment_company') . ' and these are the observations and
recommendations from our web development team: ');
// You can also putthe appended element to local object an call functions like this:
//$myTextElement = $section->addText('Hello World!');
//$myTextElement->setBold();
//$myTextElement->setName('Verdana');
//$myTextElement->setSize(22);
// At least write the document to webspace:
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save($this->draft_folder . $this->file_name);
// $this->model('Assessments')->generate_tags( $this->company );
// Compile form variable tags
// $this->model('Assessments')->initialize_var_tags( $this->company, $this->url, $form['consultant'], $this->file_name );
// Track network speeds
$this->model('Assessments')->network_speed($this->toolbox('Performance')->check_latency_raw($this->toolbox('session')->get('assessment_url')), $this->toolbox('Performance')->check_download_speed_raw($this->toolbox('session')->get('assessment_url')), $this->company);
// Autosave draft
$this->save_draft($this->company, $this->file_name, time(), $this->author);
// Saving wizard -- move on two step two
if ($this->model('Assessments')->wizard_step_one($this->company, $this->url, $form['first_name'], $form['last_name'], $form['consultant'], $this->file_name, $this->author)) {
$this->redirect('assessments/wizard/server');
} else {
throw new Exception('Error processing request');
}
}
}
示例9: generatedocx
public function generatedocx()
{
if ($this->request->is('post')) {
$sentenceId = $this->request['data']['sentenceId'];
$startIndex = $this->request['data']['startIndex'];
$endIndex = $this->request['data']['endIndex'];
$maxLevel = $this->request['data']['maxLevel'];
$tmpDocumentPath = '/tmp/IAtagger_generated.docx';
$sentenceData = Utils::getSentenceData($sentenceId);
//die(print_r($sentenceData, true));
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
$PHPWord->addParagraphStyle('centering', array('align' => 'center'));
$PHPWord->addFontStyle('wordsRowTextStyle', array('bold' => true));
$PHPWord->addFontStyle('tagsTextStyle', array('bold' => true, 'color' => '000066', 'align' => 'center'));
$PHPWord->addFontStyle('defaultTextStyle', array('bold' => false));
$wordsRowCellStyle = array('borderTopSize' => 6, 'borderTopColor' => '006699', 'borderLeftSize' => 6, 'borderLeftColor' => '006699', 'borderRightSize' => 6, 'borderRightColor' => '006699', 'borderBottomSize' => 18, 'borderBottomColor' => '000066', 'bgColor' => 'E2F0FF', 'cellMargin' => 30, 'valign' => 'center');
$cellStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 30, 'valign' => 'center');
$table = $section->addTable();
// Bracket row
$table->addRow();
$table->addCell(900);
$wordIndex = 0;
foreach ($sentenceData['sentence']['Word'] as $word) {
if ($wordIndex >= $startIndex && $wordIndex < $endIndex) {
$cell = $table->addCell(2000);
if ($word['postposition_id']) {
$cell->addImage('/var/www/html/tagging/app/webroot/img/leftBracket.png', array('width' => 40, 'height' => 15, 'align' => 'right'));
}
if ($word['is_postposition']) {
$cell->addImage('/var/www/html/tagging/app/webroot/img/rightBracket.png', array('width' => 40, 'height' => 15, 'align' => 'left'));
}
}
$wordIndex++;
}
// Words row
$table->addRow(900);
$table->addCell(900, $wordsRowCellStyle);
$wordIndex = 0;
foreach ($sentenceData['sentence']['Word'] as $word) {
if ($wordIndex >= $startIndex && $wordIndex < $endIndex) {
$cell = $table->addCell(2000, $wordsRowCellStyle);
if ($word['split']) {
$wordText = $word['stem'] . '-' . $word['suffix'];
} else {
$wordText = $word['text'];
}
$cell->addText($wordText, 'wordsRowTextStyle', 'centering');
}
$wordIndex++;
}
// Annotation rows
$legend = array();
$levelIndex = 0;
foreach ($sentenceData['sentence']['WordAnnotations'] as $annotationData) {
if ($levelIndex < $maxLevel) {
$table->addRow(900);
$wordAnnotationType = $annotationData['type']['WordAnnotationType'];
// annotation name cell
$cell = $table->addCell(900, $cellStyle);
$cell->addText($wordAnnotationType['name'], 'defaultTextStyle', 'centering');
$wordIndex = 0;
foreach ($annotationData['annotations'] as $annotation) {
if ($wordIndex >= $startIndex && $wordIndex < $endIndex) {
$cell = $table->addCell(900, $cellStyle);
if (!empty($annotation)) {
if ($wordAnnotationType['strict_choices']) {
foreach ($annotation['WordAnnotationTypeChoice'] as $choice) {
$cell->addText($choice['value'], 'tagsTextStyle', 'centering');
$legend[$choice['value']] = $choice['description'];
}
} else {
$cell->addText($annotation['text_value'], 'defaultTextStyle', 'centering');
}
}
}
$wordIndex++;
}
}
$levelIndex++;
}
foreach ($sentenceData['sentence']['SentenceAnnotations'] as $annotationData) {
if ($levelIndex < $maxLevel) {
$table->addRow(900);
$sentenceAnnotationType = $annotationData['type']['SentenceAnnotationType'];
// annotation name cell
$cell = $table->addCell(900, $cellStyle);
$cell->addText($sentenceAnnotationType['name'], 'defaultTextStyle', 'centering');
$spanningCellStyle = $cellStyle;
$spanningCellStyle['gridSpan'] = $endIndex - $startIndex;
$cell = $table->addCell(900, $spanningCellStyle);
$text = isset($annotationData['annotation']['text']) ? $annotationData['annotation']['text'] : '';
$cell->addText($text);
}
$levelIndex++;
}
// Legend
ksort($legend);
//.........这里部分代码省略.........
示例10: PHPWord
/************************************************/
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Define table style arrays
$styleTable = array('borderSize' => 6, 'borderColor' => '689F3B', 'cellMargin' => 10, 'size' => 10);
$styleFirstRow = array('borderBottomSize' => 5, 'borderBottomColor' => '689F3B', 'bgColor' => 'D2F4B5');
// Define cell style arrays
$styleCell = array('valign' => 'center');
$styleCellBTLR = array('valign' => 'center', 'textDirection' => PHPWord_Style_Cell::TEXT_DIR_BTLR);
// Define font style for first row
$fontStyle = array('bold' => true, 'size' => 10, 'align' => 'center');
$paragraphStyle = array('bold' => true, 'size' => 10, 'align' => 'center');
$PHPWord->addParagraphStyle('pStyle', $paragraphStyle);
$PHPWord->addFontStyle('rStyle', array('bold' => true, 'size' => 12));
$PHPWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100));
$section->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', 'Personnel ' . $array_departement[$id_dep]['F'])) . ' - Situation au ' . $date_situation_effectifs, 'rStyle', 'pStyle');
foreach ($tab_agents_dep as $key_agents_dep => $value_agents_dep) {
$PHPWord->addTableStyle('myOwnTableStyle', $styleTable, $styleFirstRow);
// Add table
$table = $section->addTable('myOwnTableStyle');
$table->addRow();
$table->addCell(2000)->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', $value_agents_dep['nom'] . " " . $value_agents_dep['prenom'])));
if ($value_agents_dep['date_echeance_regime'] == '0000-00-00' || $value_agents_dep['date_echeance_regime'] == '00-00-0000') {
$table->addCell(2000)->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', $array_regime[$value_agents_dep['id_regime']]['F'])));
} else {
$table->addCell(2000)->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', $array_regime[$value_agents_dep['id_regime']]['F'] . ' ' . $value_agents_dep['date_echeance_regime'])));
}
$table->addCell(1000)->addText($value_agents_dep['langue']);
$table->addCell(3000)->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', $array_grade[$value_agents_dep['id_grade']]['F'])));
示例11: generate
public function generate($id = 0)
{
$this->load->library('PHPWord');
$this->load->helper('util');
$date = date('Y-m-d_H-i-s');
//if ($id==0);
$conf = $this->db->get($this->cms_complete_table_name('konfigurasi'))->result();
$data = $this->db->where('id_ket_lulusan', $id)->get($this->cms_complete_table_name('ket_lulusan'))->result();
$ket = $this->db->where('fk_id_ket_lulusan', $id)->get($this->cms_complete_table_name('keterangan_lulusan'))->result();
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection(array('pageSizeH' => 20500));
// Define the TOC font style
// Add title styles
$PHPWord->addFontStyle(1, array('size' => 16, 'color' => '000', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$PHPWord->addFontStyle(2, array('size' => 12, 'color' => '000', 'bold' => true));
$PHPWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 10));
$PHPWord->addParagraphStyle('pStyle_footer', array('tabs' => array(new PHPWord_Style_Tab('left', 6000)), 'align' => 'center', 'spaceAfter' => 10));
$PHPWord->addParagraphStyle('pStyle_tbs', array('size' => 11, 'align' => 'left', 'spaceAfter' => 10));
$fontStyle = array('spaceAfter' => 60, 'size' => 12);
//Generate Document
foreach ($data as $d) {
$section->addTitle('');
$section->addTitle('');
$section->addTitle('');
$section->addText('SURAT KETERANGAN LULUSAN', 1, 'pStyle');
$section->addText('No.' . $d->nomor_surat . '/B-01/STMIK-AMIK/' . $d->bulan . '/' . $d->tahun, $fontStyle, 'pStyle');
$section->addTitle('');
$section->addTitle('');
$section->addText('Yang bertanda tangan dibawah ini :', $fontStyle);
//Table
foreach ($conf as $c) {
$table = $section->addTable();
$table->addRow();
$table->addCell(500)->addText("");
$table->addCell(1750)->addText("Nama", $fontStyle);
$table->addCell(3750)->addText(": " . $c->nama_puket, $fontStyle);
$table->addRow();
$table->addCell(500)->addText("");
$table->addCell(1750)->addText("Pangkat/Gol", $fontStyle);
$table->addCell(3750)->addText(": " . $c->pangkat_puket, $fontStyle);
$table->addRow();
$table->addCell(500)->addText("");
$table->addCell(1750)->addText("Jabatan", $fontStyle);
$table->addCell(3750)->addText(": Pembantu Ketua I. Bid. Akademis", $fontStyle);
}
//End OfTable
$section->addText('Menerangkan bahwa :', $fontStyle);
//Table
$table = $section->addTable();
$table->addRow();
$table->addCell(500)->addText("");
$table->addCell(1750)->addText("Nama", $fontStyle);
$table->addCell(3750)->addText(": " . $d->nama_mahasiswa, $fontStyle);
$table->addRow();
$table->addCell(500)->addText("");
$table->addCell(1750)->addText("NPM", $fontStyle);
$table->addCell(3750)->addText(": " . $d->npm, $fontStyle);
$table->addRow();
$table->addCell(500)->addText("");
$table->addCell(1750)->addText("Tempat/Tgl Lahir", $fontStyle);
$table->addCell(3750)->addText(": " . $d->tempat_lahir . ", " . tanggal(date($d->tanggal_lahir)), $fontStyle);
//End OfTable
$section->addText('Adalah benar mahasiswa Sekolah Tinggi Manajemen Informatika & Komputer AMIK Riau (STMIK-AMIK) Riau yang telah :', $fontStyle);
$section->addText("");
foreach ($ket as $k) {
$section->addListItem($k->keterangan, 0, $fontStyle);
}
//End OfTable
foreach ($conf as $c) {
$section->addText('Demikian surat keterangan kelulusan ini dikeluarkan untuk dapat dipergunakan sebagaimana mestinya.', $fontStyle);
$section->addTitle('');
$section->addText("\tPekanbaru, " . tanggal(date('d-m-Y')), $fontStyle, 'pStyle_footer');
$section->addTitle('');
$section->addTitle('');
$section->addTitle('');
$section->addText("\t{$c->nama_puket}", 2, 'pStyle_footer');
$section->addText("\tPuket I Bid. Akademis", $fontStyle, 'pStyle_footer');
$section->addTitle('');
$section->addTitle('');
$section->addText("Tembusan disampaikan kepada Yth :", 'pStyle_tbs');
$section->addText("1. Ketua STMIK-AMIK Riau", 'pStyle_tbs');
$section->addText("2. Arsip ……", 'pStyle_tbs');
}
////open file////
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$filename = $d->npm . '-Ket_Lulusan.docx';
$objWriter->save($filename);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . $filename);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
flush();
readfile($filename);
unlink($filename);
// deletes the temporary file
//.........这里部分代码省略.........
示例12: PHPWord
/************************************************/
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Define table style arrays
$styleTable = array('borderSize' => 6, 'borderColor' => '689F3B', 'cellMargin' => 10, 'size' => 10);
$styleFirstRow = array('borderBottomSize' => 5, 'borderBottomColor' => '689F3B', 'bgColor' => 'D2F4B5');
// Define cell style arrays
$styleCell = array('valign' => 'center');
$styleCellBTLR = array('valign' => 'center', 'textDirection' => PHPWord_Style_Cell::TEXT_DIR_BTLR);
// Define font style for first row
$fontStyle = array('bold' => true, 'size' => 10, 'align' => 'center');
$paragraphStyle = array('bold' => true, 'size' => 10, 'align' => 'center');
$PHPWord->addParagraphStyle('pStyle', $paragraphStyle);
$PHPWord->addFontStyle('rStyle', array('bold' => true, 'size' => 12));
$PHPWord->addFontStyle('gros_titre', array('bold' => true, 'size' => 12, 'color' => '689F3B', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$PHPWord->addParagraphStyle('pStyle_center', array('align' => 'center', 'spaceAfter' => 200));
$PHPWord->addParagraphStyle('pStyle_left', array('align' => 'left', 'spaceAfter' => 100));
/********************************************
Signalétique nom, prénom, date naissance
***************/
$txt = "Fiche individuelle - " . $tab_agents['nom'] . ' ' . $tab_agents['prenom'];
$section->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', $txt)), 'gros_titre', 'pStyle_center');
/*$txt="NOM: ".$tab_agents['nom'];
$section -> addText(html_entity_decode(iconv('UTF-8', 'windows-1252',$txt)),'pStyle_left');
$txt="PRENOM: ".$tab_agents['prenom'];
$section -> addText(html_entity_decode(iconv('UTF-8', 'windows-1252',$txt)),'pStyle_left');*/
$txt = "ID REGISTRE: " . $tab_agents['registre_id'];
$section->addText(html_entity_decode(iconv('UTF-8', 'windows-1252', $txt)), 'pStyle_left');
示例13: PHPWord
break;
case "11":
$mes = 'Novembro';
break;
case "12":
$mes = 'Dezembro';
break;
}
require_once INTERNAL_ROOT_PORTAL . '/lib/word/PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Add style definitions
$PHPWord->addParagraphStyle('pStyle', array('spacing' => 100, 'name' => 'Times New Roman', 'bold' => false, 'size' => 11));
$PHPWord->addFontStyle('BoldText', array('name' => 'Times New Roman', 'bold' => true, 'size' => 11));
$PHPWord->addFontStyle('texto', array('name' => 'Times New Roman', 'bold' => false, 'size' => 11));
$PHPWord->addFontStyle('assinatura', array('name' => 'Times New Roman', 'bold' => false, 'size' => 10.5));
// Add header
$header = $section->createHeader();
$table = $header->addTable();
$table->addRow();
$table->addCell(4500)->addImage('C:/Diego/troncal.jpg', array('width' => 250, 'height' => 75, 'align' => 'left'));
$table->addCell(4500)->addText(' ');
$table->addCell(4500)->addText($documento->getCodGRD() . '/' . date("Y"), 'texto');
// Add text elements
$section->addText(' Belém, ' . date("N") . ' de ' . $mes . ' de ' . date("Y") . '.', 'texto');
$section->addText('Ao Núcleo de Gerenciamento de Transporte Metropolitano - NGTM ', 'BoldText', 'Teste', 'texto');
$section->addText('Avenida Gentil Bittencourt, n.º 1539, Nazaré Belém - PA', 'texto');
$section->addText('Att.: Dra. Marilena Mácola Marques Diretora Executiva - NGTM', 'texto');
$section->addText('Ref.: Contrato Nº 002/2014-NGTM', 'texto');
示例14: PHPWord
$documento->setLocal("");
$documento->setCodGRD("");
}
require_once '../../lib/word/PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Define table style arrays
$styleTable = array('cellMarginLeft' => 110, 'cellMarginRight' => 110, 'borderSize' => 1);
$styleCellMerged = array('valign' => 'center', 'gridSpan' => 2);
$styleCellBTLR1 = array('vMerge' => 'restart', 'valign' => 'center', 'textDirection' => PHPWord_Style_Cell::TEXT_DIR_BTLR);
$styleCellBTLR2 = array('vMerge' => 'fusion', 'valign' => 'center', 'textDirection' => PHPWord_Style_Cell::TEXT_DIR_BTLR);
// Add style definitions
$PHPWord->addParagraphStyle('pStyle', array('spacing' => 100, 'name' => 'Times New Roman', 'bold' => false, 'size' => 11, 'align' => 'center', 'spaceAfter' => 100));
$PHPWord->addFontStyle('BoldText', array('name' => 'Times New Roman', 'bold' => true, 'size' => 12));
$PHPWord->addFontStyle('texto', array('name' => 'Arial', 'bold' => false, 'size' => 11));
$PHPWord->addFontStyle('texto_sublinhado', array('name' => 'Arial', 'bold' => false, 'size' => 11, 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$PHPWord->addFontStyle('titulo', array('name' => 'Thorndale', 'size' => 12, 'bold' => false, 'align' => 'center', 'spaceAfter' => 100));
// Add table style
$PHPWord->addTableStyle('tbl13', $styleTable);
// Add header
$header = $section->createHeader();
// Add table
$table = $header->addTable('tbl13');
// variaveis que recebem o texto
$assunto = utf8_decode($documento->getAssunto());
$msg2 = utf8_decode("SISTEMA TRONCAL DE ÔNIBUS DA REGIÃO METROPOLITANA DE BELÉM");
$pagina = utf8_decode("Página");
$local = utf8_decode($documento->getLocal());
$observacao = utf8_decode($documento->getObservacao());
示例15: array
$section->addListItem('List Item 2', 0);
$section->addListItem('List Item 3', 0);
$section->addTextBreak(2);
// Add listitem elements
$section->addListItem('List Item 1', 0);
$section->addListItem('List Item 1.1', 1);
$section->addListItem('List Item 1.2', 1);
$section->addListItem('List Item 1.3 (styled)', 1, array('bold' => true));
$section->addListItem('List Item 1.3.1', 2);
$section->addListItem('List Item 1.3.2', 2);
$section->addTextBreak(2);
// Add listitem elements
$listStyle = array('listType' => PHPWord_Style_ListItem::TYPE_NUMBER);
$section->addListItem('List Item 1', 0, null, $listStyle);
$section->addListItem('List Item 2', 0, null, $listStyle);
$section->addListItem('List Item 3', 0, null, $listStyle);
$section->addTextBreak(2);
// Add listitem elements
$PHPWord->addFontStyle('myOwnStyle', array('color' => 'FF0000'));
$PHPWord->addParagraphStyle('P-Style', array('spaceAfter' => 95));
$listStyle = array('listType' => PHPWord_Style_ListItem::TYPE_NUMBER_NESTED);
$section->addListItem('List Item 1', 0, 'myOwnStyle', $listStyle, 'P-Style');
$section->addListItem('List Item 2', 0, 'myOwnStyle', $listStyle, 'P-Style');
$section->addListItem('List Item 3', 1, 'myOwnStyle', $listStyle, 'P-Style');
$section->addListItem('List Item 4', 1, 'myOwnStyle', $listStyle, 'P-Style');
$section->addListItem('List Item 5', 2, 'myOwnStyle', $listStyle, 'P-Style');
$section->addListItem('List Item 6', 1, 'myOwnStyle', $listStyle, 'P-Style');
$section->addListItem('List Item 7', 0, 'myOwnStyle', $listStyle, 'P-Style');
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('ListItem.docx');