In this section, you will learn how to export a Diagram Table in CSV format.
To export a Diagram Table in the CSV format using the Magic Report plugin


#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 |