if (dtProcedureDocs != null)
{
DataTable dt = GetProcedureDocssDatatable();
string DocTitleID = lstofWF.Where(o => o.FName == "Document Title").Select(s => s.FID).FirstOrDefault().ToString();
string DocCatID = lstofWF.Where(o => o.FName == "Document Category").Select(s => s.FID).FirstOrDefault().ToString();
foreach (DataRow sRow in dtProcedureDocs.Rows)
{
DataRow dr = dt.NewRow();
dr["Name"] = sRow["Name"];
dr["Document Title"] = sRow[DocTitleID];
dr["Document Type"] = sRow[DocCatID];
dr["Owner"] = sRow["OwnerGuid"].ToString();
dr["Created By"] = sRow["CreatedByGuid"].ToString();
dr["Created Date"] = String.Format("{0:M/d/yyyy}", sRow["CreatedDate"].ToString());
dr["Modified By"] = sRow["ModifiedByGuid"].ToString();
dr["Current Version"] = sRow["OwnerGuid"].ToString();
objTemplatesHelper.InsertRowInDocumentTable(table, dr);
}
}
private DataTable GetProcedureDocssDatatable()
{
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Document Title", typeof(string));
dt.Columns.Add("Document Type", typeof(string));
dt.Columns.Add("Owner", typeof(string));
dt.Columns.Add("Created By", typeof(string));
dt.Columns.Add("Created Date", typeof(string));
dt.Columns.Add("Modified By", typeof(string));
dt.Columns.Add("Current Version", typeof(string));
return dt;
}
Q1 The main things i added here, dtProcedureDocs was fetched from DB & I am exporting the values in MSWORD,the output is not giving me like that
["dd/mm/yyyy"]
---------------------------------------------------------------------------------------------
Q2 If I change the datatype of created date to date time like below,,,then how can i format in the above code?
private DataTable GetProcedureDocssDatatable()
{
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Document Title", typeof(string));
dt.Columns.Add("Document Type", typeof(string));
dt.Columns.Add("Owner", typeof(string));
dt.Columns.Add("Created By", typeof(string));
dt.Columns.Add("Created Date", typeof(datetime));
dt.Columns.Add("Modified By", typeof(string));
dt.Columns.Add("Current Version", typeof(string));
return dt;
}