How to set cell type to text when export excel with wijmo

Posted by: bzhang on 20 April 2018, 5:30 am EST

    • Post Options:
    • Link

    Posted 20 April 2018, 5:30 am EST

    Hello Wijmo team,

    I am using wijmo 5 and angular 5 in our project right now.

    Now, our customer want us to develop a feature to export data within an excel file. Here is the issue what I am facing. We have some data like productId and customerId which value could be “0001” or “99001”. Now, when I export data into excell, some of them display as text like “0001” and some display as number like “99001”.

    My question is how to set cell type to text so that excel can display these values as text.

    Now, I am adding space before or after these values to force them display as text. But it is not what I want. Because I am going to develop another feature which our customer can post excel to our server after they edit the excel. So, I should not give them id values with unnecessary spaces.

  • Posted 20 April 2018, 5:33 am EST

    By the way, my current wijmo package is C1Wijmo-Enterprise_5.20172.328.zip and angular version is 5.1.0

  • Posted 23 April 2018, 9:58 pm EST

    Hi,

    The issue you are facing is because the default cell format used while saving sheet is General i.e no specific format and excel can format them automatically.

    If you want your cells to be in text format then you need to update the cells format to ‘@’ which is equivalent to text format in excel.

    Please refer to the following example:- https://stackblitz.com/edit/angular-6dcgyq?file=app%2Fapp.component.ts

    ~Manish

  • Posted 24 April 2018, 3:36 am EST

    It works.

    Thank you Manish.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels