void _bwN_DoWork(object sender, DoWorkEventArgs e)
 {
     ReportSelector rs = new ReportSelector(_SelectBRec);
     IReportBuilder builder = rs.GetReport() as IReportBuilder;
 }
        /// <summary>
        /// 產生報表
        /// </summary>
        public void Print()
        {
            // 取得異動名冊畫面上所選擇異動名冊ID
            _SelectBRecID = UpdateRecordModule_SH_D.BL.Get.UpdateBatchSelectID();
            // 透過異動名冊ID取得異動名冊
            _SelectBRec = UpdateRecordModule_SH_D.BL.Get.StudUpdateRecBatchRecByID(_SelectBRecID);

            try
            {
                    ReportSelector rs = new ReportSelector(_SelectBRec);
                    IReportBuilder builder = rs.GetReport() as IReportBuilder;

                    progressBarX1.Value = 0;
                    pnlReport.Visible = true;

                    builder.ProgressChanged += new ProgressChangedEventHandler(builder_ProgressChanged);
                    builder.Completed += new RunWorkerCompletedEventHandler(builder_Completed);
                    path = Path.Combine(Application.StartupPath, "Reports");
                    if (!Directory.Exists(path))
                        Directory.CreateDirectory(path);
                    path = Path.Combine(path, _SelectBRec.UpdateType + ".xls");

                    if (File.Exists(path))
                    {
                        int i = 1;
                        while (true)
                        {
                            string newPath = Path.GetDirectoryName(path) + "\\" + Path.GetFileNameWithoutExtension(path) + (i++) + Path.GetExtension(path);
                            if (!File.Exists(newPath))
                            {
                                path = newPath;
                                break;
                            }
                        }
                    }
                    try
                    {
                        File.Create(path).Close();
                    }
                    catch
                    {
                        SaveFileDialog sd = new SaveFileDialog();
                        sd.Title = "另存新檔";
                        sd.FileName = Path.GetFileNameWithoutExtension(path) + ".xls";
                        sd.Filter = "Excel檔案 (*.xls)|*.xls|所有檔案 (*.*)|*.*";
                        if (sd.ShowDialog() == DialogResult.OK)
                        {
                            try
                            {
                                File.Create(sd.FileName);
                                path = sd.FileName;
                            }
                            catch
                            {
                                FISCA.Presentation.Controls.MsgBox.Show("指定路徑無法存取。", "建立檔案失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }
                    }

                    builder.BuildReport((XmlElement)_SelectBRec.Content.FirstChild, path);

                // 產生異動名冊的過程,系統佔用之記憶體,回收之
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            }
            catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show("產生電子報表失敗." + ex.Message);
            }
        }