Giter VIP home page Giter VIP logo

Comments (6)

ilia-khaustov avatar ilia-khaustov commented on August 23, 2024 2

@azukaar I managed to paint cell to a needed shade of grey using following:

 cell.s.fill = {
    fgColor: { rgb: 'DFDFDF' }
 } 

I found out that fgColor value is used as a background for a cell despite its name seems quite opposite. fgColor holds a foreground color for a patternFill with a 'solid' patternType and has nothing to do with font color in a cell. So, when you use bgColor without specifying patternType to 'none', it defaults to 'solid' in js-xslx. This is how it looks in XML:

<fill>
  <patternFill patternType="solid">
    <bgColor/>
  </patternFill>
</fill>

When cell has a patternFill with a 'solid' patternType it changes cell background color to the patternFill fgColor. If it is not specified, system foreground color is used (usually black).

More info here: http://stackoverflow.com/questions/10756206/getting-cell-backgroundcolor-in-excel-with-open-xml-2-0

from js-xlsx.

 avatar commented on August 23, 2024

perfect, thanks!

from js-xlsx.

azukaar avatar azukaar commented on August 23, 2024

I tried to have a look at the source for a fix, but sory for now I didn't find anything relevant, seems like the theme+tint is working properly but not converted correctly to the corresponding grayscale. I was wondering if Excel wasn't actually using the Alpha channel to process them (considering that current implementation hard-translate argb = FF + rgb). I'll let you know if I find anything (because if the issue become too important on our current project I'll to investigate more on it)

from js-xlsx.

azukaar avatar azukaar commented on August 23, 2024

Thanks for the info
Thought I don't directly use the style params itself, they are imported from Excel and re-exported without even being "read". So I don't really want to read the file just to replace grayscale. I guess there's something to be fixed in the parser directly

from js-xlsx.

fghpdf avatar fghpdf commented on August 23, 2024

Do you know how to solve it?(´・_・`)

from js-xlsx.

fghpdf avatar fghpdf commented on August 23, 2024

I solved it today
my code contains
if(color.theme) { do something }
but the color.theme will be 0 , and present false

Notice, the theme must be transfer!
Look

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.