如何复制工作表保护选项?

我正在复制工作表从一个工作簿到另一个使用IXLWorksheet.CopyTo方法和保护选项不复制。 我认为这是devise,但我需要他们被复制。

 private void CopyProtectionOptions(IXLSheetProtection source, IXLSheetProtection target) { target.AutoFilter = source.AutoFilter; target.DeleteColumns = source.DeleteColumns; target.DeleteRows = source.DeleteRows; target.FormatCells = source.FormatCells; target.FormatColumns = source.FormatColumns; target.FormatRows = source.FormatRows; target.InsertColumns = source.InsertColumns; target.InsertHyperlinks = source.InsertHyperlinks; target.InsertRows = source.InsertRows; target.Objects = source.Objects; target.PivotTables = source.PivotTables; target.Scenarios = source.Scenarios; target.SelectLockedCells = source.SelectLockedCells; target.SelectUnlockedCells = source.SelectUnlockedCells; } 

有没有更好的办法,然后只是复制每个国旗“手边”?

不,没有更好的办法。

您不能复制完整的保护对象,因为它包含encryption的密码。