Newer
Older
ClosedXML / ClosedXML_Examples / Misc / WorkbookProtection.cs
@RICU RICU on 22 Jun 2017 497 bytes Remove empty regions.
using System;
using ClosedXML.Excel;

namespace ClosedXML_Examples.Misc
{
    public class WorkbookProtection : IXLExample
    {
        #region Methods

        // Public
        public void Create(String filePath)
        {
            using (var wb = new XLWorkbook())
            {
                var ws = wb.Worksheets.Add("Workbook Protection");
                wb.Protect(true, false, "Abc@123");
                wb.SaveAs(filePath);
            }
        }

        #endregion
    }
}