Click here to Skip to main content
15,850,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

In a little project I'm working on, I created a simple template in excel which has a chart and a column of values for the chart. I saved this as .xlt (Excel temple). (I hope that's the right way)

Now based on some calculations in my c++ program, I opened this particular .xlt file and saved those values, in the column specified.
But when I open the file, my values are printed but there is no chart.

Need some help please..
Posted
Updated 21-Jun-12 6:50am
v2
Comments
Jochen Arndt 21-Jun-12 11:38am    
What method did you use to write the file (Excel automation or some kind of library)?
Sumal.V 21-Jun-12 11:48am    
Its just a simple Stdio file,
of.WriteString(DispValue(val));
where of is the CStdioFile of;
and DispValue(val)is a function that returns a string of values
Jochen Arndt 21-Jun-12 12:03pm    
I did not really understand how the data are passed to Excel. Did you write to a text file, open it with Excel, and apply the template or did you write directly to the template file? The second method won't work.

BTW: Use the small Reply link on the right of a comment to answer to it (so the author will get an email notification).

1 solution

Templates in an Excel application are the copies of workbooks. So, if you would like to display default values, template is a good idea, in other way, it's not!

You should know that the excel file is not a simple text file! You can't use WriteString(); method!

Start here:
http://support.microsoft.com/kb/308407[^]
http://support.microsoft.com/default.aspx?scid=kb;en-us;178782[^]
BasicExcel - A Class to Read and Write to Microsoft Excel[^]
How to Read and Write Excel Files in C++ via ADO[^]
CSpreadSheet - A Class to Read and Write to Excel and Text Delimited Spreadsheet[^]

Useful library: http://www.libxl.com/[^]
 
Share this answer
 
Comments
Sandeep Mewara 21-Jun-12 16:37pm    
Good answer. 5!
Maciej Los 21-Jun-12 16:44pm    
Thank you, Sandeep ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900