Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/stream/xlsx/workbook-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ WorkbookWriter.prototype = {
var useSharedStrings = options.useSharedStrings !== undefined ?
options.useSharedStrings :
this.useSharedStrings;
var tabColor = options.tabColor !== undefined ?
options.tabColor :
null;

var id = this.nextId;
name = name || 'sheet' + id;
Expand All @@ -163,7 +166,8 @@ WorkbookWriter.prototype = {
id: id,
name: name,
workbook: this,
useSharedStrings: useSharedStrings
useSharedStrings: useSharedStrings,
tabColor: tabColor
});

this._worksheets[id] = worksheet;
Expand Down
5 changes: 5 additions & 0 deletions lib/stream/xlsx/worksheet-writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ var WorksheetWriter = module.exports = function(options) {

this._workbook = options.workbook;

this.tabColor = options.tabColor;

// start writing to stream now
this._writeOpenWorksheet();

Expand Down Expand Up @@ -337,6 +339,9 @@ WorksheetWriter.prototype = {
xml.addText('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');
xml.addText('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">');

if (this.tabColor)
xml.addText('<sheetPr><tabColor rgb="' + this.tabColor + '"/></sheetPr>');

xml.addText('<sheetViews><sheetView workbookViewId="0"/></sheetViews>');
xml.addText('<sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/>');

Expand Down