Giter VIP home page Giter VIP logo

Comments (5)

pietersv avatar pietersv commented on August 23, 2024

Short answer, no, that's not an API feature in this branch. But if you can find a way to do that with an appropriate unit test submit a pull request!

from js-xlsx.

toby-howell avatar toby-howell commented on August 23, 2024

You can set the default styles for the workbook in an object under a key of defaultCellStyle in the write_opts object you supply to XLSX.write or XLSX.writeFile.

The code which sets the default default cell styles is at xlsx.js#L12199-L12205.

var defaultStyle = options.defaultCellStyle || {};
if (!defaultStyle.font) defaultStyle.font = {name: 'Calibri', sz: '12'};
if (!defaultStyle.font.name) defaultStyle.font.name = 'Calibri';
if (!defaultStyle.font.sz) defaultStyle.font.sz = 11;
if (!defaultStyle.fill) defaultStyle.fill = {  patternType: "none", fgColor: {}};
if (!defaultStyle.border) defaultStyle.border = {};
if (!defaultStyle.numFmt) defaultStyle.numFmt = 0;

Here are some examples:

Has this been documented anywhere?

from js-xlsx.

petrovi4 avatar petrovi4 commented on August 23, 2024

@toby-howell

table style (not cell style)

from js-xlsx.

gdoteof avatar gdoteof commented on August 23, 2024

is it possible to do this at the table/column level? e.g. make an entire row have a background color without setting the individual cells?

from js-xlsx.

pietersv avatar pietersv commented on August 23, 2024

It may be a part of the Office OpenXML spec and thus possible to add, but not yet part of this library.

from js-xlsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.