public void Export2ExcelWithoutFixedRows(C1FlexGrid i_fg, int i_iFromGridCol, int i_iToGridCol, bool i_b_show)
        {
            try
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
                if (!m_init_successful)
                {
                    return;
                }
                CExportColumnFactory v_objFact = new CExportColumnFactory(i_fg, m_objExcelWorksheet);
                IExportColumn v_objExpCol = default(IExportColumn);
                int v_iGridCol = 0;
                int v_iNumberOfCol = 0;
                int v_iVisibleColsCount = 0;
                int v_iCount = 0;
                // Chen 1 so dong trong Excel tuong ung voi so Ban ghi can insert
                Range v_obj_range = m_objExcelWorksheet.Range[m_objExcelWorksheet.Cells[m_iSheetStartRow + 1, m_iSheetStartCol], m_objExcelWorksheet.Cells[m_iSheetStartRow + 1, m_iSheetStartCol]];
                for (v_iCount = i_fg.Rows.Fixed; v_iCount <= i_fg.Rows.Count - 2; v_iCount++)
                {
                    v_obj_range.EntireRow.Insert(Excel.XlDirection.xlDown, null);
                }
                for (v_iGridCol = i_iFromGridCol; v_iGridCol <= i_iToGridCol; v_iGridCol++)
                {
                    if (i_fg.Cols[v_iGridCol].Visible)
                    {
                        v_objExpCol = v_objFact.CreateExportColumn(v_iGridCol, m_iSheetStartCol + v_iNumberOfCol, m_iSheetStartRow);
                        v_iNumberOfCol++;
                        v_objExpCol.ExportWithoutFixedRows();
                        v_iVisibleColsCount++;

                    }
                }
                if (m_b_set_style)
                {
                    setStyle4Node(i_fg, v_iVisibleColsCount);
                }
                m_iSheetStartRow = m_iSheetStartRow + i_fg.Rows.Count;
                if (i_b_show)
                {
                    m_objExcelApp.Visible = true; //Not Display Excel
                    string v_strFilenameWithPath = "";
                    v_strFilenameWithPath = m_strOutputPath + System.Convert.ToString((long)(VBMath.Rnd() * 1000000000000));
                    try
                    {
                        m_objExcelApp.SaveWorkspace(v_strFilenameWithPath);
                    }
                    catch
                    {
                        //m_objExcelApp.Workbooks.Close()
                        Unmount();
                        return;
                    }

                    //m_objExcelApp.Workbooks.Close()
                    Unmount();
                }
            }
            catch (Exception v_e)
            {
                m_objExcelApp.Workbooks.Close();
                Unmount();
                throw (v_e);
            }
        }
        //Huytd
        public void Export2ExcelWithoutFixedRows_saveDialog(string str_file_name, C1FlexGrid i_fg, int i_iFromGridCol, int i_iToGridCol, bool i_b_show)
        {
            try
            {
                SaveFileDialog saveFileDialog = new SaveFileDialog();

                saveFileDialog.Filter = "Execl files (*.xls)|*.xls";

                saveFileDialog.FilterIndex = 0;

                saveFileDialog.RestoreDirectory = true;

                saveFileDialog.CreatePrompt = true;

                saveFileDialog.Title = "Export Excel File To";
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
                if (!m_init_successful)
                {
                    return;
                }
                CExportColumnFactory v_objFact = new CExportColumnFactory(i_fg, m_objExcelWorksheet);
                IExportColumn v_objExpCol = default(IExportColumn);
                int v_iGridCol = 0;
                int v_iNumberOfCol = 0;
                int v_iVisibleColsCount = 0;
                int v_iCount = 0;
                // Chen 1 so dong trong Excel tuong ung voi so Ban ghi can insert
                Range v_obj_range = m_objExcelWorksheet.Range[m_objExcelWorksheet.Cells[m_iSheetStartRow + 1, m_iSheetStartCol], m_objExcelWorksheet.Cells[m_iSheetStartRow + 1, m_iSheetStartCol]];
                v_iCount = i_fg.Rows.Fixed;
                while (v_iCount <= i_fg.Rows.Count - 2)
                {
                    v_obj_range.EntireRow.Insert(Excel.XlDirection.xlDown, null);
                    System.Math.Max(System.Threading.Interlocked.Increment(ref v_iCount), v_iCount - 1);
                }
                v_iGridCol = i_iFromGridCol;
                while (v_iGridCol <= i_iToGridCol)
                {
                    if (i_fg.Cols[v_iGridCol].Visible)
                    {
                        v_objExpCol = v_objFact.CreateExportColumn(v_iGridCol, m_iSheetStartCol + v_iNumberOfCol, m_iSheetStartRow);
                        v_iNumberOfCol++;
                        v_objExpCol.ExportWithoutFixedRows();

                        v_iVisibleColsCount++;
                    }
                    System.Math.Max(System.Threading.Interlocked.Increment(ref v_iGridCol), v_iGridCol - 1);
                }
                if (m_b_set_style)
                {
                    setStyle4Node(i_fg, v_iVisibleColsCount);
                }
                m_iSheetStartRow = m_iSheetStartRow + i_fg.Rows.Count;
                if (i_b_show)
                {
                    if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        m_objExcelApp.Visible = true;
                        //Not Display Excel
                        string v_strFilenameWithPath = "";
                        v_strFilenameWithPath = str_file_name;
                        m_objExcelApp.SaveWorkspace(v_strFilenameWithPath);
                        //m_objExcelApp.Workbooks.Close()
                        Unmount();
                    }
                }
            }
            catch (Exception v_e)
            {
                m_objExcelApp.Workbooks.Close();
                Unmount();
                throw (v_e);
            }
        }
        public void Export2Excel(C1FlexGrid i_fg, int i_iFromGridCol, int i_iToGridCol, bool i_b_show = true)
        {
            try
            {
                if (!m_init_successful)
                {
                    return;
                }
                CExportColumnFactory v_objFact = new CExportColumnFactory(i_fg, m_objExcelWorksheet);
                IExportColumn v_objExpCol = default(IExportColumn);
                int v_iGridCol = 0;
                int v_iNumberOfCol = 0;
                int v_iVisibleColsCount = 0;
                int v_iCount = 0;
                // Chen 1 so dong trong Excel tuong ung voi so Ban ghi can insert
                Range v_obj_range = m_objExcelWorksheet.Range[m_objExcelWorksheet.Cells[m_iSheetStartRow + 1, m_iSheetStartCol], m_objExcelWorksheet.Cells[m_iSheetStartRow + 1, m_iSheetStartCol]];
                for (v_iCount = i_fg.Rows.Fixed; v_iCount <= i_fg.Rows.Count - 2; v_iCount++)
                {
                    v_obj_range.EntireRow.Insert(Excel.XlDirection.xlDown, null);
                }
                for (v_iGridCol = i_iFromGridCol; v_iGridCol <= i_iToGridCol; v_iGridCol++)
                {
                    if (i_fg.Cols[v_iGridCol].Visible)
                    {
                        v_objExpCol = v_objFact.CreateExportColumn(v_iGridCol, m_iSheetStartCol + v_iNumberOfCol, m_iSheetStartRow);
                        v_iNumberOfCol++;
                        v_objExpCol.Export();
                        v_iVisibleColsCount++;
                    }
                }
                if (m_b_set_style)
                {
                    setStyle4Node(i_fg, v_iVisibleColsCount);
                }
                m_iSheetStartRow = m_iSheetStartRow + i_fg.Rows.Count;

                if (i_b_show)
                {
                    m_objExcelApp.Visible = true;
                    Unmount();
                }
            }
            catch (Exception v_e)
            {
                m_objExcelApp.Workbooks.Close();
                Unmount();
                throw (v_e);
            }
        }