![]() I have tried everything, but I really don't seem to be able to get this to work properly. Row = prop.GetValue(item) ? DBNull.Value ĭebugging the columns I have been able to see that, up to the lines where I format the columns to "dd-MM-yyyy", the date information is still in datetime format. (prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ? prop.PropertyType) PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T)) įoreach (PropertyDescriptor prop in properties) This is the code where I create the DataTable: public static DataTable ObjectToDataTable(this IList data) These lines are the ones where the columns should be converted to datetime: _range = "J2:J" + (dt.Rows.Count + 1).ToString() Response.BinaryWrite(pck.GetAsByteArray()) Response.AddHeader("content-disposition", "attachment filename=Payee-Grid.xlsx") I don't know if that will be remedied in the forthcoming Apache OpenOffice 4.0 or not. _range = "J2:J" + (dt.Rows.Count + 1).ToString() Ĭol. = "dd/MM/yyyy" Ĭol.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center 15 Apache OpenOffice 3.4.1 (and earlier versions) does not store in OOXML formats (.docx. Using (ExcelRange col = ws.Cells)Ĭol. = "#,#0.00" Ĭol.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right String _range = "G2:G" + (dt.Rows.Count + 1).ToString() Load the datatable into the sheet, starting from cell A1. Here's my code: private object ProcessXLSFile(PayeesWorkingHoursFullDataDTO payeesWorkingHoursFullDataDTO)ĭataTable dt = Functions.ObjectToDataTable(payeesWorkingHoursFullDataDTO.ListWorkingHours) ĮxcelWorksheet ws = ("WorkSheet1") Thing is, everything works great, except the dates, which are shown in a numeric value instead of the datetime format. ![]() I am having an issue when passing some data to an Excel spreadsheet, using OOX. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |