SO

Hi,

In my code i am creating a excel workbook and assigning a model name to it. This code will create a model graphic image and create a xls output with image in it. 

On execution of the code it creates a file properly but an additional blank file is also created with name Reports.xls. 

Can any one pls. suggest what could be wrong.

The below is the code...

Context.setProperty( Constants.PROPERTY_SHOW_OUTPUT_FILE, false ); Context.setProperty(Constants.PROPERTY_SHOW_SUCCESS_MESSAGE, false); var gLang = Context.getSelectedLanguage(); var workbook; var models = ArisData.getSelectedModels(); var dummyOutput = Context.createOutputObject(); main(); dummyOutput.WriteReport(); workbook.write();    function main() {     for (mi in models)     {         var oModel = models[mi];         var workbookName =new java.lang.String(oModel.Name(gLang));         workbookName = checkName(workbookName);         workbook = Context.createExcelWorkbook(workbookName +".xls");           var sheet = workbook.createSheet(oModel.Name(gLang));         pictureOfModel(oModel,sheet);           Dialogs.MsgBox("The script was run successfully");     }          } function checkName(workbookName) {             workbookName = workbookName.replace("\"", " ");             workbookName = workbookName.replace("\\", " ");             workbookName = workbookName.replace("/", " ");             workbookName = workbookName.replace("<", " ");             workbookName = workbookName.replace(">", " ");             workbookName = workbookName.replace("?", " ");             workbookName = workbookName.replace("*", " ");             workbookName = workbookName.replace("|", " ");             workbookName = workbookName.replace(":", " ");           return workbookName;   }   function pictureOfModel(oModel,sheet) {     var pic = oModel.Graphic(false,false,gLang);     pic.setZoom(100);     var width = pic.getWidth(Constants.SIZE_PIXEL ) * 20 * (100.0/125.0) //twips, correction factor because of excel anomaly :  (100.0/125.0)          var xCells = width / 1024;     if (xCells >255)     {         xCells = width / 2048;     }     var xTwips = width % 1024;     var height = pic.getHeight(Constants.SIZE_PIXEL ) * 20*(100.0/133.0) //twips, correction factor because of excel anomaly : \*(100.0/133.0)*/     var yCells = height / 256;     var yTwips = height % 256;          var sFileName = oModel.GUID()+".png";     pic.Save(dummyOutput,sFileName);          var data = Context.getFile(sFileName,Constants.LOCATION_OUTPUT);     sheet.setPicture ( data, Constants.XL_PICTURE_TYPE_PNG, 1, 0+xCells, 1+yCells, 0, 0, xTwips, yTwips);     Context.deleteFile(sFileName); }
by Yubhesh Chaudhari
Posted on Tue, 11/05/2013 - 05:15

you report is creating 2 xls.

1st with <model name>.xls ...having model graphic in it  :::: CORRECT

2nd with Reportxx.xls .... which is going to create because while running report you are specifying this file name.

 

Have you resolved this error?

0
by Sunil Oza Author
Posted on Wed, 11/06/2013 - 05:45

Hi,

Thanks for the reply. 

Still the two output files are generated. How can we disable save output as option in report wizard.

Please suggest if there is any other option for solving this problem

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock