- [C#] Hướng dẫn bảo mật ứng dụng 2FA (Multi-factor Authentication) trên Winform
- [C#] Hướng dẫn convert HTML code sang PDF File trên NetCore 7 Winform
- [C#] Hướng dẫn viết ứng dụng chat với Gemini AI Google Winform
- Hướng dẫn khóa file bằng nhiều process id, không cho xóa tập tin
- Hướng dẫn cách tạo Product Id cho ứng dụng phần mềm XXXXX-XXXXX-XXXXX-XXXXX
- [SQLSERVER] Hướng dẫn tạo script sql từ ứng dụng Sqlserver management Studio
- [C#] Hướng dẫn sử dụng thư viện AutoITx lấy id và password Ultraviewer trên winform
- [VB.NET] Hướng dẫn lấy thông tin tài khoản đăng nhập windows và khởi động lại ứng dụng ở chế độ Administrator
- [C#] Sử dụng thư viện Polly gửi lại request api khi request bị lỗi hay rớt mạng
- [DEVEXPRESS] Chia sẻ source code tạo báo cáo report in tem nhãn label trên C# winform
- [DEVEXPRESS] Hướng dẫn vẽ biểu đồ Bar Chart trên Winform
- [C#] Tạo form đăng nhập và đăng ký với hiệu ứng Sliding Animation Effect
- [C#] Hướng dẫn tạo thanh toán đơn hàng qua mã vạch VietQR sử dụng API PayOS hoàn toàn miễn phí
- [C#] Hướng dẫn ghi log ra RichTextBox giống Console trên Winform sử dụng thư viện Serilog
- [C#] Hướng dẫn cách tạo mã QR Code trên file Excel
- [VB.NET] Gởi tin nhắn và file đính kèm qua ứng dụng gởi tin nhắn Whats App
- [C#] Viết ứng dụng Auto Fill list Textbox from clipboard Winform
- [TOOL] Chia sẻ phần mềm thay đổi thông tin cấu hình máy tính
- [C#] Hướng dẫn Export dữ liệu ra file Microsoft Word Template
- [C#] Chia sẻ source code tool kiểm tra domain website
[DEVEXPRESS] Hướng dẫn bỏ phím chức năng Watermark và Export excel, pdf ra khỏi Dialog print report C#
Bài viết hôm nay, mình sẽ hướng dẫn các bạn cách loại bỏ các button chức năng trong Print Report Dialog của Devexpress.
Nếu bạn nào đã và đang làm việc với report Devexpress, thì Devexpress có hỗ trợ cho chúng ta các chức năng:
VD: Thêm WaterMark, Export File PDF, Excel, Rtf, Html...
Ví dụ: Các bạn thiết kế một report in đơn hàng vật tư, report các bạn hiển thị thông tin chưa phê duyệt thì có watermark trên report, cho người dùng không thể in ra.
Nhưng trên Report dialog lại có tính năng watermark, vậy chúng ta phải button này ra, để cho người dùng ko chỉnh sửa được.
Hoặc mình có thể khóa các chức năng, export file ra pdf, excel,... không có phép người dùng xuất dữ liệu trên report ra excel, rtf, html...
Source code C#:
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
// ...
private void button1_Click(object sender, System.EventArgs e) {
// Create a Print Tool with an assigned report instance.
ReportPrintTool printTool = new ReportPrintTool(new XtraReport1());
// Access the Print Tool's Printing System.
PrintingSystemBase printingSystem = printTool.PrintingSystem;
// Remove the Watermark command from the Print Preview UI.
if (printingSystem.GetCommandVisibility(PrintingSystemCommand.Watermark)
!= CommandVisibility.None) {
printingSystem.SetCommandVisibility(PrintingSystemCommand.Watermark,
CommandVisibility.None);
}
// Enable the Document Map command in the Print Preview UI.
printingSystem.SetCommandVisibility(PrintingSystemCommand.DocumentMap,
CommandVisibility.All);
// Disable document export to any format.
printingSystem.SetCommandVisibility(new PrintingSystemCommand[] {
PrintingSystemCommand.ExportCsv, PrintingSystemCommand.ExportTxt, PrintingSystemCommand.ExportDocx,
PrintingSystemCommand.ExportHtm, PrintingSystemCommand.ExportMht, PrintingSystemCommand.ExportPdf,
PrintingSystemCommand.ExportRtf, PrintingSystemCommand.ExportXls, PrintingSystemCommand.ExportXlsx,
PrintingSystemCommand.ExportGraphic },
CommandVisibility.None);
// Enable the "Export to CSV" and "Export to TXT" commands.
printingSystem.SetCommandVisibility(new PrintingSystemCommand[] {
PrintingSystemCommand.ExportCsv, PrintingSystemCommand.ExportTxt },
CommandVisibility.All);
// Disable export and mailing of documents.
printingSystem.SetCommandVisibility(new PrintingSystemCommand[] {
PrintingSystemCommand.SendFile },
CommandVisibility.None);
// Show the report's Print Preview in a dialog window.
printTool.ShowPreviewDialog();
}
HAVE FUN :)