Excel read and write, prompting security level issues

problem description: because the data in Excel needs to be written to the database, Excel helper classes and NPOI references have been added, but before running to this step

IWorkbook workbook = WorkbookFactory.Create(stream);//excel/
When

, an error is prompted, as shown in the following figure

clipboard.png

< hr > The version of

NPOI is 2.4.1.0. ICSharpCode.SharpZipLib version 0.84.0.0, also used 1.0, but the problem is still

< hr >

related codes

 public static DataSet ReadExcel(string FileName, int startRow, params NpoiDataType[] ColumnDataType)
        {
            int ertime = 0;
            int intime = 0;
            DataSet ds = new DataSet("ds");
            DataTable dt = new DataTable("dt");
            DataRow dr;
            StringBuilder sb = new StringBuilder();
            using (FileStream stream = new FileStream(@FileName, FileMode.Open, FileAccess.Read))
            {
                IWorkbook workbook = WorkbookFactory.Create(stream);//excel/
                ISheet sheet = workbook.GetSheetAt(0);//sheet
                int j;
                IRow row;
                -sharpregion ColumnDataType
                if (ColumnDataType.Length <= 0)
                {
                    row = sheet.GetRow(startRow - 1);//i
                    ColumnDataType = new NpoiDataType[row.LastCellNum];
                    for (int i = 0; i < row.LastCellNum; iPP)
                    {
                        ICell hs = row.GetCell(i);
                        ColumnDataType[i] = GetCellDataType(hs);
                    }
                }
< hr >

I have Baidu and Google solutions, one is to lower the security level, but I have tried, no effect, I do not know if I wrote the problem, there are few ways to solve the related problems.

Mar.22,2022

there is no great god, can you help me with the answer?

Menu