securedeveloper / react-data-export

Export dataset in react.
https://securedeveloper.github.io/react-data-export/
MIT License
179 stars 198 forks source link

I want to center the excel column, set a border #114

Open sanghoTW opened 5 years ago

sanghoTW commented 5 years ago

My reason:


I want to center the excel column(title), set a border. I didn't find a way. What should I do?

vinicius-felix commented 5 years ago

Maybe you can do this, removing the column and use data as title.

const borders = {
  top: { style: "thin" },
  bottom: { style: "thin" },
  left: { style: "thin" },
  right: { style: "thin" }
}

const alignment = {
  horizontal: "center"
}

const multiDataSet = [  
  {
      ySteps: -1,
      columns: [ ],
      data: [
          [
            {
              value: "Name", style: { alignment: alignment, border: borders, font: { bold: true } }  
            },
            {
              value: "Type", style: { alignment: alignment, border: borders, font: { bold: true } }  
            }
          ],

          [
            {
              value: "Felix", style: { alignment: alignment, border: borders }  
            },
            {
              value: "Cat", style: { alignment: alignment, border: borders }  
            }
          ],

          [
            {
              value: "Pocket", style: { alignment: alignment, border: borders }  
            },
            {
              value: "Object", style: { alignment: alignment, border: borders }  
            }
          ]
      ]
  }
];