Download & Extend

Adding extra quotes characters to view exported as CSV

Project:Views Bonus Pack
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:major
Assigned:Unassigned
Status:needs review

Issue Summary

During exporting view to CSV file I found that:
1. if I want to export most of all fields without quotes (using unchecked option in CSV settings), but not all of them
2. and I want to rewrite the output of some fields using quote character (using field option)
3. and the value of those few fields has commas in it (and that's why I need to add extra quotes)
..I can't do it.

Added this code to views_bonus_export.theme.inc file to resolve it:

      // Check if there is value with rewritten output and if it has "" (quotes)
      if (substr($output,0,1) != '"'){
        $vars['themed_rows'][$i][$j] = $wrap . str_replace('"', $replace_value, $output) . $wrap; 
      }else{
        $vars['themed_rows'][$i][$j] = $wrap . $output . $wrap;
      }