We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Format dd/mm/yyy hh/mm in cell? how?

how can i import data of the format dd/mm/yyyy hh/mm?
Every time i import this in a cell, it gives an ouput like 32456654,64564
Is it done by using style.custom?


You can set the number format as following:
1. Set the number format in your designer file
2. Use Style.Number or Style.Custom to set the number format

is it possible to provide me some example code?

Excel excel = new Excel();

Cells cells = excel.Worksheets[0].Cells;


cells[“A1”].Style.Custom = “dd/mm/yy hh:mm”;

Aspose.Excel is discarded and no more continued now. It is replaced with a new product Aspose.Cells which is much advanced and performant as compared to its predecessor. This new product also supports formatting the cells as shown in the following sample code:

// Instantiating a Workbook object
Workbook workbook = new Workbook();

// Adding a new worksheet to the Excel object
int i = workbook.Worksheets.Add();

// Obtaining the reference of the newly added worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[i];

// Adding the current system date to "A1" cell

// Getting the style of A1 cell
Style style = worksheet.Cells["A1"].GetStyle();

// Setting the custom display format to show date as "dd/mm/yy hh:mm"
style.Custom = "dd/mm/yy hh:mm";


Here is a detailed article which provides more details about data formatting:
Data Formatting

The latest version of this product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

Here is a complete runnable solution which can be used to test the product features.