Excel Date Customise

Hi

I am using custom component of Aspose (Excel) and setting style of the cell as follows :

style.custom ="dd/mm/yyyy"

and is working fine. But when i Filter that column in Excel using Filter it is showing all date feilds (like strings) instead of filtering it as DATE , MONTH , YEAR .

Please find attached files in which

EXCEL DATE FILTER I AM GETTING - is what i am getting using custom format.When data already existes in that cell.

EXCEL DATE FILTER REQUIRED - is what i require, if data is already existes in that cells. Since by using custom format and setting cell style to Custom "dd/Mm/yyyy" and inputting data it is working fine.But when i set Style "dd/MM/yyyy" to a cell in which already date is present is not working properly it is showing as EXCEL DATE FILTER I AM GETTING like thing.

Can any one help me in this regard.

Thank You.

Hi,

Thanks for reporting.

Please check this code and the output xlsx files namely dates.xlsx.

I have added a sort filter inside it using Excel and it works fine. Please check the dates-filter.xlsx

I have tested it with Aspose.Cells
for .NET v5.3.1.2


C#.


Workbook workbook = new Workbook();


Worksheet worksheet = workbook.Worksheets[0];


DateTime dt = new DateTime(2011, 3, 3);


Cell cell=worksheet.Cells[“A1”];

cell.PutValue(dt);


Style st = cell.GetStyle();

st.Number = 14; // for date

cell.SetStyle(st);


//increment date

dt=dt.AddDays(3);


cell = worksheet.Cells[“A2”];

cell.PutValue(dt);


st = cell.GetStyle();

st.Number = 14; // for date

cell.SetStyle(st);


//increment date

dt = dt.AddDays(3);


cell = worksheet.Cells[“A3”];

cell.PutValue(dt);


st = cell.GetStyle();

st.Number = 14; // for date

cell.SetStyle(st);


//increment date

dt = dt.AddDays(3);


cell = worksheet.Cells[“A4”];

cell.PutValue(dt);


st = cell.GetStyle();

st.Number = 14; // for date

cell.SetStyle(st);


//increment date

dt = dt.AddDays(3);


//autofit columns

worksheet.AutoFitColumns();


workbook.Save(@“f:\downloads\dates.xlsx”);


If you still have a problem, then please provide me your sample application and input files. I will look into it.