Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
How to Export To Excel a Dynamically Created rows in Ultraweb Grid?
posted

Hi,

I hav created Ultrawe grid Rows dynamically as per my requirement. I'm creting html table with data and assigning that to dynamicly created cells of grid. I want to export it to Excel.But it is exporting along with all <td><tr>. i Want only the Data like here ProjectName to be exported.Please help me in this

Code Used:

UltraGridRow NewUR;

 NewUR.Cells[2].Text = FormatProjectDetails(DR).ToString();

----------------------------------------------------------------------------------------

private StringBuilder FormatProjectDetails(DataRow DRProj)
    {

        StringBuilder HTMLFormat = new StringBuilder();

        {

          String ProjectName= DRProj["ProjectName"].ToString().Trim();

           HTMLFormat.Append("<table  style='width: 100%; BORDER-RIGHT: medium none;TABLE-LAYOUT: fixed; BORDER-TOP: medium none; BORDER-LEFT: medium none;  BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; WORD-WRAP: break-word' tabIndex=-1; border-color:Gray; margin:0; border=0>");

            HTMLFormat.Append("<tr>");
            HTMLFormat.Append("<td style=\"background-color: WhiteSmoke;  border-bottom:1px solid #dadada; border-right:1px solid #dadada;\" ><strong>Others</strong></td>");
            HTMLFormat.Append("<td style='background-color: White; font-weight:normal;'>" + ProjectName+ "</td>");
            HTMLFormat.Append("</tr>");

            HTMLFormat.Append("</table>");

          }

       return HTMLFormat;

}

================================================

My Export Code is

protected void btnExcelExport_Click(object sender, ImageClickEventArgs e)
    {
        if (uwgWeeklyReportProject.Rows.Count > 0)
        {
            uwgExcelExport.WorksheetName = "WeekLy Report";
            uwgExcelExport.ExportMode = Infragistics.WebUI.UltraWebGrid.ExcelExport.ExportMode.Download;
            uwgExcelExport.DownloadName = "WeekLy Report" + System.DateTime.Now.ToString("yyyyMMdd");
            uwgExcelExport.ExcelStartRow = 3;
            uwgExcelExport.Export(uwgWeeklyReportProject);
        }
    }

 

But it is exporting along with all <td><tr> along with data. i want only the data like here ProjectName to be exported.I want all HTML tags not to be exported.If anyone hav some idea please help me in this

Thanks,

Bobby

------------------------------------------------------------------------------------------------------------------------------------------