List Info

Thread: C-Sharp (C#) Group: !!!!!!! Please...Urgent.... Data transfer problem to MS Excel .....




C-Sharp (C#) Group: !!!!!!! Please...Urgent.... Data transfer problem to MS Excel .....
user name
2006-05-08 21:42:45
hi all,

i m transfering data from datagrid to excel and it takes so
many pages
in excel, and i

have to list datas in excel horizontal (i mean page)

my question is.......

HOW CAN I ARRANGE PAGE POSITION WITH CODES IN C#  ?????

I WANT TO MAKE PAGE POSITION HORIZONTAL

PLEASE HEEEEEEEEEEEEEELP 

thnks for now.....


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: !!!!!!! Please...Urgent.... Data transfer problem to MS Excel .....
user name
2006-05-11 06:58:59
hi gndzkdr,
                  use this code for  exporting data into xls
file.You
need to reference a dll file for this
that you can get at following link

http://www.codeproject.com/aspnet/ExportClassLibrary.asp


when you download any project then you will get rklib......
dll .Use
this

private void Page_Load(object sender, System.EventArgs e)
		{
			try
			{
				lblError.Text = "";
				if (!IsPostBack)
				{
					get_AllEmployees( );
					Session["dsEmployee"] = dsEmployee;

					dgEmployee1.DataSource =
dsEmployee.Tables["Employee"];
					dgEmployee1.DataBind();

					dgEmployee2.DataSource =
dsEmployee.Tables["Employee"];
					dgEmployee2.DataBind();

					dgEmployee3.DataSource =
dsEmployee.Tables["Employee"];
					dgEmployee3.DataBind();
				}
			}
			catch(Exception Ex)
			{
				lblError.Text = Ex.Message;
			}
		}

		private DataSet get_AllEmployees()
		{
			try
			{
				// Get the employee details
				string strSql = "SELECT EmployeeID, LastName,
FirstName,
Format(BirthDate, 'dd-MMM-yyyy') As BirthDate,
Format(HireDate,
'dd-MMM-yyyy') As HireDate, Address, PostalCode FROM
Employees";
				OleDbConnection objConn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" +
Server.MapPath("Database\\Employee.mdb"));
				OleDbDataAdapter daEmp = new OleDbDataAdapter(strSql,
objConn);
				daEmp.Fill(dsEmployee, "Employee");
				return dsEmployee;
			}
			catch(Exception Ex)
			{
				throw Ex;
			}
		}

private void btnExport2_Click(object sender,
System.EventArgs e)
		{
			// Export the details of specified columns
			try
			{
				// Get the datatable to export
				DataTable dtEmployee = ((DataSet)
Session["dsEmployee"]).Tables["Employee&q
uot;].Copy();

				// Specify the column list to export
				int[] iColumns = {1,2,3,5,6};

				// Export the details of specified columns to Excel
				RKLib.ExportData.Export objExport = new
RKLib.ExportData.Export("Web");
				objExport.ExportDetails(dtEmployee, iColumns,
Export.ExportFormat.Excel,
"EmployeesInfo2.xls");
			}
			catch(Exception Ex)
			{
				lblError.Text = Ex.Message;
			}
		}


Thanks & Regards,
Gagan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )