question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Unable to specify a note in a cell within a table

See original GitHub issue

🐛 Bug Report

Lib version: 4.1.0 (latest)

I cannot specify a note in a cell within a table.

Steps To Reproduce

const Excel = require('exceljs');
const workbook = new Excel.Workbook();
const worksheet = workbook.addWorksheet('Test');

const enableTable = true;

const data = [
	['Foo', 'Bar', 'Baz'], // Headers
	['foo', 'bar', 'baz'],
	['foo', 'bar', 'baz'],
	['foo', 'bar', 'baz'],
	['foo', 'bar', 'baz']
];

for (let ri = 0; ri < data.length; ri++) {
	for (let ci = 0; ci < data[ri].length; ci++) {
		worksheet.getCell(ri + 1, ci + 1).value = data[ri][ci];
	}
}

if (enableTable) {
	worksheet.addTable({
		name: 'Table1',
		ref: 'A1',
		headerRow: true,
		totalsRow: false,
		columns: data[0].map(name => ({ name })),
		rows: data.slice(1)
	});
}

worksheet.getCell('B3').note = 'Test Note';

workbook.xlsx.writeFile('test.xlsx');

The expected behaviour:

The generated file should open successfully in Excel, with a note written 'Test Note' in cell B3.

Screenshots

With enableTable set to false, it works, the note is visible:

image

With enableTable set to true, the file is corrupted and Excel can’t repair it (resulting in an empty sheet):

image

image

image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:12

github_iconTop GitHub Comments

3reactions
papbcommented, Sep 15, 2020

Nice, thank you very much. I will try it later and comment here if it worked.

2reactions
rheidaricommented, Sep 15, 2020

Should be pretty simple, just reordering here so that legacyDrawing is being output just after drawing.

https://github.com/exceljs/exceljs/blob/65ea2e4a52343362e4a7309bf961611392dd6a4a/lib/xlsx/xform/sheet/worksheet-xform.js#L329-L342

Read more comments on GitHub >

github_iconTop Results From Across the Web

notes attached to cells not visible, broken since last excel ...
I've got many notes (the yellow non-threaded formerly called comments) in my excel sheets. Since the latest software update I can not display/view...
Read more >
Using structured references with Excel tables - Microsoft Support
To create the table, select any cell within the data range, and press Ctrl+T. ... Don't use cell references Names can't be the...
Read more >
Video: Input and error messages - Microsoft Support
On the Input Message tab, check the box next to Show input message when cell is selected. Type a Title if you want....
Read more >
How to Troubleshoot and Fix Excel Pivot Table Errors
1) Locate Pivot Table Data Source · Select any cell in the pivot table. · On the Ribbon, click the PivotTable Analyze tab...
Read more >
FILTER() - AppSheet Help - Google Support
Select rows of table or sliceReturns select rows of table or slice as a list ... FILTER("Events", ([Venue] <> [Wanted Venue])) produces the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found