Esempio n. 1
0
 /// <summary>
 /// 写电阻、电容、电抗表格到excel文件
 /// </summary>
 /// <returns>写入的行数</returns>
 private int WriteDataToExcel()
 {
     try
     {
         int             startRow    = 2;
         int             startColumn = 1;
         RLC.Resistance  R           = RLC.Resistance.GetInstance();
         RLC.Capacitance C           = RLC.Capacitance.GetInstance();
         RLC.Inductance  L           = RLC.Inductance.GetInstance();
         if (R.dt != null && R.dt.Rows.Count > 0)
         {
             int optRows = WriteDataTable(R, startRow, startColumn);
             startRow = startRow + optRows + 5;
         }
         if (C.dt != null && C.dt.Rows.Count > 0)
         {
             int optRows = WriteDataTable(C, startRow, startColumn);
             startRow = startRow + optRows + 5;
         }
         if (L.dt != null && L.dt.Rows.Count > 0)
         {
             int optRows = WriteDataTable(L, startRow, startColumn);
             startRow = startRow + optRows + 5;
         }
         return(startRow - 2);
     }
     catch (Exception e)
     {
         throw new Exception("写数据到excel出错:" + e.Message, e);
     }
 }
 public static Inductance GetInstance()
 {
     lock (_lock)
     {
         if (inductance == null)
         {
             inductance = new Inductance();
         }
         return(inductance);
     }
 }