When I save the report with my image and I reopen my report, I can't see the image.
Here is what I get the first time (see in attachment FirstTimeOpen screenshots)
Then, I save the report.
But when I reopen this report I don't see the image that I added. Here is what I get in the second time (see in attachment SecondTimeOpen screenshots)
Here is the code used to generateTheReport :
Code: Select all
generateReport: function() {
// License
Stimulsoft.Base.StiLicense.loadFromFile(LICENCE_PATH);
// Définit l'interface par défaut en Français
Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile(LOCALIZATION_PATH + "fr.xml", true, "French (Français)");
// Ajout de Espagnol dans le menu de choix de langues.
Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile(LOCALIZATION_PATH + "es.xml", false, "Spanish (Español)");
report = new Stimulsoft.Report.StiReport();
// Initialise la source de données.
var dataSet = new Stimulsoft.System.Data.DataSet("Données");
report.load(this.mrt);
// On vide le dictionary du mrt pour partir sur quelque chose de propre.
report.dictionary.clear();
//console.log(report);
//report.dictionary.resources.add("/src/report/Images/sol_logo.jpg");
// Ajout des données au report.
var listDatas = JSON.parse(this.datas);
for (var i in listDatas){
// Lecture d'une table dans le JSON.
dataSet.readJson(listDatas[i]);
// Association table / Source de données.
report.regData(dataSet.dataSetName, "", dataSet);
}
//dataSet.readJson("");
//report.regData(dataSet.dataSetName, "", dataSet);
// Synchronisation du dictionary avec ses nouvelles données.
report.dictionary.synchronize();
// Ajout des alias aux colonnes.
this.setAliasOnReport(report);
// How can I clean the report.dictionary.resources as I do for datas ?
//report.dictionary.resources = [];
var content = Stimulsoft.System.IO.Http.getFile("/src/report/Images/sol_logo.png", true);
var resource = new Stimulsoft.Report.Dictionary.StiResource("ImgName", "ImgAlias", false, Stimulsoft.Report.Dictionary.StiResourceType.Image, content);
console.log(report.dictionary.resources);
report.dictionary.resources.add(resource);
report.dictionary.synchronize();
// Nécessaire de le rendre une fois que tout est prêt pour l'afficher.
report.render();
// Créer le viewer.
this.createViewer();
}
Is there a way to clean the report.dictionary.resource ? I already do a report.dictionary.clear() but it don't seems to work for the resources...
Or is there a way to know if my file already exist ?
Moreover, in the future I want to offer all files in my folder "/src/report/Images", is there something to do something like
Code: Select all
var contents = Stimulsoft.System.IO.Http.getFiles("/src/report/Images/*", true);
contents.forEach(function (c) {
var resource = new Stimulsoft.Report.Dictionary.StiResource("ImgName", "ImgAlias", false, Stimulsoft.Report.Dictionary.StiResourceType.Image, c);
report.dictionary.resources.add(resource);
});
report.dictionary.synchronize();
?