Appnitro Software Forums » MachForm

export file extensions not formatted properly?

(7 posts)

  1. AlanW
    Member

    When I export either csv or xls files in Firefox v3, the resulting files are named simply "csv" or "xls", rather than "[filename].csv" or "[filename].xls". If I add the "." to the filename the files will autoformat when opening in excel, otherwise I have to format manually. A small inconvenience but seems like this could easily be fixed? Love this product!

    Posted 8 months ago #
  2. Hi,

    Hmm .. I use Firefox 3 and it's work fine in here. Anyway what is your form name and is it only happened in firefox 3 ?

    Posted 8 months ago #
  3. AlanW
    Member

    No actually it is happening in IE7 also, but it is being exported as ".csv[1]" or ".xls[1]". If I take off the "[1]" and add a prefix to the file, such as "test.csv" then it opens fine.

    Posted 8 months ago #
  4. It seems you've blank form name/title, to give default file name when you've blank form name.
    Try to edit your "export_entries.php" file and go to around line 145 ~ 147, you will see these code :

    // sending HTTP headers
    $clean_form_name = ereg_replace("[^a-zA-Z0-9_-]", "",$form_name);
    $workbook->send("{$clean_form_name}.xls");

    try to change with these

    // sending HTTP headers
    $clean_form_name = ereg_replace("[^a-zA-Z0-9_-]", "",$form_name);
    if (trim($clean_form_name) == '') {
    	$clean_form_name = 'no-name';
    }
    $workbook->send("{$clean_form_name}.xls");

    Those code will give "no-name.xls" when you export entries on blank form name, otherwise you can simply set a form name.

    Posted 8 months ago #
  5. AlanW
    Member

    That is fantastic redityo. Is there a way to do this for csv as well?

    Posted 8 months ago #
  6. yes .. you can apply to CSV also, in "export_entries.php" go to around line 170, you'll find this code:

    $clean_form_name = ereg_replace("[^a-zA-Z0-9_-]", "",$form_name);

    then replace with this code

    $clean_form_name = ereg_replace("[^a-zA-Z0-9_-]", "",$form_name);
    
    if (trim($clean_form_name) == '') {
    	$clean_form_name == 'no-name';
    }
    Posted 8 months ago #
  7. AlanW
    Member

    Works great but had to change

    $clean_form_name == 'no-name';

    to

    $clean_form_name = 'no-name';

    Thank you!

    Posted 8 months ago #

RSS feed for this topic

Reply

You must log in to post.