A common goal of component developers (like us) is simplifying the job of our customers (other developers) as much as possible. One of the best ways to accomplish this is by adding “helper routines” to the product to reduce the amount of time it takes to code an otherwise tedious task.
Below are a couple examples of some helper routines that you may find useful.
1. Web Mail and Cloud Drive service helpers:
Setting up web mail and cloud drive services can be time consuming due to the fact that many of the necessary properties are embedded in numerous sub-classes. For instance, in order to set up Gmail using standard RB properties, the following code is needed:
1 2 3 |
ppReport.EmailSettings.ConnectionSettings.WebMail.GmailSettings.OAuth2.ClientID := ClientID; ppReport.EmailSettings.ConnectionSettings.WebMail.GmailSettings.OAuth2.ClientSecret := ClientSecret; ppReport.EmailSettings.ConnectionSettings.WebMail.GmailSettings.OAuth2.RedirectURI := RedirectURI; |
The same would be needed to set up another web mail plugin such as Outlook.com.
With the included WebMailSetup routine, both plugins can be set up with the following code:
1 2 3 |
// Redirect URI is optional (defaults to http://localhost) ppReport.EmailSettings.ConnectionSettings.WebMailSetup(ctGmail, ClientID, ClientSecret); ppReport.EmailSettings.ConnectionSettings.WebMailSetup(ctOutlookWeb, ClientID, ClientSecret); |
A similar helper is provided for cloud drive services.
1 2 3 4 |
//Set up all three supported cloud drive services ppReport.CloudDriveSettings.CloudDriveSetup(ctGoogleDrive, ClientID, ClientSecret); ppReport.CloudDriveSettings.CloudDriveSetup(ctOneDrive, ClientID, ClientSecret); ppReport.CloudDriveSettings.CloudDriveSetup(ctDropBox, ClientID, ClientSecret, 'http://localhost:54321'); |
2. Export to file from the Viewer:
When using a TppViewer on a form to view reports, it is commonly necessary to export that report to file directly. This can be troublesome due to the fact that the Viewer itself is connected to an output device (screen). Normally, one would need to manually disconnect the screen device from the report before exporting and reconnect it after exporting has finished. The ExportToFile routine makes this process much easier.
1 |
ppViewer.ExportToFile(dtPDF, FilePath + '\Invoice.pdf'); |
Hopefully this gives you a bit more information on some helpful helper routines that have been added to ReportBuilder. If you find this information useful, let me know and I can make this a series of the various other helpers available. Also, if you would like to see other helper routines added, let me know that as well and we will consider adding them for the next release.
Happy Reporting!