Hi,
Thank you for considering Aspose.
Please have a look at the following example:
If you need more help, please do let us know.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html
Thank you!
table.importDataTable() is exactly what I need. My other question is: how do I format a column inside this table. One of my table column is a date format and I would like it to display it in ShortDate format instead of the default LongDateTime format. Can you please show me how to do that?
Thanks.
Hi,
You can define column in your datatable as Datetime. But it is better that you define string column in Datatable and convert your Datetime value to ShortDateString. Please check the code below.
//Add Another Column
dt.Columns.Add("ShortDate", typeof(string));
//Get Your date Value
DateTime testDate = DateTime.Now;
//Convert Date value to Short Date String Format
string myShortDate = testDate.ToShortDateString();
//Add Date value to Datatable
dr[3] = myShortDate;
If you need more help, please do let us know.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html
Hi,
You have two options. You can either create a new datatable with the desired columns and populate it form the data that you have in the current datatable. Or, instead of using the ImportDataTable function, you should create the table manually by looping through all the rows in the datatable and in the mean while perform the conversion.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html