Thursday, 1 August 2013
Sunday, 21 July 2013
The code given below is for getting custom output in excel sheet.
In this example 12 Gridviews are used and are arranged in a custom format in excel sheet...
| Browser Output |
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition",
"attachment;filename=GridViewExport.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
Table tb = new Table();
TableRow tr1 = new TableRow();
TableCell cell1 = new TableCell();
cell1.Controls.Add(GridView1);
tr1.Cells.Add(cell1);
TableCell cell2 = new TableCell();
cell2.Controls.Add(GridView2);
tr1.Cells.Add(cell2);
TableCell cell3 = new TableCell();
cell3.Controls.Add(GridView3);
tr1.Cells.Add(cell3);
TableCell cell4 = new TableCell();
cell4.Controls.Add(GridView4);
tr1.Cells.Add(cell4);
TableCell cell5 = new TableCell();
cell5.Controls.Add(GridView5);
tr1.Cells.Add(cell5);
TableCell cell6 = new TableCell();
cell6.Controls.Add(GridView6);
tr1.Cells.Add(cell6);
tb.Rows.Add(tr1);
////////////////////////Second row on Excel Sheet/////////////////////////
TableRow tr2 = new TableRow();
TableCell cell7 = new TableCell();
cell7.Controls.Add(GridView7);
tr2.Cells.Add(cell7);
TableCell cell8 = new TableCell();
cell8.Controls.Add(GridView8);
tr2.Cells.Add(cell8);
TableCell cell9 = new TableCell();
cell9.Controls.Add(GridView9);
tr2.Cells.Add(cell9);
TableCell cell10 = new TableCell();
cell10.Controls.Add(GridView10);
tr2.Cells.Add(cell10);
TableCell cell11 = new TableCell();
cell11.Controls.Add(GridView11);
tr2.Cells.Add(cell11);
TableCell cell12 = new TableCell();
cell12.Controls.Add(GridView12);
tr2.Cells.Add(cell12);
tb.Rows.Add(tr2);
tb.RenderControl(hw);
string style = @"<style> .textmode { mso-number-format:\@; } </style>";
Response.Write(style);
Response.Output.Write(sw.ToString());
Response.Flush();
Response.End();
}
| Excel output |
If you find any problem with the code,be free to comment below...
We will try to solve it....
Friday, 26 April 2013
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
void main()
{
int gdriver = DETECT, gmode, errorcode; int i,j;
initgraph(&gdriver, &gmode,"");
clrscr();
setcolor(6);
for(i=0;i<150;i++)
{
ellipse(300-i, 300, 0, 360,50,20);
line(350-i,295,380-i,280);
line(341-i,313,380-i,313);
line(380-i,280,380-i,313);
bar3d(50,150,95,800,10,1);
delay(50);
cleardevice();
}
for(j=0;j<500;j++)
circle(95,295,j);
getch();
}
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
void main()
{
int gdriver = DETECT, gmode, errorcode; int i,j;
initgraph(&gdriver, &gmode,"");
clrscr();
setcolor(6);
for(i=0;i<150;i++)
{
ellipse(300-i, 300, 0, 360,50,20);
line(350-i,295,380-i,280);
line(341-i,313,380-i,313);
line(380-i,280,380-i,313);
bar3d(50,150,95,800,10,1);
delay(50);
cleardevice();
}
for(j=0;j<500;j++)
circle(95,295,j);
getch();
}
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
void main()
{
int gdriver = DETECT, gmode, errorcode; int i,j;
initgraph(&gdriver, &gmode,"");
clrscr();
setcolor(4);
for(i=0;i<150;i++)
{
ellipse(300-i, 300, 0, 360,30,10);
line(328-i,295,350-i,280);
line(328-i,303,350-i,310);
line(350-i,280,350-i,310);
circle(280-i,299,2);
delay(50);
cleardevice();
}
for(j=0;j<150;j++)
{
ellipse(300-i, 300-j, 0, 360,30,10);
line(328-i,295-j,350-i,280-j);
line(328-i,303-j,350-i,310-j);
line(350-i,280-j,350-i,310-j);
circle(280-i,299-j,2);
delay(50);
cleardevice();
}
getch();
}
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
void main()
{
int gdriver = DETECT, gmode, errorcode; int i,j;
initgraph(&gdriver, &gmode,"");
clrscr();
setcolor(4);
for(i=0;i<150;i++)
{
ellipse(300-i, 300, 0, 360,30,10);
line(328-i,295,350-i,280);
line(328-i,303,350-i,310);
line(350-i,280,350-i,310);
circle(280-i,299,2);
delay(50);
cleardevice();
}
for(j=0;j<150;j++)
{
ellipse(300-i, 300-j, 0, 360,30,10);
line(328-i,295-j,350-i,280-j);
line(328-i,303-j,350-i,310-j);
line(350-i,280-j,350-i,310-j);
circle(280-i,299-j,2);
delay(50);
cleardevice();
}
getch();
}
Wednesday, 27 February 2013
Subscribe to:
Posts (Atom)



