NEWS

[DEVEXPRESS] Xuất file PDF từ lịch Schedule Control C#

[DEVEXPRESS] Xuất file PDF từ lịch Schedule Control C#
Đăng bởi: Thảo Meo - Lượt xem: 4284 15:08:48, 19/12/2019DEVEXPRESS   In bài viết

Xin chào các bạn, bài viết hôm nay mình sẽ tiếp tục viết về Schedule Control trong Devexpress C#. Ở bài này mình sẽ hướng dẫn các bạn cách xuất file PDF từ Schedule Control Month View.

Dưới đây là giao diện Schedule Control MonthView lịch quét thẻ của nhân viên:

pdf_scheduler_csharp

Và bây giờ là mình muốn xuất ứng dụng này ra file Pdf, để in và gởi cho nhân viên.

Dưới đây là kết quả sau khi chúng ta in ra được từ lịch quét thẻ.

schedule_control

Tại nút button nhấn btn_ExportPDF, các bạn viết source code C# bên dưới:

private void btn_exportPDF_Click(object sender, EventArgs e)
{
    MonthlyPrintStyle pStyle = schedulerControl1.ActivePrintStyle as MonthlyPrintStyle;
    if (pStyle != null)
    {
        pStyle.AppointmentFont = new Font("Tahoma", 10, FontStyle.Regular);
        pStyle.HeadingsFont = new Font("Tahoma", 12, FontStyle.Bold);
        pStyle.CompressWeekend = false;
    }

    string filePath = "Lichquetthe.pdf";
    PrintableComponentLink pcl = new PrintableComponentLink(new PrintingSystem());
    pcl.Component = schedulerControl1;
    pcl.PaperKind = PaperKind.A4Rotated;
    pcl.Margins = new Margins(4, 4, 4, 4);
    pcl.CreateDocument();
    pcl.ExportToPdf(filePath);
    if (File.Exists(filePath))
    {
        Process process = new Process();
        process.StartInfo.FileName = filePath;
        process.Start();
    }
}

Hy vọng bài viết sẽ giúp ích được cho các bạn!

 

Thanks for watching!

THÔNG TIN TÁC GIẢ

BÀI VIẾT LIÊN QUAN

[DEVEXPRESS] Xuất file PDF từ lịch Schedule Control C#
Đăng bởi: Thảo Meo - Lượt xem: 4284 15:08:48, 19/12/2019DEVEXPRESS   In bài viết

CÁC BÀI CÙNG CHỦ ĐỀ

Đọc tiếp
.