Hi Sentaroh,
Thank you for contacting Syncfusion support.
As per MS Excel behavior, the filtered data cannot be converted as CSV, because all the hidden rows and columns are converted while converting worksheet to CSV. However, you can achieve this through a workaround by copying the filtered data to another worksheet. We have prepared a workaround sample for your reference which can be downloaded from the following link
Kindly refer the following code snippet of this workaround.
Code snippet:
IWorksheet CSVSheet = workbook.Worksheets.Create("CSVSheet");
int i = 1;
foreach (IRange row in filterRange.Rows)
{
if (row.RowHeight != 0)
{
row.CopyTo(CSVSheet[i, row.Column, i, row.LastColumn]);
i++;
}
}
CSVSheet.SaveAs("CSVData.csv", ","); |
Regards,
Sridhar S.