www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - creating a excel graph with C++

reply george_y libero.it writes:
I need some help to generate with a C++ programm a file in Excel format (or at
least in a way that all the information in it can be read by Excel) containing
a graph with the data I choose. As an example I include a simple script that
generates an output file with two columns of integers and I` d like to add in it
a graph in the same file so that when you open the output file aaa.xls with
Excel both the numrical data and graph are present.

Thanks, 
George 


#include <fstream>  

using namespace std;  



int main()  

{ 

double a[10]= {1,2,3,4,5,6,7,8,9,10}; 

double b[10]= {11,12,13,14,15,16,17,18,19,20};  



ofstream fout;  

fout.open("aaa.xls");  

int n= 0; 

for(n= 0; n< 10; n++) 

{ 

fout<< a[n]<<"\t"<<b[n]<<endl; 

}  

fout.close();  

return 0; 

} 

george
Jan 03 2005
next sibling parent chris elliott <biol75 york.ac.uk> writes:
If you just save a tab delimited file file.xls you can then execute

start file.xls

and it will be opened in excel
chris


george_y libero.it wrote:
 I need some help to generate with a C++ programm a file in Excel format (or at
 least in a way that all the information in it can be read by Excel) containing
 a graph with the data I choose. As an example I include a simple script that
 generates an output file with two columns of integers and I` d like to add in
it
 a graph in the same file so that when you open the output file aaa.xls with
 Excel both the numrical data and graph are present.
 
 Thanks, 
 George 
 
 
 #include <fstream>  
 
 using namespace std;  
 
 
 
 int main()  
 
 { 
 
 double a[10]= {1,2,3,4,5,6,7,8,9,10}; 
 
 double b[10]= {11,12,13,14,15,16,17,18,19,20};  
 
 
 
 ofstream fout;  
 
 fout.open("aaa.xls");  
 
 int n= 0; 
 
 for(n= 0; n< 10; n++) 
 
 { 
 
 fout<< a[n]<<"\t"<<b[n]<<endl; 
 
 }  
 
 fout.close();  
 
 return 0; 
 
 } 
 
 george
Jan 11 2005
prev sibling parent LandonEvans <evanslandon810 gmail.com> writes:
On Tuesday, 4 January 2005 at 00:39:23 UTC, george_y wrote:
 I need some help to generate with a C++ programm a file in 
 Excel format (or at least in a way that all the information in 
 it can be read by Excel) containing a graph with the data I 
 choose. As an example I include a simple script that generates 
 an output file with two columns of integers and I` d like to 
 add in it a graph in the same file so that when you open the 
 output file aaa.xls with Excel both the numrical data and graph 
 are present.

 Thanks, George


 #include <fstream>

 using namespace std;



 int main()

 {

 double a[10]= {1,2,3,4,5,6,7,8,9,10};

 double b[10]= {11,12,13,14,15,16,17,18,19,20};



 ofstream fout;

 fout.open("aaa.xls");

 int n= 0;

 for(n= 0; n< 10; n++)

 {

 fout<< a[n]<<"\t"<<b[n]<<endl;

 }

 fout.close();

 return 0;

 }

 george
The easiest way to export/import data from excel in your .net project is by using Excel library like ZETEXCEL.
Apr 04 2019