在服务器中生成word文档';的文件系统


Generate a word document in the server's file system in PHP

我需要尽快解决这个问题。我尝试了许多解决方案,但所有的教程和示例都创建了文档并将word文件下载到本地计算机中。我想要的是上传或保存到服务器的文件系统。请帮我解决这个问题。

谢谢。

PHPWord可以做到这一点:

http://phpword.codeplex.com/releases/view/49543

我尝试过Examples/BasicTable.php,它在服务器上创建了文件,但没有下载

这是使用的代码:

<?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');
?>