Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Charts PHPExcel图表保护_Charts_Phpexcel - Fatal编程技术网

Charts PHPExcel图表保护

Charts PHPExcel图表保护,charts,phpexcel,Charts,Phpexcel,我使用PHPExcel库生成图表,并使用下面的语句来保护图表,但除图表区域外,excel的所有其他单元格都受到保护。如何保护图表区域不被编辑和拖动?谢谢你的帮助和建议 $workbook->getSecurity()->setLockWindows(true); $workbook->getSecurity()->setLockStructure(true); $workbook->getSecurity()->setWorkbookPassword("asd

我使用PHPExcel库生成图表,并使用下面的语句来保护图表,但除图表区域外,excel的所有其他单元格都受到保护。如何保护图表区域不被编辑和拖动?谢谢你的帮助和建议

$workbook->getSecurity()->setLockWindows(true);
$workbook->getSecurity()->setLockStructure(true);
$workbook->getSecurity()->setWorkbookPassword("asd");
$sheet->getProtection()->setSheet(true);
$sheet->getProtection()->setSort(true);
$sheet->getProtection()->setInsertRows(true);
$sheet->getProtection()->setInsertColumns(true);
$sheet->getProtection()->setFormatCells(true);
$sheet->getProtection()->setSelectUnlockedCells(false);
$sheet->getProtection()->setSelectLockedCells(true);
$sheet->getProtection()->setPassword("asd");
这里可能有一些语法错误,但实际上不存在语法问题。我现在唯一想做的就是保护图表区域不被编辑和拖动。
在上面的代码中,设置SelectLockedCells(true)执行此任务,但当我打开文件并取消保护时,如果我单击“确定”按钮而不更改保护,则图表会将其保护更改为我所需的保护,那么我如何才能做到这一点,而无需进入“取消保护”菜单并单击“确定”按钮?

此选项不适用于PHPExcel中的图表,只有工作表中的单元格才能保护数据标签、x轴、y轴标签和图表标题?图表中的任何元素都没有保护选项,只有单元格中的数据才有保护选项,因为此选项可用:@GrzegorzAdamKowalski I stand corrected,我想我不记得两年前写的东西了should@MarkBaker当我下载并打开生成的文件时,显示的确认消息表明图纸图表不可读,当我单击“是”按钮确认修复时,不显示图表,不可读内容的原因是什么