Reputation: 33
I need to solve this problem soon. I tried many solutions, but all the tutorials and samples create the document and download the word file into local computer. what I want is to upload or save it to the file system of the server. Please help me to solve this.
Thanks.
Upvotes: 2
Views: 2655
Reputation: 20574
PHPWord can do this:
http://phpword.codeplex.com/releases/view/49543
I have tried Examples/BasicTable.php, it creates the file on the server and doesn't download it.
Here's the code used:
<?php
require_once '../PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Add table
$table = $section->addTable();
for($r = 1; $r <= 10; $r++) { // Loop through rows
// Add row
$table->addRow();
for($c = 1; $c <= 5; $c++) { // Loop through cells
// Add Cell
$table->addCell(1750)->addText("Row $r, Cell $c");
}
}
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('BasicTable.docx');
?>
Upvotes: 1