The following options can be set during initialization or at run time while working with the JS Viewer.

interface ExportOptions {
    callback: ExportCallback;
    error: ((error) => void);
    exportType: ExportTypes;
    reportID: string;
    reportParameters?: Parameter[];
    reportService?: ReportServiceSettings;
    saveAsDialog?: boolean;
    settings?: any;
}

Hierarchy (view full)

Properties

callback: ExportCallback

The callback that is invoked before the export result request sent.

Example: Usage example:

// ESM usage
import {exportReport} from './jsViewer.min.js';
exportReport({
callback: ()=>console.log('test')
});

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.export({
callback: ()=>console.log('test')
});
error: ((error) => void)

The callback that is invoked when an error occurs in the process of displaying the report.

Type declaration

    • (error): void
    • Parameters

      Returns void

Example: To handle an error:

// ESM usage
import { printReport } from './jsViewer.min.js';
printReport({
error: (error) => {
if (error.message) {
// show error message.
alert("Internal error! Please ask administrator.");
}
}
}):

Example: To handle an error:

// UMD usage
GrapeCity.ActiveReports.JSViewer.print({
error: (error) => {
if (error.message) {
// show error message.
alert("Internal error! Please ask administrator.");
}
}
}):
exportType: ExportTypes

The document format type to report be exported to.

Example: Usage example:

// ESM usage
import {exportReport} from './jsViewer.min.js';
exportReport({
exportType: 'Pdf'
});

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.export({
exportType: 'Pdf'
});
reportID: string

The id of the report to be shown by the JS Viewer.

Example: Usage example:

// ESM usage
import { printReport } from './jsViewer.min.js';
printReport({
reportID: 'AnnualReport.rdlx'
}):

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.print({
reportID: 'AnnualReport.rdlx'
}):
reportParameters?: Parameter[]

The array of the {name, value} pairs that describe the parameters values used to run the report.

Example: Usage example:

// ESM usage
import { printReport } from './jsViewer.min.js';
printReport({
reportParameters: [{ name: 'ReportParameter1', values: ['1']}]
}):

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.print({
reportParameters: [{ name: 'ReportParameter1', values: ['1']}]
}):
reportService?: ReportServiceSettings

Set up the settings to connect the Web API.

Example: Usage example:

// ESM usage
import { printReport } from './jsViewer.min.js';
printReport({
reportService: {
url: 'http://example.com/api/reporting',
securityToken: '42A9CD80A4F3445A9BB60A221D042FCC',
}
}):

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.print({
reportService: {
url: 'http://example.com/api/reporting',
securityToken: '42A9CD80A4F3445A9BB60A221D042FCC',
}
}):
saveAsDialog?: boolean

Example: Usage example:

// ESM usage
import {exportReport} from './jsViewer.min.js';
exportReport({
saveAsDialog: true
});

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.export({
saveAsDialog: true
});
settings?: any

Export settings

Example: Usage example:

// ESM usage
import {exportReport} from './jsViewer.min.js';
exportReport({
settings : {
EmbedFonts:'All',
Title:'MyInvoice'
}});

Example: Usage example:

// UMD usage
GrapeCity.ActiveReports.JSViewer.export({
settings : {
EmbedFonts:'All',
Title:'MyInvoice'
}});