JanKallman / EPPlus

Create advanced Excel spreadsheets using .NET
3.75k stars 1.17k forks source link

NET Core doesn't support SignedCms yet. #612

Open kenzouno1 opened 4 years ago

kenzouno1 commented 4 years ago

I want to use VBA Project in net core 2.2 but it throws error NET Core doesn't support SignedCms yet.

Mycode

            ExcelPackage pck = new ExcelPackage();
            var sheet = pck.Workbook.Worksheets.Add("DANH SACH KHACH HANG");

            var code = "Private Sub Worksheet_Change(ByVal Target As Range) \n"+
            "Code by Sumit Bansal from https://trumpexcel.com\n"+
            " To allow multiple selections in a Drop Down List in Excel (without repetition)\n"+
            "Dim Oldvalue As String\n" +
                "Dim Newvalue As String\n" +
                "Application.EnableEvents = True\n" +
                "On Error GoTo Exitsub\n" +
                "If Target.Address = \"$C$2\" Then\n" +
                "If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then\n" +
                "GoTo Exitsub\n" +
                "Else: If Target.Value = \"\" Then GoTo Exitsub Else\n" +
                "Application.EnableEvents = False\n" +
                "Newvalue = Target.Value\n" +
                "Application.Undo\n" +
                "Oldvalue = Target.Value\n" +
                "If Oldvalue = \"\" Then\n" +
                "Target.Value = Newvalue\n" +
                "Else\n" +
                "If InStr(1, Oldvalue, Newvalue) = 0 Then\n" +
                "Target.Value = Oldvalue & \", \" & Newvalue\n" +
                "Else:\n" +
                "Target.Value = Oldvalue\n" +
                "End If\n" +
                "End If\n" +
                "End If\n" +
                "End If\n" +
                "Application.EnableEvents = True\n" +
                "Exitsub:\n" +
                "Application.EnableEvents = True\n" +
                "End Sub";
            pck.Workbook.CreateVBAProject();
            sheet.CodeModule.Code = code;

  return File(pck.GetAsByteArray(), "application/vnd.ms-excel.sheet.macroEnabled.12",
                $@"Mau-Nhap-Ds-Khach-Hang-{DateTime.Now.ToShortDateString()}.xlsm");