コード例 #1
0
        /// <summary>
        /// delete cac dong trong cua 1 sheet
        /// </summary>
        /// <param name="p_iSheet_Index"></param>
        /// <param name="p_iStart"></param>
        /// <param name="p_iEnd"></param>
        public void Delete_Row_Du_Thua(int p_iSheet_Index, int p_iStart, int p_iEnd, string p_strTen_Col)
        {
            // Xóa các dòng trống
            myExcel.Worksheet v_objSheet = (myExcel.Worksheet)m_objWorkbook.Sheets[p_iSheet_Index];
            Microsoft.Office.Interop.Excel.Range v_objRange = v_objSheet.get_Range(p_strTen_Col + p_iStart.ToString(), p_strTen_Col + p_iEnd.ToString());

            object[,] values = (object[, ])v_objRange.Value2;
            int v_iDelete_Position = 0;

            for (int i = 1; i <= values.GetLength(0); i++)
            {
                if (CUtility.Convert_To_String(values[i, 1]).Trim() == "")
                {
                    v_iDelete_Position = i;
                    break;
                }
            }

            if (v_iDelete_Position != 0)
            {
                string v_strCell = p_strTen_Col + (v_iDelete_Position + p_iStart - 1).ToString();
                Microsoft.Office.Interop.Excel.Range rng = v_objSheet.get_Range(v_strCell, p_strTen_Col + p_iEnd.ToString());

                rng.EntireRow.Delete(Microsoft.Office.Interop.Excel.XlDirection.xlUp);
            }
        }
コード例 #2
0
        public static DateTime Convert_To_Cuoi_Ngay(DateTime p_dtmDate)
        {
            DateTime v_dtmRes = p_dtmDate;

            v_dtmRes = CUtility.ConvertFromStringToDateTime(p_dtmDate.ToString("dd/MM/yyyy") + " 23:59:59");

            return(v_dtmRes);
        }
コード例 #3
0
 public static decimal Convert_To_Decimal(object p_objData)
 {
     if ((p_objData != System.DBNull.Value) && (CUtility.Convert_To_String(p_objData) != ""))
     {
         return(Convert.ToDecimal(p_objData));
     }
     else
     {
         return(CConst.FLT_VALUE_NULL);
     }
 }
コード例 #4
0
 public static Int64 Convert_To_Int64(object p_objData)
 {
     if ((p_objData != System.DBNull.Value) && (CUtility.Convert_To_String(p_objData) != ""))
     {
         return(Convert.ToInt64(p_objData));
     }
     else
     {
         return(CConst.INT_VALUE_NULL);
     }
 }