Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. On the main menu, click Options>Environment. The Environment Options dialog opens.
  2. In the Report Wizard option group, click Add to add a new row in the Configure template mappings table.



  3. In the Template mappings dialog, add .csv as the file extension and .txt as the Template type.



  4. Click OK.
  5. Create a blank text file and copy the sample code below in the text file.

    Code Block
    #macro(formatValue $s)
    #set($value = $s)
    #if($value.indexOf('"') >= 0 || \$value.indexOf(',') >= 0)
    #set($value = '"' + $s + '"')
    #else
    #foreach ($c in $value.toCharArray())
    #if($c.getType($c)==15)
    #set($value = '"' + $s + '"')
    #break
    #end
    #end
    #end
    #end
    #import("table", "com.nomagic.reportwizard.tools.DiagramTableTool")
    #foreach($d in $table.filterDiagramTables($Diagram))
    #set($colIds = $table.getColumnIds($d))$d.getName()
    #foreach($te in $table.getColumnNames($d, $colIds))#formatValue($te)$value,#end
    #foreach($re in $table.getRows($d))
    #foreach($id in $colIds)#formatValue($table.getStringCellValue($d, $re, $id))$value,#end
    #end
    $table.clearTablesCache()
    #end
  6. Save this text file with a CSV file extension.
  7. Add the CSV template to the Report Wizard dialog and generate a CSV report.