using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter hw = new HtmlTextWriter(sw)) { //Create a Table. Table table = new Table(); //Add Image control to the Table Cell. TableRow row = new TableRow(); row.Cells.Add(new TableCell()); row.Cells[0].Controls.Add(BarcodeImage); table.Rows.Add(row); //Render the Table as HTML. table.RenderControl(hw); //Export the Table to Excel. Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=Images.xls"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-excel"; //Write the HTML string to Response. Response.Write(sw.ToString()); Response.Flush(); Response.End(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)