示例#1
0
        private static void ReadENwisFlagsExcelToSql(string inputExcelFile, StringBuilder sb)
        {
            if (!File.Exists(inputExcelFile))
            {
                throw new ArgumentException("Input excel file '" + inputExcelFile + "' does not exist!");
            }

            object misValue   = Missing.Value;
            var    xlApp      = new Excel.Application();
            var    xlWorkBook = xlApp.Workbooks.Open(inputExcelFile, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            var    flagsTable = new ExcelTable("Sheet1", 'A', 'F');

            if (xlWorkBook != null)
            {
                flagsTable.Load(xlWorkBook);
                xlWorkBook.Close(true, misValue, misValue);
                xlApp.Quit();
            }
            ReleaseObject(xlWorkBook);
            ReleaseObject(xlApp);

            Console.WriteLine("[Debug] flagsTable is loadded.");

            sb.AppendLine(@"USE $(DBName)");
            sb.AppendLine(@"DECLARE @CNT INT;");
            sb.AppendLine(@"DECLARE @FlagDataId NUMERIC(18);");
            sb.AppendLine();
            ReadFlags(flagsTable, sb);
        }
示例#2
0
 public void Load(Excel.Workbook xlWorkBook)
 {
     ParamTable.Load(xlWorkBook);
     UnitsTable.Load(xlWorkBook);
     UnitsGroupTable.Load(xlWorkBook);
 }