1

i am trying to draw a table in phpword with laravel code below is example of writing something in the doc file.

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

    $newSection = $wordTest->addSection();

    $desc1 = "The Portfolio details is a very useful feature of the web page. You can establish your archived details and the works to the entire web community. It was outlined to bring in extra clients, get you selected based on this details.";

    $newSection->addText($desc1, array('name' => 'Tahoma', 'size' => 15, 'color' => 'red'));

    $objectWriter = \PhpOffice\PhpWord\IOFactory::createWriter($wordTest, 'Word2007');

    $objectWriter->save(storage_path('TestWordFile.docx'));

please give me an example of how i can draw table there

1 Answers1

0

to draw a table i normally use this code

$table = array('borderColor'=>'black', 'borderSize'=> 1, 'cellMargin'=>50, 'valign'=>'center');
        $phpWord->addTableStyle('table', $table);
        $table = $section->addTable('table');
        $table->addRow();
        $table->addCell(1750)->addText(htmlspecialchars("#"),$bold);
        $table->addCell(1750)->addText(htmlspecialchars("Attendance Date "),$bold);
Tanvir Ahmed
  • 969
  • 12
  • 24