Solved

Export to excel using Borland c++ Builder

Posted on 2003-10-30
4
2,062 Views
Last Modified: 2008-10-23
Hi there all,
I would like to export query results to excel.
A short example would be nice though or
components that I can use.

Exporting a grids data to excel can also work.

I geuss I can't say more than that

Thanks

0
Comment
Question by:morees
4 Comments
 
LVL 17

Accepted Solution

by:
rstaveley earned 25 total points
ID: 9648835
It is easiest to create a .csv file, which you can import into Excel:

--------8<--------
#include <fstream>

int main()
{
    std::ofstream out("myfile.csv");

    // Field names conventionally go at top (not mandatory)
    // columns are separated by commas
    // Strings are quoted (need to double up " to put quotes into strings)
    out << "\"Name\",\"Height\",\n";

    // Here's a row:
    out << "\"Fred\","  
          << 6.2 << ','   // Numbers aren't quoted
          << '\n';

    out.close();
}
--------8<--------
0
 
LVL 6

Assisted Solution

by:GloomyFriar
GloomyFriar earned 25 total points
ID: 9648848
There is the TExcelApplication component in Delphi (ver >4). I think the builder has the same component.
I've put some comments here:

http://oldlook.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20780602.html
0
 
LVL 9

Expert Comment

by:tinchos
ID: 10546313
No comment has been added lately, so it's time to clean up this question.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: rstaveley {http:#9648835} & GloomyFriar {http:#9648848}

Please leave any comments here within the next four days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now