Aspose.Cells time span format issue

Hello,
I want to set TimeSpan value to cell. This value should be displayed in the specified format - “h:mm:ss”. But it does not work - as result, I see text “hh:mm:ss” in the cell. If I focus the cell and then I move focus to another cell, value format becomes correct. Please see my code snippet:

var timeSpan = TimeSpan.FromMinutes(1);
var cell = _sheet.Cells.CheckCell(0, 3);
cell.Value = timeSpan;
var style = cell.GetStyle();
style.SetCustom(“h:mm:ss”, true);
cell.SetStyle(style);

Now it does not work. Please help me - how to display the correct time span format? Thank you.

@Mike1987,

Your value seems not in TimeSpan format, so you may change the line of code:

cell.Value = timeSpan;

with:

cell.PutValue(timeSpan.ToString(), true);

it will work fine as I tested. The suggested line of code will convert the value to proper data type.