admin 管理员组

文章数量: 1184232

I am trying to protect an excel sheet where the cells can be selected but not editable I have made the cells unlocked in the cell format but the selection is disabled once the Excel file is opened.

SheetProtection sheetProtection = new SheetProtection
{
SelectLockedCells = true, // Allow selection of locked cells
SelectUnlockedCells = true
Sheet = true,             // Enable sheet protection
Objects = true,           // Protect objects (like charts)
Scenarios = true,         // Protect scenarios
FormatCells = false,      // Prevent formatting of locked cells
FormatColumns = false,    // Prevent formatting columns
FormatRows = false,       // Prevent formatting rows

                };
                sheetPart.Worksheet.InsertAfter(sheetProtection, sheetData);

In the XML file it is reflected the sheet protection and select unlocked and locked cells are true.

<x:sheetProtection sheet="1" objects="1" scenarios="1" formatCells="0" formatColumns="0" formatRows="0" selectLockedCells="1" selectUnlockedCells="1" />

expectation is the excel sheet were the cells can selectable, so the unlocked cells can be edited.

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)