Developer ExpressのXtraReportレポートプレビューコントロールPrintControl設定
2243 ワード
Developer ExpressのXtraReportレポート作成
コードは次のとおりです。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Preview;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Control;
namespace WFAXtraReport
{
public partial class Form1 : Form
{
public Form1 ()
{
InitializeComponent();
}
private void Form1 _Load(object sender, EventArgs e)
{
XtraReport fXtraReport = new XtraReport();
//fXtraReport.LoadLayout(@"C:\1.repx");
PrintControl printControl1 = new PrintControl();
printControl1.PrintingSystem = fXtraReport.PrintingSystem;
PrintBarManager printBarManager = new PrintBarManager();
printBarManager.Form = printControl1;
printBarManager.Initialize(printControl1);
printBarManager.MainMenu.Visible = false;
printBarManager.AllowCustomization = false;
//
printControl1.PrintingSystem.SetCommandVisibility(new PrintingSystemCommand[]{
PrintingSystemCommand.Open,
PrintingSystemCommand.Save,
PrintingSystemCommand.ClosePreview,
PrintingSystemCommand.Customize,
PrintingSystemCommand.SendCsv,
PrintingSystemCommand.SendFile,
PrintingSystemCommand.SendGraphic,
PrintingSystemCommand.SendMht,
PrintingSystemCommand.SendPdf,
PrintingSystemCommand.SendRtf,
PrintingSystemCommand.SendTxt,
PrintingSystemCommand.SendXls
}, CommandVisibility.None);
fXtraReport.CreateDocument();
Controls.Add(printControl1);
printControl1.Dock = DockStyle.Fill;
}
}
}
XtraReportの機能についてはまだたくさんありますが、細部の処理はまだたくさんあります.後で整理して、まずこのいくつかのよく使われているものを整理します.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraReports.UI;
using DevExpress.XtraPrinting.Preview;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Control;
namespace WFAXtraReport
{
public partial class Form1 : Form
{
public Form1 ()
{
InitializeComponent();
}
private void Form1 _Load(object sender, EventArgs e)
{
XtraReport fXtraReport = new XtraReport();
//fXtraReport.LoadLayout(@"C:\1.repx");
PrintControl printControl1 = new PrintControl();
printControl1.PrintingSystem = fXtraReport.PrintingSystem;
PrintBarManager printBarManager = new PrintBarManager();
printBarManager.Form = printControl1;
printBarManager.Initialize(printControl1);
printBarManager.MainMenu.Visible = false;
printBarManager.AllowCustomization = false;
//
printControl1.PrintingSystem.SetCommandVisibility(new PrintingSystemCommand[]{
PrintingSystemCommand.Open,
PrintingSystemCommand.Save,
PrintingSystemCommand.ClosePreview,
PrintingSystemCommand.Customize,
PrintingSystemCommand.SendCsv,
PrintingSystemCommand.SendFile,
PrintingSystemCommand.SendGraphic,
PrintingSystemCommand.SendMht,
PrintingSystemCommand.SendPdf,
PrintingSystemCommand.SendRtf,
PrintingSystemCommand.SendTxt,
PrintingSystemCommand.SendXls
}, CommandVisibility.None);
fXtraReport.CreateDocument();
Controls.Add(printControl1);
printControl1.Dock = DockStyle.Fill;
}
}
}