2017-05-08 7 views
1

처음으로 내 다양하고 나쁜 영어 (나는 이탈리아 인)에 대해 유감스럽게 생각합니다. 안녕하세요, 저는 phpword 라이브러리에 문제가 있습니다. 셀에 글 머리 기호 목록을 삽입 하겠지만 어떻게해야할지 모릅니다. 모든표에 phpword 삽입 글 머리 기호 목록

<?php 
include_once 'vendor/autoload.php'; 
include ('session_admin.php'); 
$class = $_SESSION['n_classe']; 
include ('../conn_serv.php'); 

$phpWord = new \PhpOffice\PhpWord\PhpWord(); 

$section = $phpWord->addSection(); 

$sectionStyle = $section->getStyle(); 

$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1)); 
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1)); 
$sectionStyle->setMarginTop(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1)); 
$sectionStyle->setMarginBottom(\PhpOffice\PhpWord\Shared\Converter::cmToTwip(1)); 


$fontStyle = new \PhpOffice\PhpWord\Style\Font(); 
$fontStyle->setBold(true); 
$fontStyle->setName('Tahoma'); 
$fontStyle->setSize(12); 
$myTextElement = $section->addText('RELAZIONE FINALE VISITA O VIAGGIO D ISTRUZIONE'); 
$myTextElement->setFontStyle($fontStyle); 

$fancyTableStyleName = 'Fancy Table'; 
$fancyTableStyle = array('borderSize' => 1, 'borderColor' => 'd2d2d2', 'cellMargin' => 40, 'width' => 200 , 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER); 
$fancyTableCellStyle = array('valign' => 'center'); 
$fancyTableFontStyle = array('bold' => true); 
$phpWord->addTableStyle($fancyTableStyleName, $fancyTableStyle, $fancyTableFirstRowStyle); 
$table = $section->addTable($fancyTableStyleName); 

$table->addRow(); 
$table->addCell(20000)->addText('Classe/i ___________ sez. ____________'); 
$table->addRow(); 
$table->addCell(20000)->addText('Visita guidata/Viaggio d istruzione a:                del: '); 
$table->addRow(); 
$table->addCell(20000)->addText('Docente referente:'); 
$table->addRow(); 
$table->addCell(20000)->addText('Docenti accompagnatori:'); 
$table->addRow(); 



$table->addCell(20000)->addText('Realizzazione dell iniziativa: '); 
//i would insert in this cell^the bullet list here below 
$section->addListItem("secondo le previsioni"); 
$section->addListItem("parzialmente realizzata (motivare)"); 
$section->addListItem("non realizzata (motivare)"); 

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); 
$objWriter->save('Prova.docx'); 



//header("Location: stampa_proposte.php");?> 

The result that I will get is this

감사 : 이 내 코드입니다.

답변

0

은 너무 대신 현재의 코드, 그것은 당신이 셀에 텍스트를 추가하는 방법을 수행

$table_cell = $table->addCell(20000);//assign cell a variable 
//add elements to cell. For square bullets refer documentation 
$table_cell->addText('Realizzazione dell iniziativa: '); 
$table_cell->addListItem("secondo le previsioni",0);//0 is the list level 
$table_cell->addListItem("parzialmente realizzata (motivare)",0); 
$table_cell->addListItem("non realizzata (motivare)",0); 
:이 같은 테이블 셀에 목록 항목을 삽입 할 수 있습니다
$table->addCell(20000)->addText('Realizzazione dell iniziativa: '); 
//i would insert in this cell^the bullet list here below 
$section->addListItem("secondo le previsioni"); 
$section->addListItem("parzialmente realizzata (motivare)"); 
$section->addListItem("non realizzata (motivare)");