Devexpress (Development express) printing problem summary

Source: Internet
Author: User

I feel that the interface developed by express development is really good, and printing is also very convenient. It is quite troublesome to install and maintain Microsoft Crystal Reports after they are released.

I have nothing to do over the past few days. I have read some print methods for developing express trains and summarized the following methods. In fact, the official help is very detailed, this article

Only for study notes.

1 xtralayout output (the simplest way ). You can add the control to be printed to layerout,

However, these interfaces are not very good, and the printed interfaces are not ideal.

Layoutcontrol1.showprintpreview ();

Layoutcontrol1.print ()

2. Other controls that implement the iprintable interface can also be printed directly.

For example, xtragridcontrol can directly call print.

To add titles with equal external power, use the devexpress. xtraprinting. printablecomponentlink object. That is to say, you cannot use the print () method of the gridcontrol control (this is described in multiple places on the Internet)

 

Code

 1 printingsystem PS = new devexpress. xtraprinting. printingsystem ();
2
3 devexpress. xtraprinting. printablecomponentlink link = NULL;
4
5 link = new devexpress. xtraprinting. printablecomponentlink (PS );
6
7 Ps. Links. Add (Link );
8
9 link. Component = urgridcontrol; // you can assign values to all controls that implement the iprintable interface.
10
11 string strprintheader = "heardinfo ";
12
13 pageheaderfooter phf = link. pageheaderfooter as pageheaderfooter;
14
15 phf. header. content. Clear ();
16
17 phf. header. content. addrange (New String [] {"", _ printheader ,""});
18
19 phf. header. font = new system. Drawing. Font ("", 14, system. Drawing. fontstyle. Bold );
20
21 phf. header. linealignment = brickalignment. Center;
22
23 link. createdocument (); // create a document
24
25 ps. previewform. Show (); // Preview
26

 

 

 

3. When we want to make the printing better, we need to design the report.

Similar to Microsoft's Crystal Report

ASP. NMT page and Crystal Report are basically the same

Create a report class and add the reportview control to the page.

 

Code

 1 xtrareprt Port = new xtrareprt ();
2
3 reportview1.report = port;
4
5 reportview. Print ();
6
7 // In winform, printcontrol is used instead of reportview.
8 // strange. The Code also changes slightly.
9
10 xtrareport1 report = new xtrareport1 ();
11
12 // bind the report's printing system to the print control.
13
14 printcontrol1.printingsystem = report. printingsystem;
15
16 // generate the report's print document.
17
18 Report. createdocument ();
19

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.