1

我正在使用IXLWorksheet.CopyTo方法将工作表从一个工作簿复制到另一个工作簿,并且未复制保护选项。我认为这是设计使然,但我需要复制它们。

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;
}  

有没有更好的方法,然后“手动”复制每个标志?

4

1 回答 1

0

不,没有更好的办法。

您无法复制完整的保护对象,因为其中包含已加密的密码。

于 2015-11-02T10:19:51.603 回答