• Resolved verysiberian

    (@verysiberian)


    Hello! Thanks for this wonderful plugin. I was wondering if it’s possible to perform the following reformatting steps before downloading the file into Excel. I know how to do these things in Excel manually, but I must do them repeatedly, so if there’s a way to have everything nice and pretty before I download the file to begin with, that would be superb.

    1. Is it possible to reformat text fields as numbers? In my case, the values are numeric but the fields are a drop-down text field. This means that they must be converted after download.

    2. Is it possible to set the column width automatically? Currently, the column width seems to approximate the field’s label, which makes it very long.

    Thanks for any assistance!

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

    (@doekenorg)

    Hi @verysiberian,

    1. Yes. There is an example in the FAQ for this. So please take a look at that.

    2. This is somewhat possible. You can set a maximum width on the columns. Would that be enough?

    Thread Starter verysiberian

    (@verysiberian)

    Thank you! This is great. Yes, maximum width would be sufficient. ??

    Plugin Author Doeke Norg

    (@doekenorg)

    Hi @verysiberian ,

    In that case you can use the gfexcel_renderer_columns_max_width hook and just return an integer. It will be applied on every form, every cell. But it is a maximum. So smaller will stay smaller. Not sure what the integer represents unit wise, but just pay with it until you have the desired result.

    Thread Starter verysiberian

    (@verysiberian)

    Hello! I was able to get #1 working by following the example in the FAQ — thanks. However, I do not see any documentation for the gfexcel_renderer_columns_max_width hook either here or on the gfexcel.com website. Would you please consider posting a quick example of how to limit column width using that hook?

    Thank you very much!

    Plugin Author Doeke Norg

    (@doekenorg)

    @verysiberian sure, here is an example:

    add_filter('gfexcel_renderer_columns_max_width', function () {
        return 10;
    });

    You can play with the amount until you are satisfied.

    Thread Starter verysiberian

    (@verysiberian)

    Thank you for the fast reply! WordPress is giving me a syntax error, though, when I post your example into functions.php:

    Your PHP code changes were rolled back due to an error on line 263 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘&’

    Plugin Author Doeke Norg

    (@doekenorg)

    @verysiberian please send me your functions.php file. Send it to [email protected]. Ill take a look.

    Thread Starter verysiberian

    (@verysiberian)

    Ah, nevermind…there was HTML formatting included with my initial copy and paste. My bad. Thanks — you’re terrific and your plugin beats sliced bread any day.

    Plugin Author Doeke Norg

    (@doekenorg)

    @verysiberian Glad it worked out. I totally agree. I never send my kids off to school without a copy of the plugin for lunch ??

    Enjoy!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘A few formatting wishes for the resultant Excel file’ is closed to new replies.