0

I am exporting the json data through angularjs ui-grid to the excel format. I see few formatting properties for pdf , but not for excel. Could someone help how to format the excel cell of this exported csv. Or if the formatting can be done at all .

Thanks,

  • What do you mean by formatting options? If you mean style etc. that is not possible with csv format. If you want to select rows / columns see this example in the docs. http://ui-grid.info/docs/#/tutorial/206_exporting_data – Ant Kennedy May 21 '16 at 16:16

1 Answers1

0

Interesting question. Unfortunately, this is not a default option. A CSV is simply a text-only format, with no specification for including metadata.

I've not done this, but believe that you could probably put something together with a bit of effort using what Brian Hann has outline in his blog, and the UI-Grid exporter service. While what he has outline is the inverse of what you want, having an example of the two libraries together should help get closer to the solution.

On a side note, if you are not doing any paging with the grid, you could create an exporter outside of the grid, knowing that $scope.gridOptions.data will contain your source. There is a basic example of how to get the data into XLSX format here: Exporting an array to excel file with cell formatting.

XLSX.writeFile($scope.gridOptions.data, 'grid_export.xlsx');
Community
  • 1
  • 1
Brian
  • 4,921
  • 3
  • 20
  • 29