- [DEVEXPRESS] Đặt mật khẩu và bỏ mật khẩu tập tin file PDF
- [C#] Thêm ứng dụng vào Taskbar sử dụng SharpShell DeskBand
- [C#] Hướng dẫn thêm text vào hình ảnh icon winform
- [C#] Chia sẽ tổng hợp source code đồ án về Csharp
- [C#] Hướng dẫn viết ứng dụng quay màn hình video winform, Screen Recorder
- [C#] Hướng dẫn sử dụng thư viện Input Simulator để làm việc với Keyboard, Mouse Virtual
- [DEVEXPRESS] Hướng dẫn tích Filter Contain khi click chuột phải vào cell selection trên Gridview
- [C#] Tra cứu mã số thuế cá nhân bằng CMND hoặc CCCD
- [C#] Convert hình ảnh image thành Blurhash sử dụng trong loading image winform
- [POWERSHELL] Script sao lưu backup và nén database sqlserver
- [C#] Giới thiệu thư viện Autofac Dependency Injection
- [C#] Hướng dẫn tạo Windows Services đơn giản Winform
- [C#] Một click chuột điều khiển máy tính từ xa sử dụng Ultraviewer
- Hướng dẫn đóng gói phần mềm sử dụng Powershell biên dịch script thành file exe
- [C#] Hướng dẫn sử dụng Task Dialog trên NET 5
- [C#] Hướng dẫn xem lịch sử các trang web đã truy cập trên Chrome Browser
- [C#] Hướng dẫn lấy thông tin Your ID và Password của Ultraviewer Winform
- [C#] Hướng dẫn lấy thông tin Your ID và Password của Teamviewer Winform
- [C#] Hướng dẫn build code động xuất file exe trên Winform
- [C#] Điều khiển ứng dụng từ xa và rất xa với Telegram Bot Winform
[DEVEXPRESS] Xuất file PDF từ lịch Schedule Control C#
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:
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ẻ.
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!