使用Pear-Spreadsheet_Excel_Writer的只读文件

我使用..Pear-Spreadsheet_Excel_Writer-0.9.3生成Excel文件

我的文件生成没有任何错误,但它是在<只读>模式下,

我研究,但找不到结果,除了,我的本地文件夹的权限存储在Excel输出,我尝试了所有CHMOD的东西,但仍然在只读模式下生成的文件。 我想禁用这个只读模式。

示例代码是….

<?php require_once 'Spreadsheet/Excel/Writer.php'; $workbook = new Spreadsheet_Excel_Writer('/tmp/yXcel.ods'); //$workbook->setTempDir('/tmp/'); $format_bold =& $workbook->addFormat(); $format_bold->setBold(); $format_title =& $workbook->addFormat(); $format_wrap =& $workbook->addFormat(); $format_title->setBold(); $format_title->setColor('yellow'); $format_title->setPattern(10); $format_title->setFgColor('blue'); // let's merge $format_title->setAlign('merge'); $format_wrap->setTextWrap(2); $format_top =& $workbook->addFormat(); $format_top->setAlign('top'); $format_top->setTextWrap(1); // center the text horizontally $format_center =& $workbook->addFormat(); $format_center->setAlign('center'); // put text at the top and center it horizontally $format_top_center =& $workbook->addFormat(); $format_top_center->setAlign('top'); $format_top_center->setAlign('center'); $worksheet =& $workbook->addWorksheet(); $worksheet->write(0, 0, "Title with Merged Cells", $format_title); // Couple of empty cells to make it look better $worksheet->write(0, 1, "", $format_title); $worksheet->write(0, 2, "", $format_title); $worksheet->write(0, 3, "", $format_title); $worksheet->write(1, 0, "Quarter", $format_bold); $worksheet->write(1, 1, "Profit", $format_bold); $worksheet->write(2, 0, "Q1asddddddddddddddddddddddddd",$format_wrap); $worksheet->write(2, 1, 2205,$format_top_center); $worksheet->write(3, 0, "Q2",$format_wrap); $worksheet->write(3, 1, 3305,$format_top); //$workbook->send('test1.xls'); $workbook->close(); ?> 

我解决了它

  chmod('/tmp/yXcel.ods',0777) 

不过,任何帮助将不胜感激,谢谢!

<只读>模式

Excel电子表格不具有“只读”模式。 Excel或LibreOffice报表为只读的主要通常与电子表格文件权限(或该文件的所有权)有关,该权限可能会阻止写入但不能读取。 一旦你下载/复制文件到你所拥有的位置,也应该可以编辑它。 如果还没有,确保文件的权限是不是也阻止它。