Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
¿Cómo guardar stimulsoft report js en el servidor en angular?

Tengo un componente para el diseñador de informes y asigno un método al evento onSaveReport , pero en ese método mi miembro del componente no está undefined

 options: any; designer: any; public document: ReportDocument; reportBody = ''; constructor() { } ngOnInit() { this.document = new ReportDocument(); this.options = new Stimulsoft.Designer.StiDesignerOptions(); this.options.appearance.fullScreenMode = false; this.designer = new Stimulsoft.Designer.StiDesigner(this.options, 'StiDesigner', false); var report = new Stimulsoft.Report.StiReport(); var json = { "DataSet": [{ Id: "a", Name: "A" }] } var dataSet = new Stimulsoft.System.Data.DataSet("JSON"); dataSet.readJson(json) report.regData("JSON", "JSON", dataSet); report.dictionary.synchronize(); this.designer.report = report; this.designer.renderHtml('designer'); this.designer.onSaveReport = this.onReportSave; } private onReportSave(e: any) { this.document.body = e.report.saveToJsonString(); // error is here } }

este es un error:

No se pueden establecer propiedades de indefinido (configurando 'cuerpo') TypeError: No se pueden establecer propiedades de indefinido (configurando 'cuerpo') en $.onReportSave [como onSaveReport] (http://localhost:4200/features-stimulsoft-report-stimulsoft-report -module.js:1206:28) en $.invokeSaveReport (http://localhost:4200/assets/lazyBundles/stimulsoft/stimulsoft.designer.js:30:82619) en $.raiseCallbackEventAsync (http://localhost:4200 /assets/lazyBundles/stimulsoft/stimulsoft.designer.js:30:86029) en http://localhost:4200/assets/lazyBundles/stimulsoft/stimulsoft.designer.js:30:78818 en ZoneDelegate.invokeTask (http:// localhost:4200/polyfills.js:12178:35) en Object.onInvokeTask (http://localhost:4200/vendor.js:72788:33) en ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js: 12177:40) en Zone.runTask (http://localhost:4200/polyfills.js:11946:51) en invocarTask (http://localhost:4200/polyfills.js:12259:38) en ZoneTask.invoke (http ://localhost:4200/polyfills.js:12248:52)`

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No tiene acceso a su clase, this dentro de la función onReportSave porque pasa la referencia de su función a onSaveReport y dado que el diseñador llama a su función, this dentro de su función pertenece al diseñador, no a su clase, y esa es la causa del error. Este documento no está definido. y llama al cuerpo desde un indefinido, pero puede cambiarlo con la propiedad de vinculación

 this.designer.onSaveReport = this.onReportSave.bind(this);

Ahora configura this dentro de su función para que sea this de su clase.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda