/////////////////////////////////////////////////////////////////////////// // Scripting Tutorial #3 - Excel and HTML output /////////////////////////////////////////////////////////////////////////// // Title // Report to list all attributes from the current selected object(s) // Supports now Excel and HTML; PDF is also handled // // Main new features // - Additional Format Templates (Styles) // - New Functions used, like BeginTable, TableRow, TableCell, TableCellF ... // - Different output handling in case Excel, HTML or PDF // - Support for multiple sheets in one Excel file // - Custom Arrays // - Variable naming and comments closer to ARIS Wizard standard // - optional: Fixed output file name possible // // Author // Volker Eckardt, Oracle Corporation, April 2010 /////////////////////////////////////////////////////////////////////////// var nLocale=Context.getSelectedLanguage(); // Attribute Header Values and Width var headerList = ["Attribute", "Value", "ID", "API Name"] var hWidthList = [30,30,10,40] // To show only maintained attributes set to false var bShowNotMaintainedAttr = false // To force a fixed Excel file name, set to true var bUseFixedOutPutFileName = true /** Main Function */ function main(){ // if you like to define the excel name explicitely, you can use the following instead: if (bUseFixedOutPutFileName == true && Context.getSelectedFormat()==Constants.OUTEXCEL) { var outFileName = Context.getScriptInfo(Constants.SCRIPT_NAME) + ".xls"; var oOutput = Context.createOutputObject(Context.getSelectedFormat(), outFileName); } else { // Create an output Object var oOutput = Context.createOutputObject(); } // define the styles (here Arial, 9) defineStyles(oOutput); // set the html page name oOutput.SetTitle(Context.getScriptInfo(Constants.SCRIPT_NAME)) // read the current selected objects var objoccs = ArisData.getSelectedObjOccs(); // if at least one object selected if (objoccs.length > 0) { // loop through all objects in the list for (o=0;o 0)); } /** Defines a format template - style * @param {Output} oOutput The output object */ function defineStyles(oOutput) { oOutput.DefineF("TEXT", "Arial", 9, Constants.C_DARK_BLUE, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 0, 0, 0, 0, 0, 0); oOutput.DefineF("TABLE_HEAD","Arial", 10, Constants.C_BLACK, Constants.C_SKY_BLUE, Constants.FMT_BOLD | Constants.FMT_CENTER | Constants.FMT_VCENTER, 0, 0, 0, 0, 0, 1); oOutput.DefineF("TABLE_HEAD_RIGHT","Arial", 10, Constants.C_BLACK, Constants.C_SKY_BLUE, Constants.FMT_BOLD | Constants.FMT_RIGHT | Constants.FMT_VCENTER, 0, 0, 0, 0, 0, 1); oOutput.DefineF("TABLE_DATA","Arial", 10, Constants.C_BLACK, Constants.C_WHITE, Constants.FMT_LEFT | Constants.FMT_VCENTER, 0, 0, 0, 0, 0, 1); oOutput.DefineF("ERROR","Arial", 12, Constants.C_RED, Constants.C_WHITE, Constants.FMT_LEFT | Constants.FMT_VCENTER, 0, 0, 0, 0, 0, 1); } // call the main function main()