-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathtest-debug.js
More file actions
23 lines (18 loc) · 883 Bytes
/
test-debug.js
File metadata and controls
23 lines (18 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const { Calx } = require('./dist/Calx.js');
const workbook = Calx.createWorkbook();
const sheet = workbook.createSheet('Sheet1');
sheet.createCell('A1', { value: 10 });
sheet.createCell('A2', { value: 20 });
sheet.createCell('A3', { formula: '=A1+A2' });
sheet.createCell('B1', { formula: '=SUM(A:A)' });
workbook.build();
workbook.calculate();
console.log('A1:', sheet.getCellValue('A1')); // Should be 10
console.log('A2:', sheet.getCellValue('A2')); // Should be 20
console.log('A3:', sheet.getCellValue('A3')); // Should be 30
console.log('B1:', sheet.getCellValue('B1')); // Should be 60
// Check if B1 has dynamic precedents
const b1Cell = sheet.getCellDirect('B1');
console.log('B1 hasDynamicPrecedents:', b1Cell.hasDynamicPrecedents());
console.log('B1 dynamicPrecedents:', b1Cell.dynamicPrecedents);
console.log('B1 depends on column A:', b1Cell.dependsOnColumn('A'));