ExcelWorksheet を使用して動的な Excel シートを作成しています。編集不可能なエクセルを作成する必要があります。ws.Cells["A1:Q12"].Style.Locked = trueが機能していません。
これが私のコードです:
Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
    {
      string filePath = Server.MapPath("~/Download/Sample.xlsx");
      using (ExcelPackage pck = new ExcelPackage())
      {
       FileInfo summaryFilePath = new FileInfo(filePath);    
       ExcelWorksheet ws= pck.Workbook.Worksheets.Add("Sample Page");
       CreateForamters(ws);
      }
    }
 private void CreateForamters(ExcelWorksheet ws)
    {
        ws.Cells["B8:L8"].Value = "SamplePage";           
        ws.Cells["B10:L10"].Value = DateTime.Now.ToString("MMM-yy");
        ws.Cells["B11:L11"].Value = "test data........-";
        ws.Cells["B8:L11"].Style.Fill.PatternType = ExcelFillStyle.Solid;
        ws.Cells["B8:L11"].Style.Font.Bold = true;
        ws.Cells["B8:L11"].Style.Font.Name = "Arial";
        ws.Cells["B8:L11"].Style.Font.Size = 16;
        ws.Cells["B8:L11"].Style.Font.Color.SetColor(Color.Blue);
        ws.Cells["B8:L11"].Style.Fill.BackgroundColor.SetColor(Color.White);
        ws.Cells["B8:L11"].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
        ws.Cells["B8:L8"].Merge = true;
        ws.Cells["B9:L9"].Merge = true;
        ws.Cells["B10:L10"].Merge = true;
        ws.Cells["B11:L11"].Merge = true;
        ws.Cells["A1:Q12"].Style.Locked = true;
    }
ご回答いただきありがとうございます。