exceljs / exceljs/exceljs

[BUG] Sorting is not working after I apply auto filter

Open
#2,289 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

**Sorting is not working after I apply auto filter**
We create excel file using below code and try to sort on filters but it gets closed unexpectedly.

Lib version: 4.3.0

## Steps To Reproduce

```javascript
const ExcelJS = require('exceljs');

// Create a new workbook and add a worksheet
const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet('Sheet1');

// Add data to the worksheet
worksheet.addRow(['Name', 'Age', 'City']);
worksheet.addRow(['John Doe', 30, 'New York']);
worksheet.addRow(['Jane Smith', 23, 'London']);
worksheet.addRow(['Jane Smith', 21, 'PAk']);
worksheet.addRow(['Jane Smith', 20, 'India']);
worksheet.addRow(['Jane Smith', 33, 'London']);

// worksheet.mergeCells('B2:C2');
// worksheet.getCell('B2').value = "flight not found";

// Enable filters on the desired columns
worksheet.autoFilter = {
from: {
row: 1,
column: 1
},
to: {
row: 3,
column: 3
}
};
// Save the workbook to a file
workbook.xlsx.writeFile('output.xlsx')
.then(function() {
console.log('Excel file created successfully.');
})
.catch(function(error) {
console.log('An error occurred while creating the Excel file:', error);
});

Open created excel and try to apply sorting on filters the gets closed unexpectedly.

```

## The expected behavior:
Opened created file should be able to apply sorting on columns

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.