Sunday, May 16, 2010

Write As XML with .XLS extensions

Today I want to share with you how to write XML file as an excel file from DataTable. Here I  provide you a function where you just send a DataTable as a parameter and this function is responsible for generate the Excel file.

Code:
     public void ExportAsXMLtoXLS(DataTable dt)
    {
        System.Data.DataTable dt = GetData();
        dt.TableName = "Employees";
        dt.WriteXml(Server.MapPath(".")+ @"\GenerateData.xls", XmlWriteMode.IgnoreSchema);
        Response.Redirect("GenerateData.xls");
    }

No comments:

Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'

Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...