[BUG] Sorting is not working after I apply auto filter
🐛 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
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
Please let us know if any solution is there or there is another way of implementation
@ShyamL1319 The excel generated after running your code locally to me is sorting properly, and is now a screenshot in ascending order by Age. What software are you using to open it, I am using WPS.
@zurmokeeper I am facing the same issue with autofilter i am using MS Excel for open my file. In my case after applying filter sorting is working but if i try to sorting without filter excel is unexpectedly closed. and the same filter is working well in wps excel If you want i can share my code. and this is the file i am facing issue with. Stocklist-15-8-2024 1140114.xlsx
@ShyamL1319 did you find any solution ?