• Resolved pressworthammer

    (@pressworthammer)


    Hi Doeke,

    really cool Plugin, thanks for this. I know it’s kinda stupid, but is there also an option to change the filetype to CSV?

    And two more questions for good measure:
    1. Is it possible to sort the columns in a specific order?
    2. Is it possible to add columns (with a fixed value) which don’t exist in the form?

    Thx!
    Harry

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    Hi @pressworthammer,

    Thanks. Glas you like it.

    I had a bit of a giggle when I saw your question. But I’ve been wondering it myself if CSV was something I should offer as a file type. This request backs that up 🙂

    Let me check as to how easy that will be to render. I believe the library I use has this as a possibility. I’m just curious as to how it will render unicode items.

    As to your other questions. It is my intention to release question 1 in the next release. You will be able to drag and drop the the fields in the wanted order.

    2) is already possible, if you know some php.

    
    add_filter('gfexcel_output_columns',function($columns, $formid) {
        // You can add a column here
        $columns[] = 'Extra columnname';
        return $columns;
    },10,2);
    
    add_filter('gfexcel_output_rows',function($rows, $formid) {
        //add content for the specific row
        foreach($rows as &$row) {
            $row[] = 'Content for extra column';
        }
    
        return $rows;
    },10,2);
    
    

    TBH, I haven’t checked the code above. But something like that should work.
    Let me know how it turns out!

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @pressworthammer,

    I’ve been looking into it, and adding CSV support was really easy. So that will definitely be in the next version. I’m flushing out the last feature for the next release right now. When that’s done It will be rolled out.

    Thread Starter pressworthammer

    (@pressworthammer)

    Now how awesome is that, really cool, thank you!

    I’ll try out your code, thanks for the snippet. As a workaround I think it would also be possible to simply add those “blind” fields in the form as “hidden”. But they show up in the email then, so it’s not optimal, your solution would be better.

    Thread Starter pressworthammer

    (@pressworthammer)

    Just a small update for my workaround regarding the addition of “dummy” columns: One may add those fields with the Visibility option “Administrative”.

    Looking forward to the update with CSV, thanks!

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi Harry,

    Just released 1.5.1. This contains an option to download the file as a csv. Check it out!

    Thread Starter pressworthammer

    (@pressworthammer)

    Works like a charm, thanks!

    Thread Starter pressworthammer

    (@pressworthammer)

    Hey Doeke,

    sorry to bother you again. Is there a quick hack to output CSV like this:
    ID;Timestamp;Name;Phone
    instead of this
    “ID”,”Timestamp”,”Name”,”Phone”
    ?

    Plugin Author Doeke Norg

    (@doekenorg)

    I’ve got to stop replying so fast. But the browser was still open 🙂

    Unfortunately not a quick hack. This would mean an addition to the settings page.
    And To be honest, I’m not even sure this is a good thing. A CSV (comma separated value) should be comma separated. It’s just sad really, that Excel has this weird default of semi-colons. 🙂

    However, because your a big fan, here is a quick hack (to be overwritten in the next release, so I hope, I have a setting by then).

    Add these lines after line 32 in AbstractPHPExcelRenderer.php:

    if($extension === 'csv') {
        $objWriter->setExcelCompatibility(true); // Excel you suck <- this part is really important
    }

    It has a weird sep=; line in the beginning. Not sure if Excel removes that, but on my Mac version of Excel it renders everything else ok. Just that weird line.

    It will output like: "ID";"Timestamp";"Name";"Phone". But trust me, that Enclosure " is a good thing!

    Thread Starter pressworthammer

    (@pressworthammer)

    Hey Doeke, you’re indeed just too fast with replying 😉

    Thanks a lot for the hack!

    Does the quote-enclosure have a security aspect to it?

    Plugin Author Doeke Norg

    (@doekenorg)

    It ensures the right content into the right column. Without it, a quote could be interpreted wrongly.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Export as CSV’ is closed to new replies.