I'm not sure if this is the proper place to post my question, so please remove it, or move it, if it's not in the proper place.

I want to create a report, which runs on group context, and... for the objects in a given group... it prints in Excel the names... and the graphic representations... of the objects' default symbols. After reading Ms. Klein's tutorials, and looking at the Aris help for some clarifications, I came up with the code below.

But it outputs only the symbols' graphic representations... Without the names of the names of the symbols. Basically, it overwrites the text, and shows only the graphics.

I think that the write( ) method of the Excel workbook overwrites the other content of the report, how can I avoid this?

 
var localeId = Context.getSelectedLanguage();
var outFile = Context.createOutputObject( Constants.OUTEXCEL, "some_report.xls" );

var workbook = Context.createExcelWorkbook( Context.getSelectedFile( ) );
var sheet = workbook.createSheet( null );

main( );

function main( ) {
    
    outFile.BeginTable(100, Constants.C_BLACK, Constants.C_TRANSPARENT, Constants.FMT_LEFT, 5 );
    
    outFile.TableRow( );
    outFile.TableCell( "Symbol Name", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
    outFile.TableCell( "Symbol Graphic", 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
    
    var groups = ArisData.getSelectedGroups( );         
        
    for( var i = 0; i < groups.length; i++ ) {
        
        var currentGroup = groups[ i ]; 
        writeGroupObjects( currentGroup );
    }
    
    outFile.EndTable( "", 100, "Arial", 12, Constants.C_BLACK, Constants.C_TRANSPARENT, 0, Constants.FMT_LEFT | Constants.FMT_VTOP, 5 );
    
    outFile.WriteReport( );
    workbook.write( );
}

function writeGroupObjects( currentGroup ) {
  
    var objectDefinitions = currentGroup.ObjDefList( );
    
    if( objectDefinitions.length > 0 ) {
        
        for( var i = 0; i < objectDefinitions.length; i++ ) {
            
            var currentObjectDefinition = objectDefinitions[ i ];
            
            var defaultSymbolNum = currentObjectDefinition.getDefaultSymbolNum( );
            var filter = ArisData.ActiveFilter( );
            
            var defaultSymbolName = filter.SymbolName( defaultSymbolNum );
            var defaultSymbolGraphic = filter.SymbolGraphic( defaultSymbolNum );
            
            var picName = "symbol" + i + ".png";
            defaultSymbolGraphic.Save( outFile, picName );
            var picture = Context.getFile( picName, Constants.LOCATION_OUTPUT );
            
            outFile.TableRow( );
            outFile.TableCell( defaultSymbolName, 34, "Arial", 10, Constants.C_BLACK, Constants.C_WHITE, 0, Constants.FMT_LEFT | Constants.FMT_VCENTER, 5 );
            
            sheet.setPicture ( picture, 1, i+1, 2, i+2 );
            Context.deleteFile( picName );  
        }
    }
}

 

Tags: ARIS Report script excel