/// <summary>PDFドキュメント形式のバイト配列へ変換</summary> /// <param name="report">すべて値を設定し、 /// <see cref="GrapeCity.ActiveReports.SectionReport.Run()"/>を実施したドキュメントを連携</param> /// <returns></returns> public static byte[] Convert(this GrapeCity.ActiveReports.SectionReport report) { byte[] result = null; using (var stream = new MemoryStream()) { new PdfExport().Export(report.Document, stream); result = stream.ToArray(); } return(result); }
public DialogResult ShowPreviewForm(IWin32Window owner, GrapeCity.ActiveReports.SectionReport report) { var previewForm = new frmVOnePreviewForm(report); var ownerForm = owner as Form; if (ownerForm != null) { previewForm.StartPosition = FormStartPosition.Manual; previewForm.SetBounds(ownerForm.Location.X, ownerForm.Location.Y, ownerForm.Width, ownerForm.Height); } return(previewForm.ShowDialog(owner)); }
public F_PDFviewer(GrapeCity.ActiveReports.SectionReport rpt) { InitializeComponent(); rpt_viewer = rpt; //PDFreport.Page_H = 0; //rpt.Run(); // run calls DataInitialize, fetch_data and details format where interactions with data are defined and and collected //PDFreport.Page_H = PDFreport.Page_H + 1; /* if (rpt==F_accueil.rpt_xls_page) { * rpt.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Custom; * rpt.PageSettings.PaperHeight = PDFreport.Page_H + rpt.PageSettings.Margins.Bottom + rpt.PageSettings.Margins.Top + (float)0.1;// il faut ajouter (float)0.1, car si la page est éxactement égale à la somme de ses composants, une autre page est quand meme créée * rpt.Run(); * }*/ PDFviewer.Document = rpt.Document; PDFviewer.Show(); }
/// <summary> /// 印刷プレビューの表示 /// </summary> /// <param name="owner"></param> /// <param name="report"></param> /// <param name="initialDirectory"></param> /// <param name="outputHandler"></param> /// <returns></returns> protected DialogResult ShowDialogPreview( IWin32Window owner, GrapeCity.ActiveReports.SectionReport report, string initialDirectory = null, Action <Form> outputHandler = null) { using (var form = new frmVOnePreviewForm(report)) { form.InitialExportPdfPath = initialDirectory; form.OutputHandler = outputHandler; form.ShowSaveFileDialogHandler = ShowSaveFileDialogForPdfExport; var ownerForm = owner as Form; form.StartPosition = FormStartPosition.Manual; form.SetBounds(ownerForm.Left, ownerForm.Top, ownerForm.Width, ownerForm.Height); return(form.ShowDialog(ParentForm)); } }
private void PrintCustomerMaster() { ZeroLeftPaddingWithoutValidated(); if (!RequiredCheck()) { return; } CustomerSearch customerSearch = CreateSearchCondition(); ClearStatusMessage(); Task task = null; GrapeCity.ActiveReports.SectionReport report = null; string serverPath = null; if (rdoCustomerMasterList.Checked) { task = ServiceProxyFactory.LifeTime(async factory => { serverPath = await GetServerPath(); var service = factory.Create <CustomerMasterClient>(); CustomersResult result = await service.GetItemsAsync(SessionKey, CompanyId, customerSearch); if (result.ProcessResult.Result) { var customerList = new List <Customer>(result.Customers); if (customerList.Any()) { var cusReport = new CustomerSectionReport(); cusReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); cusReport.Name = "得意先マスター一覧" + DateTime.Today.ToString("yyyyMMdd"); cusReport.SetData(customerList); cusReport.Run(false); report = cusReport; } } }); } else if (rdoCustomerLedger.Checked) { ClearStatusMessage(); task = ServiceProxyFactory.LifeTime(async factory => { serverPath = await GetServerPath(); var service = factory.Create <CustomerMasterClient>(); CustomersResult result = await service.GetItemsAsync(SessionKey, CompanyId, customerSearch); if (result.ProcessResult.Result) { var ledgerList = new List <Customer>(result.Customers); if (ledgerList.Any()) { var cusAccReport = new CustomerAccountSectionReport(); cusAccReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); cusAccReport.Name = "得意先台帳" + DateTime.Now.ToString("yyyyMMdd"); cusAccReport.SetData(ledgerList, UsePublishInvoice, UseReminder); cusAccReport.Run(false); report = cusAccReport; } } }); } else { ClearStatusMessage(); task = ServiceProxyFactory.LifeTime(async factory => { serverPath = await GetServerPath(); var service = factory.Create <CustomerFeeMasterClient>(); CustomerFeesResult result = await service.GetForPrintAsync(SessionKey, CompanyId); if (result.ProcessResult.Result) { var cusFeeList = new List <CustomerFee>(result.CustomerFeePrint); int precision = 0; if (UseForeignCurrency) { precision = cusFeeList.Select(x => x.CurrencyPrecision).Max(); } if (cusFeeList.Any()) { CustomerFeeSectionReport cusFeeReport = new CustomerFeeSectionReport(); cusFeeReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); cusFeeReport.Name = "登録手数料一覧" + DateTime.Now.ToString("yyyyMMdd"); cusFeeReport.Precision = precision; cusFeeReport.SetData(cusFeeList, ApplicationControl.UseForeignCurrency); cusFeeReport.Run(false); report = cusFeeReport; } } }); } if (task != null) { ProgressDialog.Start(ParentForm, Task.Run(() => task), false, SessionKey); if (report == null) { ShowWarningDialog(MsgWngPrintDataNotExist); return; } ShowDialogPreview(ParentForm, report, serverPath); } }