Newest Post

Showing posts with label Excel. Show all posts
Showing posts with label Excel. Show all posts

Microsoft Excel - Unmerge cells and fill down the values in all rows

| Tuesday, March 22, 2016
Read more »
This can be done using Go to Special command in Find and Select option. Following are the steps to achieve this.
1. Select the columns that have merged cells.
2. Click Home > Merge & Center > Unmerge Cells
3. The merged cells have been unmerged and only the first cell will be filled with the original values. Keep the range selected or select the range again.
4. Click Home > Find & Select > Go To Special. In the Go To Special dialog box, select Blanks option

5. Click OK, all of the blank cells in the range have been selected. Then input = and press Up arrow key on the keyboard.
6. Press Ctrl + Enter keys, all of the blank cells have been filled with the original merged data.


TaDa!!!! DONE

Code to export the Grid View/Data Grid data into Excel File.

| Friday, February 13, 2015
Read more »
 protected void btnExportToExcel_Click(object sender, EventArgs e)  
       DataTable dt = student.GetDetails("B.Tech").Tables[0];  
       DataGrid GridView1 = new DataGrid();  
       GridView1.DataSource = dt;  
       Response.Buffer = true;  
       Response.AddHeader("content-disposition", string.Format("attachment; filename=StudentsBTech.xls"));  
       Response.Charset = "";  
       Response.ContentType = "application/";  
       StringWriter sw = new StringWriter();  
       HtmlTextWriter htw = new HtmlTextWriter(sw);  
       GridView1.GridLines = GridLines.Both;  
       GridView1.AllowPaging = false;  
     catch (Exception ex)  
     finally { Response.End(); }  
   public override void VerifyRenderingInServerForm(Control control)  
   { }