Of course.
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package
{
/**
* @externs
*/
COMPILE::JS
public class StimulsoftReports
{
/**
* <inject_script>
* var script = document.createElement("script");
* script.setAttribute("src",
"resources/stimulsoftreports/stimulsoft.reports.js");
* document.head.appendChild(script);
* window.onload = function()
* {
* var script = document.createElement("script");
* script.setAttribute("src",
"resources/stimulsoftreports/stimulsoft.viewer.js");
* document.head.appendChild(script);
* }
* function loadReport(renderArea, reportDefinition)
* {
* var viewer = new Stimulsoft.Viewer.StiViewer();
* var report = new Stimulsoft.Report.StiReport();
* report.load(reportDefinition);
* viewer.report = report;
* }
* var link = document.createElement("link");
* link.setAttribute("rel", "stylesheet");
* link.setAttribute("href",
"resources/stimulsoftreports/stimulsoft.viewer.office2013.whiteblue.css");
* document.head.appendChild(link);
* </inject_script>
*/
public function StimulsoftReports(){}
public static function loadReport(renderArea:Element,
reportDefinition:String):void {}
}
}
The above example, inject this code:
function loadReport(renderArea, reportDefinition)
{
var viewer = new Stimulsoft.Viewer.StiViewer();
var report = new Stimulsoft.Report.StiReport();
report.load(reportDefinition);
viewer.report = report;
}
Then I run on my Royale/AS side, StimulsoftReports.loadReport ... but I get
console error: Uncaught ReferenceError: StimulsoftReports is not defined
Perhaps I should create a JS file with this JS script and append to
document head.
Carlos Rovira <[email protected]> escreveu no dia sexta, 2/10/2020
à(s) 12:32:
> Sorry Hugo, don't understand what you mean in your question
> can you reformulate?
>
>
> El vie., 2 oct. 2020 a las 0:27, Hugo Ferreira (<[email protected]>)
> escribió:
>
> > Hi,
> >
> > I'm currently building a new "wrapper" for Apache Royale to render and
> > design reports thru StimulsoftReports JS library
> >
> > I learned the concept from Carlos and Maria examples and also the
> > documentation.
> > I learned how to import external JS libraries and CSS and how to just
> call
> > a JS function with parameters.
> >
> > But I need to run and build JS on the Royale side.
> > Use StimulsolftReports it's not done by call just a function.
> > I need to build JS code.
> >
> > A short example:
> > var report = new Stimulsoft.Report.StiReport();
> > report.loadFile("SimpleList.mrt");
> > var viewer = new Stimulsoft.Viewer.StiViewer();
> > viewer.report = report;
> >
> > Is there a way to do this like a way to inject this code as the way we
> > already have to inject JS and CSS files on the header ?
> > Or the only way is to build the JS code on a separate JS file and include
> > it on the project ?
> >
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>