Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background color not displayed #7

Open
hawasthi02 opened this issue Apr 21, 2017 · 0 comments
Open

Background color not displayed #7

hawasthi02 opened this issue Apr 21, 2017 · 0 comments

Comments

@hawasthi02
Copy link

hawasthi02 commented Apr 21, 2017

I am unable to see background in xlsm file.

I have imported these libraries
xlsx = require('xlsx'),
fileSaver = require('file-saver');

I am using the following code

for setting the background
cell = {t:'n' , v: workSheet['A' + (row+1)].v + workSheet['B' + (row+1)].v , f:'A' + (row+1)+'+'+'B'+(row+1) ,s: {bgColor: { indexed: 64 }}};

and this for writing into file
wbout = xlsx.write(wb, {bookType:'xlsx', bookSST:true, type: 'base64',cellStyles:'true'});

// to blob
function sheet_to_blob (s) {
const buf = new ArrayBuffer(s.length)
const view = new Uint8Array(buf)
for ( var i = 0; i != s.length; ++i ) view[i] = s.charCodeAt(i) & 0xFF
return buf
}
// export xlsx with file-saver
fileSaver.saveAs(new Blob([sheet_to_blob(wbout)], {
type: 'application/octet-stream'
}), 'test.xlsx')

and it says ReferenceError: Blob is not defined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant