View Single Post
  #1 (permalink)  
Old May 13th, 2009, 02:17 AM
amitabha.chakraborty amitabha.chakraborty is offline
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Charting in power point using C#

hi,
Can we export "Microsoft .net Chart Component" in Power point?

I have written a sample code using Microsoft .net Chart Component and i want to export it in power point without saving it as a jpg file. how to achieve it?

private void load_chart()
{
// The Access database
string fileNameString = "C:\\Amitabh Per\\C#\\Chart_Win Samples\\data\\ExcelData.xls";
// Initialize a connection string
//string fileNameString = "data\\ExcelData.xls";
// Create connection object by using the preceding connection string.
string sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
fileNameString +
";Extended Properties=\"Excel 8.0;HDR=YES\"";
OleDbConnection myConnection = newOleDbConnection( sConn );
myConnection.Open();
// The code to follow uses a SQL SELECT command to display the data from the worksheet.
// Create new OleDbCommand to return data from worksheet.
OleDbCommand myCommand = newOleDbCommand( "Select * From [data1$A1:E25]", myConnection );
// create a database reader
OleDbDataReader myReader = myCommand.ExecuteReader (CommandBehavior.CloseConnection);
// Populate the chart with data in the file

chart1.DataBindTable(myReader,
"HOUR");
// close the reader and the connection
myReader.Close();
myConnection.Close();
}