c# 4.0 - In C#, Excel cell's custom date format not working with EPPlus -
i'm having trouble excel's custom format using epplus. here's code:
var destfile = new fileinfo(@"c:\temp\test1.xlsx"); var filename = "test1"; using (excelpackage pck = new excelpackage(destfile)) {     pck.workbook.worksheets.add(filename); // create worksheet in package        pck.workbook.worksheets[filename].cells["a2"].value = datetime.now.tostring("mm/dd/yyyy hh:mm:ss");     pck.workbook.worksheets[filename].cells["a2"].style.numberformat.format = "d-mmm-yy";      pck.save(); }     the custom format showed right, value in cell doesn't display format needed.  here's i'm trying get: 
note:  need full date value datetime.now.tostring("mm/dd/yyyy hh:mm:ss") other files, custom format need file.  
what need change work?
thanks @paullabbott, here's correct answer:
pck.workbook.worksheets[filename].cells["a2"].value = datetime.now;   this displays results needed.

Comments
Post a Comment