Guest User

Untitled

a guest
Jan 24th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var xl = require('excel4node')
  2. const db = require('../config/db.config.js')
  3. const Report = db.report
  4.  
  5. var wb = new xl.Workbook()
  6.  
  7.  
  8. var ws = wb.addWorksheet('MaterialFlowSheet');
  9.  
  10. var style = wb.createStyle({
  11. font: {
  12. color: '#FF0800',
  13. size: 12
  14. }
  15. });
  16.  
  17. module.exports.getexceldata = async function(req, res) {
  18. try {
  19. Report.findAll({
  20. where: {
  21. report_date: req.params.report_date
  22. }
  23. })
  24. ws.cell(1,1).string({vAbsorbing: req.body.vAbsorbing}).style(style)
  25. wb.write('Excel.xlsx');
  26. res.download('Excel.xlsx');
  27. } catch(e) {
  28. errorHandler(res, e)
  29. }
  30. }
  31.  
  32. const db = require('../config/db.config.js')
  33. const Report = db.report
Add Comment
Please, Sign In to add comment