Return to site

Devexpress Printablecomponentlink

broken image


Update
News

gridView1.OptionsView.ColumnAutoWidth = false;

gridView1 .HorzScrollVisibiity = Auto or Always

PrintableComponentLink is a link to print/export any component that supports the IPrintable interface. This component is specified by the link's PrintableComponentLinkBase.Component property. A control's export using a PrintableComponentLink is performed in WYSIWYG export mode. If you use printing system links to print or export data from a view, you should set the view's OptionsPrint.ShowPrintExportProgress property to false. Additionally, if the server mode is used, it is necessary to call the BaseView.ClearDocument method before printing. Files to look at. Form1.cs (VB: Form1.vb); How to print from the RichEditDocumentServer using the PrintableComponentLink. This example demonstrates how to use a PrintableComponentLinkBase to print from the RichEditDocumentServer. An instance of the RichEditDocumentServer loads a document, inserts a datetime stamp in its header and prints it.

2. 프린터에서 필요없는 Footer 없애기

gridView1.OptionsPrint.PrintFooter = false;

3. 컬럼헤더 중앙정렬

Print Preview for WinForms. This section describes the capabilities provided by the Print Preview form. File Management. Save a Print Preview to a File.

gridview1 -> Column Properties -> Apperance Header -> TextOptions -> HAlignment = Center

Devexpress Printablecomponentlink Component

4. 간단한 프린트 클래스 설정

using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.XtraPrinting;
using System.Drawing;

namespace Test

{
class clsReport
{
string strTitle;
string _subContent=';
float _subHeight = 20;

Devexpress

System.Drawing.Printing.PaperKind PaperKind;

Devexpress Printablecomponentlink Scale

public string subContent { get { return _subContent; } set { _subContent = value; } }

#region Print with Title
// using DevExpress.XtraPrinting;

public void Print(DevExpress.XtraPrinting.IPrintable pGrid, string pTitle, System.Drawing.Printing.PaperKind pPaperKind, bool pLandscape)
{
Print(pGrid, pTitle, pPaperKind, pLandscape, 20);
}

public void Print(DevExpress.XtraPrinting.IPrintable pGrid, string pTitle, System.Drawing.Printing.PaperKind pPaperKind, bool pLandscape, float subHeight)
{
strTitle = pTitle;
PaperKind = pPaperKind;
_subHeight = subHeight;
PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());
link.PaperKind = PaperKind;
link.Landscape = pLandscape;
link.Margins.Top = 100;
link.Margins.Bottom = 60;
link.Margins.Left = 50;
link.Margins.Right = 50;
link.Component = pGrid;
link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea);
link.CreateMarginalFooterArea += new CreateAreaEventHandler(Link_CreateMarginalFooterArea);
link.CreateDocument();
link.ShowPreview();
//link.ShowRibbonPreview(DevExpress.LookAndFeel.UserLookAndFeel.Default);
}


private void Link_CreateMarginalHeaderArea(object sender, CreateAreaEventArgs e)
{
PageInfoBrick brick = e.Graph.DrawPageInfo(PageInfo.None, strTitle, Color.DarkBlue, new RectangleF(0, 0, 110, 50), BorderSide.None);
brick.LineAlignment = BrickAlignment.Center;
brick.Font = new Font('굴림체', 18);
brick.Alignment = BrickAlignment.Center;
brick.AutoWidth = true;

Angry birds go 1.8 7 mod apk. PageInfoBrick Lbrick = e.Graph.DrawPageInfo(PageInfo.DateTime, ', Color.DarkBlue, new RectangleF(0, 0, 100, 20), BorderSide.None);
Lbrick.LineAlignment = BrickAlignment.Far;
Lbrick.Font = new Font('굴림체', 9);
Lbrick.Alignment = BrickAlignment.Far;
Lbrick.AutoWidth = true;

if (_subContent != ')
{
PageInfoBrick Sbrick = e.Graph.DrawPageInfo(PageInfo.DateTime, _subContent, Color.DarkBlue, new RectangleF(0, 0, 100, _subHeight), BorderSide.None);
Sbrick.LineAlignment = BrickAlignment.Far;
Sbrick.Font = new Font('굴림체', 9);
Sbrick.Alignment = BrickAlignment.Near;
Sbrick.AutoWidth = true;
}

Devexpress.xtraprinting.printablecomponentlink


}

private void Link_CreateMarginalFooterArea(object sender, CreateAreaEventArgs e)
{
PageInfoBrick brick = e.Graph.DrawPageInfo(PageInfo.None, CUser.Company, Color.DarkBlue, new RectangleF(0, 0, 100, 20), BorderSide.None);
brick.LineAlignment = BrickAlignment.Near;
brick.Font = new Font('굴림체', 9);
brick.Alignment = BrickAlignment.Center;
brick.AutoWidth = true;

PageInfoBrick Lbrick = e.Graph.DrawPageInfo(PageInfo.NumberOfTotal, ', Color.DarkBlue, new RectangleF(0, 0, 100, 20), BorderSide.None);
Lbrick.LineAlignment = BrickAlignment.Near;
Lbrick.Font = new Font('굴림체', 9);
Lbrick.Alignment = BrickAlignment.Far;
Lbrick.AutoWidth = true;
}
#endregion

}
}

Devexpress printablecomponentlink page header footer

1. 가로 스크롤 보이기

gridView1.OptionsView.ColumnAutoWidth = false;

gridView1 .HorzScrollVisibiity = Auto or Always

PrintableComponentLink is a link to print/export any component that supports the IPrintable interface. This component is specified by the link's PrintableComponentLinkBase.Component property. A control's export using a PrintableComponentLink is performed in WYSIWYG export mode. If you use printing system links to print or export data from a view, you should set the view's OptionsPrint.ShowPrintExportProgress property to false. Additionally, if the server mode is used, it is necessary to call the BaseView.ClearDocument method before printing. Files to look at. Form1.cs (VB: Form1.vb); How to print from the RichEditDocumentServer using the PrintableComponentLink. This example demonstrates how to use a PrintableComponentLinkBase to print from the RichEditDocumentServer. An instance of the RichEditDocumentServer loads a document, inserts a datetime stamp in its header and prints it.

2. 프린터에서 필요없는 Footer 없애기

gridView1.OptionsPrint.PrintFooter = false;

3. 컬럼헤더 중앙정렬

Print Preview for WinForms. This section describes the capabilities provided by the Print Preview form. File Management. Save a Print Preview to a File.

gridview1 -> Column Properties -> Apperance Header -> TextOptions -> HAlignment = Center

Devexpress Printablecomponentlink Component

4. 간단한 프린트 클래스 설정

using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.XtraPrinting;
using System.Drawing;

namespace Test

{
class clsReport
{
string strTitle;
string _subContent=';
float _subHeight = 20;

System.Drawing.Printing.PaperKind PaperKind;

Devexpress Printablecomponentlink Scale

public string subContent { get { return _subContent; } set { _subContent = value; } }

#region Print with Title
// using DevExpress.XtraPrinting;

public void Print(DevExpress.XtraPrinting.IPrintable pGrid, string pTitle, System.Drawing.Printing.PaperKind pPaperKind, bool pLandscape)
{
Print(pGrid, pTitle, pPaperKind, pLandscape, 20);
}

public void Print(DevExpress.XtraPrinting.IPrintable pGrid, string pTitle, System.Drawing.Printing.PaperKind pPaperKind, bool pLandscape, float subHeight)
{
strTitle = pTitle;
PaperKind = pPaperKind;
_subHeight = subHeight;
PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());
link.PaperKind = PaperKind;
link.Landscape = pLandscape;
link.Margins.Top = 100;
link.Margins.Bottom = 60;
link.Margins.Left = 50;
link.Margins.Right = 50;
link.Component = pGrid;
link.CreateMarginalHeaderArea += new CreateAreaEventHandler(Link_CreateMarginalHeaderArea);
link.CreateMarginalFooterArea += new CreateAreaEventHandler(Link_CreateMarginalFooterArea);
link.CreateDocument();
link.ShowPreview();
//link.ShowRibbonPreview(DevExpress.LookAndFeel.UserLookAndFeel.Default);
}


private void Link_CreateMarginalHeaderArea(object sender, CreateAreaEventArgs e)
{
PageInfoBrick brick = e.Graph.DrawPageInfo(PageInfo.None, strTitle, Color.DarkBlue, new RectangleF(0, 0, 110, 50), BorderSide.None);
brick.LineAlignment = BrickAlignment.Center;
brick.Font = new Font('굴림체', 18);
brick.Alignment = BrickAlignment.Center;
brick.AutoWidth = true;

Angry birds go 1.8 7 mod apk. PageInfoBrick Lbrick = e.Graph.DrawPageInfo(PageInfo.DateTime, ', Color.DarkBlue, new RectangleF(0, 0, 100, 20), BorderSide.None);
Lbrick.LineAlignment = BrickAlignment.Far;
Lbrick.Font = new Font('굴림체', 9);
Lbrick.Alignment = BrickAlignment.Far;
Lbrick.AutoWidth = true;

if (_subContent != ')
{
PageInfoBrick Sbrick = e.Graph.DrawPageInfo(PageInfo.DateTime, _subContent, Color.DarkBlue, new RectangleF(0, 0, 100, _subHeight), BorderSide.None);
Sbrick.LineAlignment = BrickAlignment.Far;
Sbrick.Font = new Font('굴림체', 9);
Sbrick.Alignment = BrickAlignment.Near;
Sbrick.AutoWidth = true;
}

Devexpress.xtraprinting.printablecomponentlink


}

private void Link_CreateMarginalFooterArea(object sender, CreateAreaEventArgs e)
{
PageInfoBrick brick = e.Graph.DrawPageInfo(PageInfo.None, CUser.Company, Color.DarkBlue, new RectangleF(0, 0, 100, 20), BorderSide.None);
brick.LineAlignment = BrickAlignment.Near;
brick.Font = new Font('굴림체', 9);
brick.Alignment = BrickAlignment.Center;
brick.AutoWidth = true;

PageInfoBrick Lbrick = e.Graph.DrawPageInfo(PageInfo.NumberOfTotal, ', Color.DarkBlue, new RectangleF(0, 0, 100, 20), BorderSide.None);
Lbrick.LineAlignment = BrickAlignment.Near;
Lbrick.Font = new Font('굴림체', 9);
Lbrick.Alignment = BrickAlignment.Far;
Lbrick.AutoWidth = true;
}
#endregion

}
}

※ 클래스 호출

Devexpress Printablecomponentlink

clsReport cReport = new clsReport();
cReport.subContent = '조회조건 : ' + dtpFrom.Value.ToString('yyyy-MM-dd') ;
cReport.Print(gridControl2, '보고서', System.Drawing.Printing.PaperKind.A4, true);





broken image