在Php中取消保护工作表

Aspose.Cells - 取消保护工作表

要使用Aspose.Cells Java for PHP取消保护工作表,请调用protection模块的unprotect_worksheet方法。

PHP 代码

 $filesFormatType = new FileFormatType();

//Instantiating a Workbook object

$workbook = new Workbook($dataDir . "book1.xls");

$worksheets = $workbook->getWorksheets();

$worksheet = $worksheets->get(0);

$protection = $worksheet->getProtection();

//Unprotecting the worksheet with a password

$worksheet->unprotect("aspose");

// Save the excel file.

$workbook->save($dataDir . "output.xls", $filesFormatType->EXCEL_97_TO_2003); 

下载运行代码

从下面提到的任何社交编码网站下载Unprotect a Worksheet (Aspose.Cells)