Instead of a database connection, you can pass an in-memory DataSet directly to the report.

Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
@Component({
    selector: "registering-data-from-code",
    imports: [Viewer],
    template: `
        <div class="container">
            <div class="container-button">
                <button (click)="buttonXmlClick()" class="button" title="Using regData() method for registering XML data">Register XML Data</button>
                <button (click)="buttonJsonClick()" class="button" title="Using regData() method for registering JSON data">Register JSON Data</button>
            </div>
            <div>
                <sti-viewer [report]="report"></sti-viewer>
            </div>
        </div>`,
    styleUrls: ['../styles.css']
})

export class RegisteringDataFromCode {
    report = new Stimulsoft.Report.StiReport();

    updateReport(dataSet: Stimulsoft.System.Data.DataSet) {
        this.report = new Stimulsoft.Report.StiReport();
        this.report.loadFile("Reports/TwoSimpleLists.mrt");
        this.report.dictionary.databases.clear();
        this.report.regData("Demo", "Demo", dataSet);
    }

    buttonXmlClick() {
        var dataSet = new Stimulsoft.System.Data.DataSet();
        dataSet.readXmlSchemaFile("Data/Demo.xsd");
        dataSet.readXmlFile("Data/Demo.xml");

        this.updateReport(dataSet);
    }

    buttonJsonClick() {
        var dataSet = new Stimulsoft.System.Data.DataSet();
        dataSet.readJsonFile("Data/Demo.json");

        this.updateReport(dataSet);
    }

    constructor() {
    }
}

The DataSet is populated with readXmlFile/readXmlSchemaFile or readJsonFile, then handed to the report through regData(). Clearing dictionary.databases first removes the design-time connection.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.