Title processing when printing with devexpress parts

Source: Internet
Author: User

How can I add titles when printing all printable parts of devexpress components, such as gridcontrol, treelist.

View help and find that you need to use devexpress. xtraprinting. printablecomponentlink to implement this object. That is to say, the print () method of the gridcontrol control cannot be used.

In the devexpress. xtraprinting namespace, you can find a class such as pageheaderfooter. Of course, this class is to set the header and footer. We can use it to set the title or page-related information for printing.

Printingsystem PS = NULL;
Devexpress. xtraprinting. printablecomponentlink link = NULL;

PS = new devexpress. xtraprinting. printingsystem ();
Link = new devexpress. xtraprinting. printablecomponentlink (PS );
PS. Links. Add (Link );
Link. Component = urgridcontrol; // This can be a printable part.

String _ printheader = "my title information ";

Pageheaderfooter phf = link. pageheaderfooter as pageheaderfooter;
Phf. header. content. Clear ();
Phf. header. content. addrange (New String [] {"", _ printheader ,""});
Phf. header. font = new system. Drawing. Font ("", 14, system. Drawing. fontstyle. Bold );
Phf. header. linealignment = brickalignment. Center;

Link. createdocument (); // create a document
PS. previewform. Show (); // Preview

In fact, it is best to use the above method to print in devexpress. When printing, we only need to set different iprintable objects (marked in red above ). Easy to use.

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.