Classes♥
DBReport♥
Used to print or render reports.
Properties♥
CacheInRecords | ListBox | Name |
PictureQualityAllImagesPDF | PrinterDialog | PrinterSettings |
RecordSet | SearchHighlightColor | UID |
CacheInRecords♥
rpt.CacheInRecords= 500
Integer - Records cached in memory, default= 1000.
DBReport cached pictures of pages in memory for CacheInRecords number, after that, pictures are saved in temporary files.
ListBox♥
rpt.ListBox= myListbox
' or
myListbox= rpt.Listbox
ListBox - Set or get the listbox, use as recordset, the columns heading is used as field name.
Name♥
rpt.Name= "Customers list"
' or
StringVariable= rpt.Name
String - Used for set or get the name of report, appears on title of window designer.
PictureQualityAllImagesPDF♥
rpt.PictureQualityAllImagesPDF= Picture.QualityMedium
' Or
rpt.PictureQualityAllImagesPDF= 25 // low quality
Integer - Set the quality for all images on PDF file, see JPEG quality.
PrinterDialog♥
rpt.PrinterDialog= False
Boolean - If shows printer dialog before print. by default is true.
PrinterSettings♥
rpt.PrinterSettings= PageSetup.SetupString
String - populate PrinterSetup options. see SetupString
RecordSet♥
rpt.RecordSet= db.SQLSelect("SELECT * FROM sqlite_master")
' or
Dim rs As Recordset= rpt.RecordSet
Recordset - Set or get recordset object.
SearchHighlightColor♥
rpt.SearchHighlightColor= &cFFDFDF7F
Color - Set the color for Highlight when search on Preview. Default= &cFFFF007F
UID♥
StringVariable= rpt.UID
String - Get the unique identification of report.
Methods♥
Changed | Designer | GetXML |
LoadXML | Page | Parameter |
PrintQuick | Prop | |
PropCount | RenderToPDF | SaveXML |
SubReport | SubReportAdd | SubReportDel |
SubReportsClear |
Changed♥
If rpt.Changed Then
MsgBox "Changed!"
End If
Boolean - If report has changed (after use Designer).
Designer♥
rpt.Designer(showModal As Boolean = True)
rpt.Designer(settings As String)
Shows DBReportDesignerWindow window aka Designer window.
Example:
rpt.Designer("{""ShowExpImpBtn"": True, ""ShowUpdateBtn"": True}")
The settings parameter is a JSON string eg. ShowExpImpBtn: shows ExportImport button, ShowUpdateBtn: shows Update button
GetXML♥
StringVariable= rpt.GetXML
String - Get XML definition as string.
LoadXML♥
rpt.LoadXML(f As FolderItem)
rpt.LoadXML(str As String)
Load report definition.
Page♥
rpt.Page(ByRef PageNum As Integer, Scale As Double = 1, Optional Search As String = "", _
Optional CachePages As Boolean = False, Optional PageBackColor As Color = &cFCFCFC00)
Picture - Returns a Picture of page.
PageNum is a number of page rendered, if the number is greater PageNum is changed to last page. Scale is the scale of picture. Search is a string to search and highlighted. CachePages cached pictures if you need get the picture again. PageBackColor is the backColor of picture.
Parameter♥
rpt.Parameter(Name As String, Assigns Value As Variant)
rpt.Parameter(Name As String) As Variant
Set or get parameters to use in report. Must be setting before Print or Design.
Example:
rpt.Parameter("CompanyName")= "Acme Inc."
rpt.Parameter("CompanyLogo")= pictureVariable
Print♥
rpt.Print
Print report.
PrintQuick♥
rpt.PrintQuick(ShowDialog As Boolean = False)
Print without definition. Print low numbers of columns.
Example:
Dim rpt As New DBReport
rpt.RecordSet= rs
rpt.PrintQuick
Prop♥
rpt.Prop(Idx As Integer) As String
rpt.Prop(Name As String) As String
rpt.Prop(Name As String, Assigns Value As String)
Set or get properties of report.
PropCount♥
rpt.PropCount() As Integer
Get the numbers or properties.
RenderToPDF♥
rpt.RenderToPDF(f As FolderItem)
Create a PDF file of report.
SaveXML♥
rpt.SaveXML(f As FolderItem, pretty As Boolean = False)
Create a XML file of definition.
SubReport♥
rpt.SubReport(Idx As Integer) As DBReportSubReport
rpt.SubReport(Name As String) As DBReportSubReport
Get subreport. Idx start in zero.
SubReportAdd♥
rpt.SubReportAdd(Rpt As DBReportSubReport)
Add subreport to report.
SubReportDel♥
rpt.SubReportDel(Name As String)
Delete subreport by name.
SubReportsClear♥
rpt.SubReportsClear
Delete all subreports.
Shared Properties♥
BrandName | Errors | ErrorsCount |
PassCode | PDFObj | PDFOptions |
PictureSaveInDefinition | PreferencesFile | RecordSetEncoding |
Register |
BrandName♥
DBReport.BrandName= "Your_Brand"
String - Change DBReport brand for you wish.
Errors♥
StringVariable= DBReport.Errors
String - Gets a string with all errors (if any) of report.
ErrorsCount♥
IntegerVariable= DBReport.ErrorsCount
Integer - Gets the numbers of errors of report.
PassCode♥
DBReport.PassCode= "your pass code"
String - Pass code used for encrypt DataExplorer data
PDFObj♥
Dim pdf As New DynaPDFMBS // your code
pdf.SetLicenseKey "Starter" // your code
' set other pdf options like AddFontSearchPath
' add this code
DBReport.PDFObj= pdf // to reuse this object
DynaPDFMBS - Used for store MBSDynaPDF plugin object.
PDFOptions♥
DBReport.PDFOptions.Value("Codepage")= DynaPDFMBS.kcpUnicode // change codepage
Dictionary - Used for PDF settings.
PictureSaveInDefinition♥
DBReport.PictureSaveInDefinition= False
Boolean - Save picture data in definition File (default: True).
PreferencesFile♥
DBReport.PreferencesFile= SpecialFolder.ApplicationData.Child("yourfile")
FolderItem - Set preferences folderItem file.
RecordSetEncoding♥
DBReport.RecordSetEncoding= Encodings.ASCII
TextEncoding - Set encodings for recordSet.
Register♥
DBReport.Register= "Your_register_code"
String - Set register code.
Shared Methods♥
DecryptString | EncryptString | PrintOnBackground |
PrintOnBackgroundCurrentPageNumber | Registered | RenderToPDFOnBackground |
RenderToPDFOnBackgroundCurrentPageNumber |
DecryptString♥
DBReport.DecryptString(Str As String) As String
String - Get a string "decripted", well is more like obfuscate. You can use for gets sensitive properties in report definition.
Example:
username= DBReport.DecryptString(rpt.Prop("username"))
EncryptString♥
DBReport.EncryptString(Str As String) As String
String - Get a string "encripted", well is more like obfuscate. You can use for save sensitive properties in report definition.
Example:
rpt.Prop("username")= DBReport.EncryptString(username)
PrintOnBackground♥
DBReport.PrintOnBackground() As Boolean
Gets True if are printing the report in background. Used for not close app before print thread is finished.
Example:
Function CancelClose(appQuitting as Boolean) As Boolean
If DBReport.PrintOnBackground Then
MsgBox "Printing..."
Return True
End
End Function
DBReport.PrintOnBackground(Rpt As DBReport, Priority As Integer = Thread.LowestPriority)
Print a report on background.
Example:
Dim rpt As New DBReport(f, rs)
DBReport.PrintOnBackground rpt
PrintOnBackgroundCurrentPageNumber♥
DBReport.PrintOnBackgroundCurrentPageNumber() As Integer
Gets current page number printed in background. Used for feedback.
Example:
System.DebugLog Str(DBReport.PrintOnBackgroundCurrentPageNumber)
Registered♥
DBReport.Registered() As Boolean
Gets True if DBReport is registered.
RenderToPDFOnBackground♥
DBReport.RenderToPDFOnBackground() As Boolean
Gets True if are render the report in background. Used for not close app before print thread is finished.
Example:
Function CancelClose(appQuitting as Boolean) As Boolean
If DBReport.RenderToPDFOnBackground Then
MsgBox "REnder to PDF..."
Return True
End
End Function
DBReport.RenderToPDFOnBackground(Rpt As DBReport, f As FolderItem, title As String = "", author As String = "", _
subject As String = "", keywords As String = "", Priority As Integer = Thread.LowestPriority)
Render to PDF a report on background.
Example:
Dim rpt As New DBReport(f, rs)
Dim f As FolderItem= SpecialFolder.Documents.Child("DBReport.xml")
DBReport.RenderToPDFOnBackground rpt, f, "My title", "My author", "My subject", "My keywords"
RenderToPDFOnBackgroundCurrentPageNumber♥
DBReport.RenderToPDFOnBackgroundCurrentPageNumber() As Integer
Gets current page number rendered in background. Used for feedback.
Example:
System.DebugLog Str(DBReport.RenderToPDFOnBackgroundCurrentPageNumber)
Constructors♥
DBReport.Constructor(rpt As DBReport)♥
DBReport.Constructor(rpt As DBReport)
Create a new report based in other (Copy constructor).
Example:
Dim rpt As DBReport
'...
Dim rpt1 As New DBReport(rpt)
DBReport.Constructor(f As FolderItem)♥
DBReport.Constructor(f As FolderItem)
Create a report with a file definition.
Example:
Dim rpt As New DBReport(SpecialFolder.Documents.Child("Template.xml"))
DBReport.Constructor(f As FolderItem, rs As RecordSet)♥
DBReport.Constructor(f As FolderItem, rs As RecordSet)
Create a report with file definition and recordset.
Example:
Dim f As FolderItem= SpecialFolder.Documents.Child("MyReport.xml")
Dim rs As RecordSet= App.Db.SQLSelect("SELECT * FROM users")
Dim rpt As DBReport(f, rs)
DBReport.Constructor(str As String)♥
DBReport.Constructor(str As String)
Create a report with a string as definition.
Example:
Dim rpt As New DBReport(kReportConstant)
DBReport.Constructor(str As String, rs As RecordSet)♥
DBReport.Constructor(str As String, rs As RecordSet)
Create a report with string as definition and recordset.
Example:
Dim rs As RecordSet= App.Db.SQLSelect("SELECT * FROM users")
Dim rpt As DBReport(kReportDef, rs)
Class Constants♥
Name | Type | Values |
---|---|---|
Version | String | ie. 1.4.4407 |
ReportColumnsOrder | Integer | LeftToRightThenDown=1DownThenLeftToRight=2 |
ReportUnits | Integer | Pixels=1Milimeters=2Inches=3 |
Examples♥
Modify report:
Dim f as FolderItem= SpecialFolder.Documents.Child("DBReport1.xml")
Dim rpt As New DBReport
rpt.LoadXML f
rpt.RecordSet= rs // rs RecordSet must be exist
rpt.Designer
rpt.SaveXML(f)
or
Dim rpt As New DBReport
rpt.LoadXML(StringVariable)
rpt.RecordSet= rs // rs RecordSet must be exist
rpt.Designer
StringVariable= rpt.GetXML()
Printe report:
Dim f as FolderItem= SpecialFolder.Documents.Child("DBReport1.xml")
Dim rpt As New DBReport(f, rs) // rs RecordSet must be exist
rpt.Print
DBReportDesignerControl♥
Used to embed in a Window or in another control.
Events♥
NameChange | Update |
NameChange♥
DBReportDesignerControl1.NameChange()
Fires when the name of the report property has changed.
Update♥
DBReportDesignerControl.Update()
Fires when click on Update button.
Methods♥
GetReport | PreferencesLoad | PreferencesSave |
Report |
GetReport♥
DBReportDesignerControl.GetReport() As DBReport
Gets the report object.
PreferencesLoad♥
DBReportDesignerControl.PreferencesLoad(Win As DBReportDesignerWindow)
Load preferences and apply to window.
PreferencesSave♥
DBReportDesignerControl.PreferencesSave()
Save preferences.
Report♥
DBReportDesignerControl.Report(rpt As DBReport)
Set report to control.
Constants♥
Name | Type | Values |
---|---|---|
Version | String | 1.4.4407 |
DBReportPreview♥
Used to embed in a Window or in another control.
Events♥
Action | PageFinished |
Action♥
DBReportPreview.Action(element As String, value As String, reportName As String, subReportName As String)
Fires when HotSpot is clicked. You can handle inspecting string variables.
PageFinished♥
DBReportPreview.PageFinished()
Fires when the page is shows.
Properties♥
HotSpotEnable | ShowToolBar |
HotSpotEnable♥
DBReportPreview1.HotSpotEnable= True
Boolean - Set if hotSpots are enabled, default= False.
ShowToolBar♥
DBReportPreview1.ShowToolBar= False
Boolean - Set if toolBar are shows, default= True.
Methods♥
CurrentPage | MoveFirstPage | MoveLastPage |
MoveNextPage | MovePreviousPage | MoveToPage |
Report | ShowSearchPanel |
CurrentPage♥
DBReportPreview.CurrentPage() As Integer
Return current page number.
MoveFirstPage♥
DBReportPreview.MoveFirstPage()
Move to first page and shows it.
MoveLastPage♥
DBReportPreview.MoveLastPage()
Move to last page and shows it.
MoveNextPage♥
DBReportPreview.MoveNextPage()
Move to next page and shows it.
MovePreviousPage♥
DBReportPreview.MovePreviousPage()
Move to previous page and shows it.
MoveToPage♥
DBReportPreview.MoveToPage(nPage As Integer)
Move to nPage number and shows it.
Print♥
DBReportPreview.Print()
Print report.
Report♥
DBReportPreview.Report(rpt As DBReport, SearchPanel As Boolean = False, CacheInRecords As Integer = 1000)
Set report to preview.
ShowSearchPanel♥
DBReportPreview.ShowSearchPanel()
Shows/hide the searchPanel.
Constants♥
Name | Type | Values |
---|---|---|
Version | String | 1.4.4407 |
DBReportShared♥
Used for setting third-party products.
Constants♥
Name | Type | Notes |
---|---|---|
kBarcodeEngine | String | Set to "MBSBarcode" to use plugin, default= "Simbarcodes" |
kConnectionMBSSQL | Boolean | Use MBSQL plugin in DataExplorer, default= False |
kConnectionMSSQL | Boolean | Use MSSQL plugin in DataExplorer, default= False |
kConnectionMySQL | Boolean | Use MySQL plugin in DataExplorer, default= True |
kConnectionODBC | Boolean | Use ODBC plugin in DataExplorer, default= False |
kConnectionOracle | Boolean | Use Oracle plugin in DataExplorer, default= False |
kConnectionPostgres | Boolean | Use Postgres plugin in DataExplorer, default= True |
kConnectionSQLite | Boolean | Use SQLite plugin in DataExplorer, default= True |
kConnectionWeb | Boolean | Use HTTP in DataExplorer, default= True |
kEditSyntaxHighlightEngine | String | Use CEF (custom-editfield) set "CEF", default="" |
kEncryptionEngine | String | Use MBSEncryption plugin set "MBS", default= "" |
kForceEncryptBefore2014 | Boolean | Used REalStudio encryption, default= False |
kRenderEnginePDF | String | Set to "MBSDynaPDF" to use plugin, default= "DBReportPDF" |
kScreenShotEngine | String | Use MBSPicture set "ScreenshotMBS", default="ScreenShot" |
kzlibPath | String | Set the path for zlib shared library |
Notes♥
If you use MBSBarcode plugin, You can delete the Simbarcodes file.
To use MBSDynaPDF plugin:
- Change DBReportShared.kRenderEnginePDF constant to "MBSDynaPDF".
- Add next code after SetLicense, ie:
Dim pdf As New DynaPDFMBS // your code
pdf.SetLicenseKey "Starter" // your code
' set other pdf options like AddFontSearchPath
' add this code
DBReport.PDFObj= pdf // to reuse this object
' JUST IF YOU NEED CHANGE default options, add next code:
'DBReport.PDFOptions.Value("Codepage")= DynaPDFMBS.kcpUnicode // change codepage
'DBReport.PDFOptions.Value("EmbedFonts")= False // not embed fonts
You can delete DBReportPDF* files and zlib1.dll from the project.