Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExcelJS in coldfusion Project

Requirement is to export an excel file(*.xlsx) from ui-grid with some formatting. I am able to export the excel using angularjs, ui-grid and js-xlsx, however I am unable to format the excel cells (ex. bold, text color) with js-xlsx.

I found Exceljs and it looks promising for my requirement. The difficulty is that it is available as npm package and the server I am working on do not have node/npm installed. Alternatively I am unable to find a download/cdn for the same. So I have installed the package on local system and copied the folder exceljs from node_modules and tried the following:

<script src="dist/exceljs.js"></script>

<script>
        var workbook = new Excel.Workbook();
        console.log(workbook);
</script>

It's throwing an error "Uncaught ReferenceError: Excel is not defined".

I am guessing its because it should be included as node modules for the "Excel" object to be available.

var Excel = require('exceljs');

Is there any way I can include and create it without require('').

If it can't be done, I Would Appreciate any other solution/recommendation.

like image 994
Yeou Avatar asked Mar 21 '26 00:03

Yeou


1 Answers

After quick searching in code, I found this. This library is using file reading/writing so u are unable to use it i browser. In the other hand Excel file is zip archive of xml's, so u will never achieve what u want without server-side help or 3rd part service.

like image 67
Adam Jędrzejowski Avatar answered Mar 22 '26 13:03

Adam Jędrzejowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!