-
Notifications
You must be signed in to change notification settings - Fork 0
Revise Readme for clarity and structure #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7ae29d0
Revise Readme for clarity and structure
ritazakhodyaeva c24a165
Created a new file CODEOWNERS [skip ci]
DevExpressExampleBot 0f734cf
README auto update [skip ci]
895ee0a
Enhance README with badges and batch printing details
ritazakhodyaeva 5f725ac
add an image
ritazakhodyaeva ef184cd
Update Readme.md
ritazakhodyaeva ffc1e84
Update Readme.md for batch printing example
ritazakhodyaeva 3872f86
README auto update [skip ci]
456d31f
Update Readme.md
ritazakhodyaeva a06fbaf
Update Readme.md
ritazakhodyaeva 26dab4d
README auto update [skip ci]
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @DevExpressExampleBot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,40 +1,89 @@ | ||
| <!-- default badges list --> | ||
|  | ||
| [](https://supportcenter.devexpress.com/ticket/details/E1765) | ||
| [](https://docs.devexpress.com/GeneralInformation/403183) | ||
| [](#does-this-example-address-your-development-requirementsobjectives) | ||
| <!-- default badges end --> | ||
| # Reporting for WinForms - Print Multiple Reports in a Batch | ||
|
|
||
| In this example, the reports are printed in a single batch, instead of sending one report at a time to the printer. The **Print** dialog box is only called for the first report, the other reports are printed without prompting, with the same print settings. | ||
|
|
||
|
|
||
| The [PrintTool.Printdialog](https://docs.devexpress.com/WindowsForms/DevExpress.XtraPrinting.PrintTool.PrintDialog.overloads) method is used to print the reports. The [StartPrint](https://docs.devexpress.com/CoreLibraries/DevExpress.XtraPrinting.PrintingSystemBase.StartPrint) event is handled to specify print settings. | ||
|
|
||
|
|
||
| ## Files to Review | ||
|
|
||
| * [Form1.cs](CS/BatchPrinting/Form1.cs) (VB: [Form1.vb](VB/BatchPrinting/Form1.vb)) | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [Printing System](https://docs.devexpress.com/WindowsForms/10733/controls-and-libraries/printing-exporting/concepts/basic-terms/printing-system) | ||
| - [Printing-Exporting](https://docs.devexpress.com/WindowsForms/2079/controls-and-libraries/printing-exporting) | ||
| - [Print a Report](https://docs.devexpress.com/XtraReports/5191/winforms-reporting/winforms-reporting-print-api/print-a-report) | ||
|
|
||
| ## More Examples | ||
|
|
||
| - [How to programmatically select a printe](https://github.com/DevExpress-Examples/Reporting_how-to-programmatically-select-a-printer-e1766) | ||
| - [How to determine the settings of the selected printer when the OK button is pressed in the Printer dialog](https://github.com/DevExpress-Examples/Reporting_how-to-determine-the-settings-of-the-selected-printer-when-the-ok-button-is-pressed-e1767) | ||
| - [How to dynamically select the paper source and set the printer resolution](https://github.com/DevExpress-Examples/Reporting_how-to-dynamically-select-the-paper-source-and-set-the-printer-resolution-e332) | ||
| - [How to programmatically print a specified range of report pages](https://github.com/DevExpress-Examples/Reporting_how-to-programmatically-print-a-specified-range-of-report-pages-e1768) | ||
|
|
||
|
|
||
|
|
||
| <!-- feedback --> | ||
| <!-- default badges list --> | ||
| [](https://supportcenter.devexpress.com/ticket/details/E1765) | ||
| [](https://docs.devexpress.com/GeneralInformation/403183) | ||
| [](#does-this-example-address-your-development-requirementsobjectives) | ||
| <!-- default badges end --> | ||
| # Reporting for WinForms - Print Multiple Reports in a Batch | ||
|
|
||
| In this example, reports are printed in a single batch instead of sending one report at a time to the printer. The Print dialog appears only for the first report; the other reports are printed without prompting with the same printer settings. | ||
|
|
||
|  | ||
|
|
||
| ## Implementation Details | ||
|
|
||
| Use the [PrintTool.PrintDialog](https://docs.devexpress.com/WindowsForms/DevExpress.XtraPrinting.PrintTool.PrintDialog.overloads) method to print reports. | ||
| Handle the [StartPrint](https://docs.devexpress.com/CoreLibraries/DevExpress.XtraPrinting.PrintingSystemBase.StartPrint) event to specify print settings. | ||
ritazakhodyaeva marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```cs | ||
| // Stores the printer settings selected by the user in the print dialog. | ||
| private PrinterSettings prnSettings; | ||
|
|
||
| // Handles the button click event to start the batch printing process. | ||
| private void button1_Click(object sender, EventArgs e) { | ||
| XtraReport1 report1 = new XtraReport1(); | ||
| XtraReport[] reports = new XtraReport[] { new XtraReport2(), new XtraReport3() }; | ||
|
|
||
| // Creates a print tool for the first report and subscribe to the StartPrint event. | ||
| ReportPrintTool pt1 = new ReportPrintTool(report1); | ||
| pt1.PrintingSystem.StartPrint += new PrintDocumentEventHandler(PrintingSystem_StartPrint); | ||
|
|
||
| // Subscribes to the StartPrint event for each additional report. | ||
| foreach (XtraReport report in reports) { | ||
| ReportPrintTool pts = new ReportPrintTool(report); | ||
| pts.PrintingSystem.StartPrint += new PrintDocumentEventHandler(reportsStartPrintEventHandler); | ||
| } | ||
|
|
||
| // Shows the print dialog for the first report. | ||
| if(pt1.PrintDialog() == true) { | ||
| // If the user confirms, print all additional reports with the selected printer settings | ||
| foreach(XtraReport report in reports) { | ||
| ReportPrintTool pts = new ReportPrintTool(report); | ||
| pts.Print(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Event handler to capture the printer settings from the print dialog. | ||
| void PrintingSystem_StartPrint(object sender, PrintDocumentEventArgs e) { | ||
| prnSettings = e.PrintDocument.PrinterSettings; | ||
| } | ||
|
|
||
| // Event handler to apply the captured printer settings to each report before printing. | ||
| private void reportsStartPrintEventHandler(object sender, PrintDocumentEventArgs e) { | ||
| int pageCount = e.PrintDocument.PrinterSettings.ToPage; | ||
| e.PrintDocument.PrinterSettings = prnSettings; | ||
|
|
||
| // Ensures all pages are printed, even if reports have different page counts. | ||
| e.PrintDocument.PrinterSettings.ToPage = pageCount; | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| ## Files to Review | ||
|
|
||
| * [Form1.cs](CS/BatchPrinting/Form1.cs) (VB: [Form1.vb](VB/BatchPrinting/Form1.vb)) | ||
|
|
||
| ## Documentation | ||
|
|
||
| - [Printing System](https://docs.devexpress.com/WindowsForms/10733/controls-and-libraries/printing-exporting/concepts/basic-terms/printing-system) | ||
| - [Printing-Exporting](https://docs.devexpress.com/WindowsForms/2079/controls-and-libraries/printing-exporting) | ||
| - [Print a Report](https://docs.devexpress.com/XtraReports/5191/winforms-reporting/winforms-reporting-print-api/print-a-report) | ||
| - [Merge Reports](https://docs.devexpress.com/XtraReports/3320/detailed-guide-to-devexpress-reporting/merge-reports) | ||
|
|
||
| ## More Examples | ||
|
|
||
| - [How to programmatically select a printe](https://github.com/DevExpress-Examples/Reporting_how-to-programmatically-select-a-printer-e1766) | ||
| - [How to determine the settings of the selected printer when the OK button is pressed in the Printer dialog](https://github.com/DevExpress-Examples/Reporting_how-to-determine-the-settings-of-the-selected-printer-when-the-ok-button-is-pressed-e1767) | ||
| - [How to dynamically select the paper source and set the printer resolution](https://github.com/DevExpress-Examples/Reporting_how-to-dynamically-select-the-paper-source-and-set-the-printer-resolution-e332) | ||
| - [How to programmatically print a specified range of report pages](https://github.com/DevExpress-Examples/Reporting_how-to-programmatically-print-a-specified-range-of-report-pages-e1768) | ||
|
|
||
| <!-- feedback --> | ||
| ## Does this example address your development requirements/objectives? | ||
|
|
||
| [<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=reporting-winforms-print-reports-in-batch&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=reporting-winforms-print-reports-in-batch&~~~was_helpful=no) | ||
|
|
||
| (you will be redirected to DevExpress.com to submit your response) | ||
| <!-- feedback end --> | ||
| (you will be redirected to DevExpress.com to submit your response) | ||
| <!-- feedback end --> | ||
|
|
||
|
|
||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.