Reputation: 93
I am exporting excel file from Angular 8 application using https://www.npmjs.com/package/xlsx package v 0.15.3.
Everything works fine, but I can't seem to find a way to define text alignment in the cell in the exported file.
When I export excel file, text in all cells is aligned left by default, and I want to align it right.
ColInfo
and RowInfo
interfaces from this package don't seem to offer options to align text in cells.
Does anyone know how to do it with this package or any other way?
Upvotes: 4
Views: 8871
Reputation: 21
For reference, I'm doing an Angular 9 project.
You probably figured this out long ago, but in case someone else stumbles on this like I did...the easiest way I found was to switch from xlsx to exceljs. Older answers that suggested the use of xlsx-style took me down a rabbit hole of lots of errors. Exceljs just works, and works simply.
https://www.npmjs.com/package/exceljs
They have great documentation, and their alignment section explains it in simple terms, see image link below (sorry, I'm not allowed to post pictures yet, as this is my first post):
Upvotes: 2