我正在考虑改变我们目前的内部网,它使用RTF文件,这样它就可以使用docx。
我们需要能够更改模板,然后将其与来自intranet的一些数据一起注入,并将其保存为docx文件。
为此,我找到了TinyButStrong插件,它似乎能够做我们想要的事情。
我已经做了一些测试,可以让它将文件保存在与模板相同的文件夹中。但是我不能把它保存到另一个位置。
它给出了这个错误:
TinyButStrong Error OpenTBS Plugin: Method Flush() cannot overwrite the target file '//SERVER/SHARE/FOLDER/SUBFOLDER/ANOTHER SUBFOLDER/document name.docx'. This may not be a valid file path or the file may be locked by another process or because of a denied permission. The process is ending, unless you set NoErr property to true.我不认为这是一个预授权错误,因为我使用的是与我们的RTF文件相同的脚本,并且它们被保存在相同的位置,因为我需要这样做。
但是我确信只有我,没有正确地理解TinyButStrong,那么我如何让它保存在动态文件路径中?
下面是我尝试处理动态文件路径的地方。
$file = "//$SERVER/$KATALOG/".$_GET['type'].$root.$nr."/"; //.$_GET['type'].$nr."R".$rev."-".$sprog.".rtf";
//echo $template;
$output_file_name = str_replace('.', '_'.date('Y-m-d').$save_as.'.', $filename);
echo $output_file_name = $file . $output_file_name;
if ($save_as==='') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name); // Also merges all [onshow] automatic fields.
// Be sure that no more output is done, otherwise the download file is corrupted with extra data.
exit();
} else {
// Output the result as a file on the server.
$TBS->Show(OPENTBS_FILE, $output_file_name); // Also merges all [onshow] automatic fields.
// The script can continue.
exit("File [$output_file_name] has been created.");
} 发布于 2017-06-28 08:38:15
您似乎正在使用TinyButStrong的OpenTBS插件。
在编写目标文件时,OpenTBS只使用fopen($File, 'w')函数。
您得到的错误消息表明PHP无法在写入模式下打开此文件的句柄。原因可能有很多,但您可以使用您提到的文件路径进行检查。
发布于 2018-01-12 11:31:09
我遇到了与OPENTBS相同的错误,在我的情况下,很简单,我忘记创建目录文件夹来存储输出文件
https://stackoverflow.com/questions/44783437
复制相似问题