How to display with decimal point while clicking Export To Excel in FlexGrid

Posted by: ramu on 16 October 2017, 9:37 pm EST

    • Post Options:
    • Link

    Posted 16 October 2017, 9:37 pm EST

    Hi,

    I have used Wijmo 5.20171.282 version.

    Included below line in my html file.

    exportExcel() {

    wijmo.grid.xlsx.FlexGridXlsxConverter.saveAsync(this.flexGrid, { includeColumnHeaders: true, includeCellStyles: true }, ‘FlexGrid.xlsx’);

    }

    Here I have set to true in “includeCellStyles” attribute. Even while export to excel, I couldn’t see with decimal point default.

    Ex: My column value having “150.0” → It display 150. But I am having “180.8” → It display 180.80.

    Once I selected the cell manually and format the cell change the decimal place “1” then I can able to see with decimal point 150.0 and 180.8

    Anyone know how to resolve this issue?

    Thanks,

    Ramu

  • Posted 17 October 2017, 4:19 pm EST

    Hi Ramu,

    Wijmo follows https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings

    By default, the format “n” would neglect the decimal values if the values are all zeroes and default number of decimal places are then used depending upon the culture (2 places being default in en cultures).

    What exactly is your requirement here?

    ~nilay

  • Posted 18 October 2017, 4:48 pm EST

    Thanks for your reply.

    I want to display with single decimal place.

    Ex: My collection having with decimal place. 98.0, 15.6, 56.9, 44,8, 77.0

    I want to display exactly above numbers will display into my excel sheet. How to accomplish this?

    But right now once export to excel, It displayed like 98, 15.60, 56.90, 44.80, 77.

    Thanks,

    Ramu

  • Posted 22 October 2017, 10:42 pm EST

    Hi,

    If you need to display exactly 1 decimal place, I would suggest you set format for the column as ‘n1’.

    Angular2 Example:

    <wj-flex-grid #flex
                  [itemsSource]="data"
                  (initialized)="initFlexGrid(flex)"
                  (selectionChanged)="selectionChanged(flex)"
                  style="height:500px;">
        <wj-flex-grid-column [header]="'Id'" [binding]="'id'"></wj-flex-grid-column>
        <wj-flex-grid-column [header]="'Amount'" [binding]="'amount'" format="n1">
            <template wjFlexGridCellTemplate [cellType]="'CellEdit'" let-cell="cell">
                <wj-input-number [(value)]="cell.value" [step]="1"></wj-input-number>
            </template>
        </wj-flex-grid-column>
    </wj-flex-grid>
    

    ~nilay

  • Posted 26 October 2017, 4:43 pm EST

    Thanks nilay.

    It works as I expected.

Need extra support?

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

Learn More

Forum Channels