Preview, export and print a report
Render a declared report resource to PDF and handle cancelled printing.
Keep the report definition with the project and write generated PDFs into a writable data location. Preview, ExportPdf and Print are different actions. Print returns whether the operation completed; cancellation is not an exception. The second report exercises section-based layout, not just a larger row count.
Step 1Prepare a safe practice project#
Extract the archive into a new writable folder, separate from your own application. Open ReportDemo.mcproj in McBasic™. Keep every declared source, layout, resource and migration file together.
To reconstruct it yourself, create a DesktopApp project and add the files declared below. In the complete project, follow these steps as a guided rebuild: replace each named source file once and Check after all its procedures are present.
Exact project configuration
{
"schemaVersion": 1,
"projectId": "e638eea8-0e76-42a9-9593-a24d63c53162",
"name": "ReportDemo",
"kind": "DesktopApp",
"language": {
"dialect": "McBasic1",
"requireExplicit": true,
"compare": "Binary",
"defaultArrayBase": 0
},
"application": {
"bundleIdentifier": "com.mcbasic.samples.reportdemo",
"version": "0.1.0",
"buildNumber": "1",
"startupFormId": "form-main",
"shutdownMode": "OnStartupFormClosed"
},
"forms": [
{
"id": "form-main",
"typeName": "frmMain",
"layout": "Forms/frmMain.form.json",
"code": "Forms/frmMain.bas"
}
],
"modules": [],
"classes": [],
"tests": [],
"references": [],
"resources": [
{
"name": "CustomersReport",
"path": "Reports/Customers.report.json"
},
{
"name": "ReportLogo",
"path": "Reports/logo.png"
},
{
"name": "SectionsReport",
"path": "Reports/Sections.report.json"
}
],
"targets": [
"osx-arm64"
],
"capabilities": []
}Step 2Build the Form and set its properties#
frmMain
Select the Form first and set its properties. Add containers before their children. These are initial Designer values, not statements to paste into a procedure.
| Form property | Value |
|---|---|
Caption | "ReportDemo — McBasic" |
Width | 620 |
Height | 260 |
MinWidth | 500 |
MinHeight | 220 |
| Type | Name | Parent |
|---|---|---|
| Label | lblStatus | Form |
| CommandButton | cmdExport | Form |
| CommandButton | cmdPreview | Form |
| CommandButton | cmdPrint | Form |
| CommandButton | cmdClose | Form |
| CommandButton | cmdSections | Form |
| CommandButton | cmdSectionsPdf | Form |
| CommandButton | cmdSectionsPrint | Form |
lblStatus · exact Inspector values
| Property | Value |
|---|---|
Left | 32 |
Top | 36 |
Width | 550 |
Height | 65 |
Caption | "Export a PDF report of 150 synthetic customers." |
| Anchor edges | Left, Top |
cmdExport · exact Inspector values
| Property | Value |
|---|---|
Left | 32 |
Top | 132 |
Width | 130 |
Height | 40 |
Caption | "Export PDF" |
TabIndex | 0 |
| Anchor edges | Left, Top |
cmdPreview · exact Inspector values
| Property | Value |
|---|---|
Left | 170 |
Top | 132 |
Width | 130 |
Height | 40 |
Caption | "Preview" |
TabIndex | 1 |
| Anchor edges | Left, Top |
cmdPrint · exact Inspector values
| Property | Value |
|---|---|
Left | 308 |
Top | 132 |
Width | 130 |
Height | 40 |
Caption | "Print…" |
TabIndex | 2 |
| Anchor edges | Left, Top |
cmdClose · exact Inspector values
| Property | Value |
|---|---|
Left | 446 |
Top | 132 |
Width | 130 |
Height | 40 |
Caption | "Close" |
TabIndex | 3 |
| Anchor edges | Right, Top |
cmdSections · exact Inspector values
| Property | Value |
|---|---|
Left | 32 |
Top | 188 |
Width | 200 |
Height | 36 |
Caption | "Preview sections" |
TabIndex | 4 |
| Anchor edges | Left, Top |
cmdSectionsPdf · exact Inspector values
| Property | Value |
|---|---|
Left | 240 |
Top | 188 |
Width | 200 |
Height | 36 |
Caption | "Export sections" |
TabIndex | 5 |
| Anchor edges | Left, Top |
cmdSectionsPrint · exact Inspector values
| Property | Value |
|---|---|
Left | 448 |
Top | 188 |
Width | 128 |
Height | 36 |
Caption | "Print sections…" |
TabIndex | 6 |
| Anchor edges | Left, Top |
Step 3Connect the events explicitly#
frmMain
| Object | Event | Procedure | Parameters |
|---|---|---|---|
cmdExport | Click | cmdExport_Click | Click() |
cmdPreview | Click | cmdPreview_Click | Click() |
cmdPrint | Click | cmdPrint_Click | Click() |
cmdClose | Click | cmdClose_Click | Click() |
cmdSections | Click | cmdSections_Click | Click() |
cmdSectionsPdf | Click | cmdSectionsPdf_Click | Click() |
cmdSectionsPrint | Click | cmdSectionsPrint_Click | Click() |
| Form | Load | Form_Load | () |
Step 4Enter the complete behavior#
Open the named source file. Enter declarations first, then every procedure. Expand a procedure for its full body, or copy the complete file. Helpers are required: do not stop after entering the first Click handler.
Forms/frmMain.bas
Enter these declarations at file scope, before the procedures.
Option ExplicitPrivate Sub Form_Load()
Initialize state before enabling dependent actions. Keep the shared declarations and startup dependencies with this procedure.
Private Sub Form_Load()
lblStatus.Caption = "Report ready: 150 synthetic customers."
End SubPrivate Sub cmdExport_Click()
Follow the success, failure and cleanup paths together. Do not omit a guard or Finally block when entering this procedure.
Private Sub cmdExport_Click()
Dim outputPath As String
outputPath = AppPaths.DataFile("ReportDemo.pdf")
Try
Reports.ExportPdf App.ResourcePath & "/Reports/Customers.report.json", outputPath
lblStatus.Caption = "PDF: " & outputPath
Catch failure As McException
lblStatus.Caption = "Export failed " & CStr(failure.Number) & ": " & failure.Message
End Try
End SubPrivate Sub cmdPreview_Click()
Follow the success, failure and cleanup paths together. Do not omit a guard or Finally block when entering this procedure.
Private Sub cmdPreview_Click()
Try
Reports.Preview App.ResourcePath & "/Reports/Customers.report.json"
lblStatus.Caption = "Preview: 150 customers on A4 pages."
Catch failure As McException
lblStatus.Caption = "Preview failed " & CStr(failure.Number) & ": " & failure.Message
End Try
End SubPrivate Sub cmdPrint_Click()
Follow the success, failure and cleanup paths together. Do not omit a guard or Finally block when entering this procedure.
Private Sub cmdPrint_Click()
Try
If Reports.Print(App.ResourcePath & "/Reports/Customers.report.json") Then
lblStatus.Caption = "Print or system PDF completed."
Else
lblStatus.Caption = "Print cancelled."
End If
Catch failure As McException
lblStatus.Caption = "Print failed " & CStr(failure.Number) & ": " & failure.Message
End Try
End SubPrivate Sub cmdClose_Click()
Enter the complete action, including its input checks and calls to helper procedures.
Private Sub cmdClose_Click()
Unload Me
End SubPrivate Sub cmdSections_Click()
Follow the success, failure and cleanup paths together. Do not omit a guard or Finally block when entering this procedure.
Private Sub cmdSections_Click()
Try
Reports.Preview App.ResourcePath & "/Reports/Sections.report.json"
lblStatus.Caption = "Sections: three pages, two customers per page."
Catch failure As McException
lblStatus.Caption = "Section preview failed: " & failure.Message
End Try
End SubPrivate Sub cmdSectionsPdf_Click()
Follow the success, failure and cleanup paths together. Do not omit a guard or Finally block when entering this procedure.
Private Sub cmdSectionsPdf_Click()
Try
Reports.ExportPdf App.ResourcePath & "/Reports/Sections.report.json", AppPaths.DataFile("ReportSections.pdf")
lblStatus.Caption = "PDF sezioni: " & AppPaths.DataFile("ReportSections.pdf")
Catch failure As McException
lblStatus.Caption = "Section export failed: " & failure.Message
End Try
End SubPrivate Sub cmdSectionsPrint_Click()
Follow the success, failure and cleanup paths together. Do not omit a guard or Finally block when entering this procedure.
Private Sub cmdSectionsPrint_Click()
Try
If Reports.Print(App.ResourcePath & "/Reports/Sections.report.json") Then
lblStatus.Caption = "Section print completed."
Else
lblStatus.Caption = "Section print cancelled."
End If
Catch failure As McException
lblStatus.Caption = "Section print failed: " & failure.Message
End Try
End SubCopy the complete Forms/frmMain.bas file
Replace the file once; do not append duplicate procedures.
Option Explicit
Private Sub Form_Load()
lblStatus.Caption = "Report ready: 150 synthetic customers."
End Sub
Private Sub cmdExport_Click()
Dim outputPath As String
outputPath = AppPaths.DataFile("ReportDemo.pdf")
Try
Reports.ExportPdf App.ResourcePath & "/Reports/Customers.report.json", outputPath
lblStatus.Caption = "PDF: " & outputPath
Catch failure As McException
lblStatus.Caption = "Export failed " & CStr(failure.Number) & ": " & failure.Message
End Try
End Sub
Private Sub cmdPreview_Click()
Try
Reports.Preview App.ResourcePath & "/Reports/Customers.report.json"
lblStatus.Caption = "Preview: 150 customers on A4 pages."
Catch failure As McException
lblStatus.Caption = "Preview failed " & CStr(failure.Number) & ": " & failure.Message
End Try
End Sub
Private Sub cmdPrint_Click()
Try
If Reports.Print(App.ResourcePath & "/Reports/Customers.report.json") Then
lblStatus.Caption = "Print or system PDF completed."
Else
lblStatus.Caption = "Print cancelled."
End If
Catch failure As McException
lblStatus.Caption = "Print failed " & CStr(failure.Number) & ": " & failure.Message
End Try
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdSections_Click()
Try
Reports.Preview App.ResourcePath & "/Reports/Sections.report.json"
lblStatus.Caption = "Sections: three pages, two customers per page."
Catch failure As McException
lblStatus.Caption = "Section preview failed: " & failure.Message
End Try
End Sub
Private Sub cmdSectionsPdf_Click()
Try
Reports.ExportPdf App.ResourcePath & "/Reports/Sections.report.json", AppPaths.DataFile("ReportSections.pdf")
lblStatus.Caption = "PDF sezioni: " & AppPaths.DataFile("ReportSections.pdf")
Catch failure As McException
lblStatus.Caption = "Section export failed: " & failure.Message
End Try
End Sub
Private Sub cmdSectionsPrint_Click()
Try
If Reports.Print(App.ResourcePath & "/Reports/Sections.report.json") Then
lblStatus.Caption = "Section print completed."
Else
lblStatus.Caption = "Section print cancelled."
End If
Catch failure As McException
lblStatus.Caption = "Section print failed: " & failure.Message
End Try
End SubStep 5Keep resources and storage reproducible#
Keep the following files at their declared relative paths. Apply migrations before the first query. Media and report resources must travel with the build.
| File | Purpose |
|---|---|
Reports/Customers.report.json | Structured resource |
Reports/logo.png | Bundled asset / license |
Reports/Sections.report.json | Structured resource |
Reports/Customers.report.json
{
"schemaVersion": 1,
"title": "ReportDemo — customers",
"page": {
"size": "A4",
"orientation": "Portrait",
"margin": 42
},
"paragraphs": [
"Summary of 150 synthetic customers, Currency amounts and accented characters."
],
"columns": [
{
"header": "ID",
"weight": 0.4,
"alignment": "Left"
},
{
"header": "Customer",
"weight": 2.4,
"alignment": "Left"
},
{
"header": "Amount",
"weight": 0.8,
"alignment": "Right"
}
],
"rows": [
[
"1",
"Customer 001 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"2",
"Customer 002 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"3",
"Customer 003 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"4",
"Customer 004 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"5",
"Customer 005 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"6",
"Customer 006 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"7",
"Customer 007 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"8",
"Customer 008 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"9",
"Customer 009 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"10",
"Customer 010 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"11",
"Customer 011 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"12",
"Customer 012 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"13",
"Customer 013 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"14",
"Customer 014 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"15",
"Customer 015 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"16",
"Customer 016 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"17",
"Customer 017 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"18",
"Customer 018 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"19",
"Customer 019 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"20",
"Customer 020 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"21",
"Customer 021 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"22",
"Customer 022 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"23",
"Customer 023 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"24",
"Customer 024 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"25",
"Customer 025 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"26",
"Customer 026 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"27",
"Customer 027 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"28",
"Customer 028 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"29",
"Customer 029 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"30",
"Customer 030 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"31",
"Customer 031 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"32",
"Customer 032 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"33",
"Customer 033 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"34",
"Customer 034 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"35",
"Customer 035 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"36",
"Customer 036 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"37",
"Customer 037 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"38",
"Customer 038 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"39",
"Customer 039 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"40",
"Customer 040 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"41",
"Customer 041 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"42",
"Customer 042 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"43",
"Customer 043 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"44",
"Customer 044 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"45",
"Customer 045 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"46",
"Customer 046 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"47",
"Customer 047 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"48",
"Customer 048 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"49",
"Customer 049 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"50",
"Customer 050 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"51",
"Customer 051 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"52",
"Customer 052 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"53",
"Customer 053 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"54",
"Customer 054 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"55",
"Customer 055 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"56",
"Customer 056 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"57",
"Customer 057 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"58",
"Customer 058 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"59",
"Customer 059 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"60",
"Customer 060 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"61",
"Customer 061 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"62",
"Customer 062 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"63",
"Customer 063 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"64",
"Customer 064 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"65",
"Customer 065 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"66",
"Customer 066 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"67",
"Customer 067 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"68",
"Customer 068 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"69",
"Customer 069 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"70",
"Customer 070 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"71",
"Customer 071 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"72",
"Customer 072 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"73",
"Customer 073 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"74",
"Customer 074 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"75",
"Customer 075 — città, caffè e qualità. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. Descrizione lunga con accenti e testo a capo. ",
"12.3456"
],
[
"76",
"Customer 076 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"77",
"Customer 077 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"78",
"Customer 078 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"79",
"Customer 079 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"80",
"Customer 080 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"81",
"Customer 081 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"82",
"Customer 082 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"83",
"Customer 083 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"84",
"Customer 084 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"85",
"Customer 085 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"86",
"Customer 086 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"87",
"Customer 087 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"88",
"Customer 088 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"89",
"Customer 089 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"90",
"Customer 090 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"91",
"Customer 091 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"92",
"Customer 092 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"93",
"Customer 093 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"94",
"Customer 094 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"95",
"Customer 095 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"96",
"Customer 096 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"97",
"Customer 097 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"98",
"Customer 098 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"99",
"Customer 099 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"100",
"Customer 100 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"101",
"Customer 101 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"102",
"Customer 102 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"103",
"Customer 103 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"104",
"Customer 104 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"105",
"Customer 105 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"106",
"Customer 106 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"107",
"Customer 107 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"108",
"Customer 108 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"109",
"Customer 109 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"110",
"Customer 110 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"111",
"Customer 111 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"112",
"Customer 112 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"113",
"Customer 113 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"114",
"Customer 114 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"115",
"Customer 115 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"116",
"Customer 116 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"117",
"Customer 117 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"118",
"Customer 118 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"119",
"Customer 119 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"120",
"Customer 120 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"121",
"Customer 121 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"122",
"Customer 122 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"123",
"Customer 123 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"124",
"Customer 124 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"125",
"Customer 125 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"126",
"Customer 126 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"127",
"Customer 127 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"128",
"Customer 128 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"129",
"Customer 129 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"130",
"Customer 130 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"131",
"Customer 131 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"132",
"Customer 132 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"133",
"Customer 133 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"134",
"Customer 134 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"135",
"Customer 135 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"136",
"Customer 136 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"137",
"Customer 137 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"138",
"Customer 138 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"139",
"Customer 139 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"140",
"Customer 140 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"141",
"Customer 141 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"142",
"Customer 142 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"143",
"Customer 143 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"144",
"Customer 144 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"145",
"Customer 145 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"146",
"Customer 146 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"147",
"Customer 147 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"148",
"Customer 148 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"149",
"Customer 149 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"150",
"Customer 150 — city, café and quality. Synthetic entry",
"12.3456"
]
],
"totalColumn": 2,
"logoPath": "logo.png"
}Reports/Sections.report.json
{
"schemaVersion": 1,
"title": "ReportDemo — sections",
"page": {
"size": "A4",
"orientation": "Portrait",
"margin": 42
},
"paragraphs": [
"Three sections with two customers each. Every section begins on a new page."
],
"columns": [
{
"header": "ID",
"weight": 0.4,
"alignment": "Left"
},
{
"header": "Customer",
"weight": 2.4,
"alignment": "Left"
},
{
"header": "Amount",
"weight": 0.8,
"alignment": "Right"
}
],
"rows": [
[
"1",
"Customer 001 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"2",
"Customer 002 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"3",
"Customer 003 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"4",
"Customer 004 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"5",
"Customer 005 — city, café and quality. Synthetic entry",
"12.3456"
],
[
"6",
"Customer 006 — city, café and quality. Synthetic entry",
"12.3456"
]
],
"totalColumn": 2,
"pageBreakBeforeRows": [
2,
4
]
}Step 6Check, run and test the result#
Save all files and run Check. Resolve diagnostics before Run. Developer CLI users can work from the extracted folder:
mcbasic check ReportDemo.mcproj
mcbasic run ReportDemo.mcprojAcceptance checklist
- Preview the customer report and inspect page breaks.
- Export PDF and open the reported output path.
- Open Print and cancel: the app should report cancellation.
- Preview and export the section-based report.
Step 7Make one change and repeat the tests#
Change a report heading in the JSON resource and compare preview with the exported PDF.
Save a working Git checkpoint first. Change one behavior, Check again and repeat the acceptance checklist. Compare with the downloaded solution if a regression appears.
20f4bfed6b · Build manifest