Пример #1
0
        private void PrintOutput_Data()
        {
            try
            {
                Stream responseStream = null;

                responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding("db2.coever.co.kr:8500/USER/PROGRAM_VIEW/frmMainPrinter/", "frmMainPrinterReport.xlsx", "ftpadmin", "Ftp89897788!#%");

                spreadsheetControl1.LoadDocument(responseStream);
                wb = spreadsheetControl1.Document;

                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;

                para["v_option1"].Value = "";                                                                                     // KEY값
                para["v_option2"].Value = "";                                                                                     // 사용여부
                para["v_option3"].Value = "";                                                                                     // 사용자
                para["v_option4"].Value = textBox1.Text == "" ?  gridView1.GetRowCellValue(0, "PONO").ToString() : textBox1.Text; //첫 데이터 발행
                para["v_option5"].Value = falg_print;

                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();
                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                    wb.Worksheets[0].ActiveView.Zoom = 20;   // 엑셀 시트 Size 조정

                    // Create an object containing printer settings.
                    PrinterSettings printerSettings = new PrinterSettings();

                    // Define the printer to use.
                    printerSettings.PrinterName   = "frmMainPrinterReport";
                    printerSettings.PrintToFile   = true;
                    printerSettings.PrintFileName = "frmMainPrinterReport.xlsx";

                    // Specify that the first three pages should be printed.
                    printerSettings.PrintRange = PrintRange.SomePages;
                    printerSettings.FromPage   = 1;
                    printerSettings.ToPage     = 3;

                    // Set the number of copies to print.
                    printerSettings.Copies = 1;

                    // Print the document using the specified printer settings.
                    spreadsheetControl1.Print();// .Print(printerSettings);

                    Message_Log("발행", true, true);
                }
            }
            catch (Exception ex)
            {
                Message_Log("[PrintOutput_Data] :" + ex.ToString(), true, true);
                //  tmrWorkOrder.Change(10000, 10000);
            }
        }
Пример #2
0
        private void Form_SearchButtonClicked(object pSender, EventArgs pEventArgs)
        {
            try
            {
                Stream responseStream = null;

                string strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_IP_PORT, "USER", "PROGRAM_VIEW", _pWINDOW_NAME);

                responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, "Sample_Base3.xlsx", _pFTP_ID, _pFTP_PW);

                spreadsheetControl1.LoadDocument(responseStream);

                wb = spreadsheetControl1.Document;


                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;

                para["From_Date"].Value    = _luT_DATE.FromDateTime.ToString("yyyyMMdd");
                para["To_Date"].Value      = _luT_DATE.ToDateTime.ToString("yyyyMMdd");
                para["Part_Name"].Value    = "";
                para["Process_Name"].Value = "";

                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();

                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                    worksheet = wb.Worksheets[0];
                    worksheet.ActiveView.Zoom = 50;
                }

                //spreadsheetCommandBarButtonItem133.PerformClick();

                //Worksheet ws = wb.Worksheets[spreadsheetControl1.ActiveSheet.Name];
                //Range rg = ws.Range["E1:E100"];
                //ws.CustomCellInplaceEditors.Add(rg, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(ws.Range["A1:A100"]));
            }
            catch (ExceptionManager pExceptionManager)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
            }
            catch (Exception ex)
            {
                CoFAS_DevExpressManager.ShowInformationMessage(_pMSG_SEARCH_EMPT);
                //CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", ex.Message.ToString(), ex.TargetSite.ToString()));
            }
            finally
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.Default);
            }
        }
Пример #3
0
        private void Form_SearchButtonClicked(object pSender, EventArgs pEventArgs)
        {
            try
            {
                if (wb == null)
                {
                    return;
                }
                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;

                //para["v_option1"].Value = textEdit1.Text == null ? "" : textEdit1.Text;

                para["v_crud"].Value      = "R";
                para["v_date_from"].Value = DateTime.Parse(_luTPRODUCTION_ORDER_DATE.FromDateTime.ToString()).ToString("yyyyMMdd") == null ? "" : DateTime.Parse(_luTPRODUCTION_ORDER_DATE.FromDateTime.ToString()).ToString("yyyyMMdd");
                para["v_date_to"].Value   = DateTime.Parse(_luTPRODUCTION_ORDER_DATE.ToDateTime.ToString()).ToString("yyyyMMdd") == null ? "" : DateTime.Parse(_luTPRODUCTION_ORDER_DATE.ToDateTime.ToString()).ToString("yyyyMMdd");

                //para["v_crud"].Value = "R";
                //para["v_date_from"].Value = "20180701" == null ? "" : "20180801";
                //para["v_date_to"].Value = "20180830" == null ? "" : "20180830";


                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();
                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                }


                //spreadsheetCommandBarButtonItem133.PerformClick();

                //Worksheet ws = wb.Worksheets[spreadsheetControl1.ActiveSheet.Name];
                //Range rg = ws.Range["E1:E100"];
                //ws.CustomCellInplaceEditors.Add(rg, CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(ws.Range["A1:A100"]));
            }
            catch (ExceptionManager pExceptionManager)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
            }
            catch (Exception ex)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", ex.Message.ToString(), ex.TargetSite.ToString()));
            }
            finally
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.Default);
            }
        }
        // DB 처리
        #region ○ 메인조회 - MainFind_DisplayData()

        private void MainFind_DisplayData()
        {
            try
            {
                Stream responseStream = null;

                string strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_IP_PORT, "USER", "PROGRAM_VIEW", _pWINDOW_NAME);

                responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, "LotManagementReport1.xlsx", _pFTP_ID, _pFTP_PW);

                spreadsheetControl1.LoadDocument(responseStream);

                wb = spreadsheetControl1.Document;


                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;

                para["v_option1"].Value = _luTORDER_DATE.FromDateTime.ToString("yyyyMMdd");
                para["v_option2"].Value = _luTORDER_DATE.ToDateTime.ToString("yyyyMMdd");


                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();

                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                    worksheet = wb.Worksheets[0];
                    worksheet.ActiveView.Zoom = 50;
                }
            }
            catch (ExceptionManager pExceptionManager)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
            }
            finally
            {
                //_gdMAIN_VIEW.BestFitColumns();

                CoFAS_DevExpressManager.SetCursor(this, Cursors.Default);
            }
        }
Пример #5
0
        private void MainFind_DisplayData()
        {
            try
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor);

                Stream responseStream = null;

                responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW);

                spreadsheetControl1.LoadDocument(responseStream);

                wb = spreadsheetControl1.Document;

                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;

                para["v_option1"].Value = ARRAY_CODE[0].ToString(); // R
                para["v_option2"].Value = ARRAY_CODE[1].ToString(); // _pINOUT_CODE_LIST

                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();
                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                }
            }
            catch (ExceptionManager pExceptionManager)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
            }
            finally
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.Default);
            }
        }
Пример #6
0
        private void MainFind_DisplayData()
        {
            try
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor);

                Stream responseStream = null;

                if (ARRAY_CODE[0].ToString().Equals("OutsourcingInfoRegister"))
                {
                    responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW);
                }
                else if (ARRAY_CODE[0].ToString().Equals("WorkResultRegister_T06"))
                {
                    responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW);
                }
                else if (ARRAY_CODE[0].ToString().Equals("WorkResultRegister_T05"))
                {
                    responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW);
                }
                else if (ARRAY_CODE[0].ToString().Equals("WorkResultRegister_T08"))
                {
                    responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW);
                }

                spreadsheetControl1.LoadDocument(responseStream);

                wb = spreadsheetControl1.Document;

                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;

                para["v_option1"].Value = ARRAY_CODE[1].ToString(); // KEY값
                para["v_option2"].Value = ARRAY_CODE[2].ToString(); // 사용여부
                para["v_option3"].Value = USER_CODE;                // 사용자
                para["v_option4"].Value = ARRAY_CODE[3].ToString(); // 페이징 행수 기준
                para["v_option5"].Value = ARRAY_CODE[4].ToString(); // 시작번호


                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();
                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                }
            }
            catch (ExceptionManager pExceptionManager)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
            }
            catch (Exception ex)
            {
                CoFAS_DevExpressManager.ShowErrorMessage("Exception :" + ex.ToString());
            }
            finally
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.Default);
            }
        }
Пример #7
0
        private void MainFind_DisplayData()
        {
            try
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor);

                Stream responseStream = null;

                responseStream = CORE.Function.CoFAS_FTPManager.FTPFileBinding(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW);

                spreadsheetControl1.LoadDocument(responseStream);

                wb = spreadsheetControl1.Document;

                if (wb.MailMergeDataSource == null)
                {
                    return;
                }

                /*
                 * switch (DBManager.PrimaryDBManagerType)
                 * {
                 *  case DBManagerType.MySql:
                 *      wb.MailMergeDataSource = new DevExpress.DataAccess.Sql.SqlDataSource(new MySqlConnectionParameters(DBManager.InitDatabaseServer, DBManager.InitDatabaseName, DBManager.InitDatabaseID, DBManager.InitDatabasePass, 3306));
                 *      break;
                 *  case DBManagerType.SQLServer:
                 *      wb.MailMergeDataSource = new MsSqlConnectionParameters();
                 *      break;
                 * }
                 */


                Object dsTemp             = wb.MailMergeDataSource;
                ParametersCollection para = wb.MailMergeParameters;



                para["v_option1"].Value = ARRAY_CODE[1].ToString(); // KEY값
                para["v_option2"].Value = ARRAY_CODE[2].ToString(); // 사용여부
                para["v_option3"].Value = USER_CODE;                // 사용자
                para["v_option4"].Value = ARRAY_CODE[3].ToString(); // 페이징 행수 기준
                para["v_option5"].Value = ARRAY_CODE[4].ToString(); // 시작번호


                IList <IWorkbook> result = wb.GenerateMailMergeDocuments();
                using (MemoryStream resultStream = new MemoryStream())
                {
                    result[0].SaveDocument(resultStream, DocumentFormat.OpenXml);
                    wb.LoadDocument(resultStream);
                }
            }
            catch (ExceptionManager pExceptionManager)
            {
                CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString()));
            }
            catch (Exception ex)
            {
                CoFAS_DevExpressManager.ShowErrorMessage("Exception :" + ex.ToString());
            }
            finally
            {
                CoFAS_DevExpressManager.SetCursor(this, Cursors.Default);
            }
        }
Пример #8
0
 private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
 {
     IWorkbook         workbook  = spreadsheetControl.Document;
     IList <IWorkbook> workbooks = workbook.GenerateMailMergeDocuments();
 }