Solved

Export to excel using Borland c++ Builder

Posted on 2003-10-30
4
2,234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

615 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