Author Topic: Give style when exporting to excel file.  (Read 1509 times)

kiwon34

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 52
    • View Profile
Give style when exporting to excel file.
« on: August 12, 2020, 05:24:20 pm »
Hi,

I want to give border styles to excel cells when exporting.

https://stackblitz.com/edit/paramquery-demo-6cvpfg?file=index.js
This is my example. I want to give styles when "worksheetReady()" is triggered, while not giving styles to the colModel, as in line 77.
I want to give border-bottom style to workbook.sheets[0].columns but it won't work. It only works when I give styles in colModel.
Is there a way to use worksheetReady to give specific cell styles?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Give style when exporting to excel file.
« Reply #1 on: August 12, 2020, 10:17:45 pm »
Your approach is correct; that looks like a bug.

workaround is to define the borders in the order of left, right, top and bottom

Code: [Select]
     let _border ={left: '1px solid #00FF00',
               right: '1px solid #00FF00', 
               top: '1px solid #00FF00',
               bottom: '1px solid #00FF00'
     };

Working stackblitz: https://stackblitz.com/edit/paramquery-demo-59h3ag?file=index.js


As a side note, one() can be used instead of on() & off()
« Last Edit: August 12, 2020, 10:22:01 pm by paramvir »