集成到项目中

本示例主要演示了如何在前端框架中 Angular,React,Vue,及纯JavaScript 方法中集成在线设计器。具体操作可参考文档Web设计器集成 ,可在页面底部查看集成代码,并更改查看效果。

import { Component, AfterViewInit } from "@angular/core"; import { Designer as ReportDesigner } from "@grapecity/activereports/reportdesigner"; import '@grapecity/activereports-localization-zh'; @Component({ selector: "app-root", template: '<div id="designer-host"></div> ', styleUrls: ["src/app.component.css"], }) export class AppComponent implements AfterViewInit{ ngAfterViewInit(): void { new ReportDesigner("#designer-host",{ language: "zh" }); } }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>GrapeCity ActiveReports for Javascript sample</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> System.import("./src/app.main"); </script> </head> <body> <app-root></app-root> </body> </html>
(function (global) { System.config({ transpiler: "ts", typescriptOptions: { tsconfig: true, }, meta: { typescript: { exports: "ts", }, "*.css": { loader: "css" }, }, paths: { // paths serve as alias "npm:": "node_modules/", "arjs:": "node_modules/@grapecity/activereports/", }, // map tells the System loader where to look for things map: { "rxjs/operators": "rxjs-operators.js", rxjs: "npm:rxjs/bundles/rxjs.umd.min.js", "core-js": "npm:core-js/client/shim.min.js", zone: "npm:zone.js/dist/zone.min.js", "@angular/core": "npm:@angular/core/bundles/core.umd.min.js", "@angular/common": "npm:@angular/common/bundles/common.umd.min.js", "@angular/compiler": "npm:@angular/compiler/bundles/compiler.umd.min.js", "@angular/platform-browser": "npm:@angular/platform-browser/bundles/platform-browser.umd.min.js", "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.min.js", "@angular/http": "npm:@angular/http/bundles/http.umd.min.js", "@angular/common/http": "npm:@angular/common/bundles/common-http.umd.min.js", "@angular/router": "npm:@angular/router/bundles/router.umd.min.js", "@angular/forms": "npm:@angular/forms/bundles/forms.umd.min.js", "@grapecity/activereports-angular": "npm:@grapecity/activereports-angular/bundles/grapecity-activereports-angular.umd.js", "@grapecity/activereports/reportviewer": "npm:@grapecity/activereports/dist/ar-js-viewer.js", "@grapecity/activereports/viewer": "npm:@grapecity/activereports/dist/ar-js-viewer.js", "@grapecity/activereports/reportdesigner": "npm:@grapecity/activereports/dist/ar-js-designer.js", "@grapecity/activereports/pdfexport": "npm:@grapecity/activereports/dist/ar-js-pdf.js", "@grapecity/activereports/tabulardataexport": "npm:@grapecity/activereports/dist/ar-js-tabular-data.js", "@grapecity/activereports/xlsxexport": "npm:@grapecity/activereports/dist/ar-js-xlsx.js", "@grapecity/activereports/htmlexport": "npm:@grapecity/activereports/dist/ar-js-html.js", "@grapecity/activereports": "npm:@grapecity/activereports/dist/ar-js-core.js", "@grapecity/activereports/core": "npm:@grapecity/activereports/dist/ar-js-core.js", "@grapecity/activereports-core": "npm:@grapecity/activereports/lib/node_modules/@grapecity/ar-js-pagereport.js", "@grapecity/activereports/styles": "npm:@grapecity/activereports/styles", "@grapecity/activereports-localization-ja": "npm:@grapecity/activereports-localization/dist/designer/ja-locale.js", "@grapecity/activereports-localization-zh": "npm:@grapecity/activereports-localization/dist/designer/zh-locale.js", "@grapecity/ar-js-pagereport": "npm:@grapecity/activereports/dist/ar-js-core.js", "bootstrap.css": "npm:bootstrap/dist/css/bootstrap.min.css", jszip: "npm:jszip/dist/jszip.min.js", typescript: "npm:typescript/lib/typescript.js", ts: "npm:plugin-typescript/lib/plugin.js", css: "npm:systemjs-plugin-css/css.js", }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: "ts", }, rxjs: { defaultExtension: "js", }, node_modules: { defaultExtension: "js", }, }, }); })(this);