I'm finding that when I export Zip codes with a initial zero, that the zero is removed by excel when I load in the XLS file.
Is there a way around this issue?
Would be brilliant to have a real XLS file output from VDE, but until then, is there anything I can do?
Some sort of field-preprocess hack to make excel think it's a text field?...
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | views_data_export-2133935-process-msoffice.patch | 913 bytes | steven jones |
| #4 | leading_zeros_and-2133935-4.patch | 577 bytes | erlendoos |
Comments
Comment #1
robearls commentedI have worked out I need to add style='mso-number-format:"\@"' to the TD
i.e.
<td style='mso-number-format:"\@"'>01234</td>But I still don't know where to put this..
Comment #2
TBarina commentedI'm facing the same issue. Anyone can help?
Many thanks
Comment #3
Würden commentedI know this is not a solution, but you can work around the problem by rewriting the result of the field in the view and add some sort of character such as "." or " " at the end of the field output.
Comment #4
erlendoos commentedApply this patch and you can create a new hook (in a seperate custom module):
Comment #5
erlendoos commentedComment #6
plopescNice patch! Works for me :)
Comment #7
steven jones commentedComment #8
steven jones commentedWe should just split out the final rendering of the cells into a theme process function, and then other modules/themes could just preprocess the data as they liked.
In fact, looking at the code, we should everything except the the first two lines of
template_preprocess_views_data_export_msoffice_bodyinto atemplate_process_views_data_export_msoffice_bodyComment #9
steven jones commentedSomething like this.
Comment #11
steven jones commentedThanks everyone, committed the patch from #9.
Comment #13
Amit Dwivedi commentedHi @Steven Jones,
Can you please suggest me how to achieve it in Drupal 8 ?
I am facing a similar issue with Excel while exporting data in CSV file. (https://www.drupal.org/project/views_data_export/issues/2933032)
Thanks.
Comment #14
tjtj commentedI have this same problem in Drupal 8 and 9. It needs a fix in the module.