Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

reading excel file using borland 6.0

Posted on 2004-09-20
9
Medium Priority
?
864 Views
Last Modified: 2012-08-13
I am trying to read excel file using Borland 6.0. I think TExcelWorksheet component is the way to go but I can not find any documentation as how to use it, can you suggest a source of reference that contains some examples of how this component.
0
Comment
Question by:Masood_b
[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
  • 2
9 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 12105477
Example code:
With TExcelApplication Excel, TExcelWorkBook Book and TExcelWorksheet Sheet..


        WideString fname = "c:\\test.xls";
        WideString sname = "Hello World";
        RangePtr r;
        Excel->Connect();
        Book->ConnectTo(Excel->Workbooks->Open(fname));
        Sheet->ConnectTo(Book->Worksheets->get_Item(1));

        Excel->Set_Visible(0, True);
        Sheet->Set_Name(sname);
        r = Sheet->Cells->SpecialCells(xlCellTypeLastCell);
        long x = r->Column;
        long y = r->Row;
        r->set_Formula("=sum(a1:b3)+1000");
        long v = r->get_Value();
        Sheet->Cells->set__Default(y+1, 1, v);
        r = Sheet->Cells->get_Range_("a1", "b20");
        FontPtr f = r->get_Font();
        r->set_Formula("=rand()");
        r = r = Sheet->Cells->SpecialCells(xlCellTypeLastCell);
        y = r->Row;
        Sheet->Cells->set__Default(y+2, 1, "=average(a1:b20)");
        Sheet->Cells->Calculate();
        f->set_Color(clRed);
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Masood_b
ID: 12108427
Axter

I tried the set of code you gave me I get these error message from compiler what do you suggest as the solution

Build
  [C++ Error] Unit1.cpp(21): E2285 Could not find a match for 'Sheets::get_Item(int)'
  [C++ Error] Unit1.cpp(23): E2316 'Set_Visible' is not a member of 'TExcelApplication'
  [C++ Error] Unit1.cpp(24): E2316 'Set_Name' is not a member of 'TExcelWorksheet'
  [C++ Error] Unit1.cpp(28): E2034 Cannot convert 'char *' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(28): E2342 Type mismatch in parameter 'Param1' (wanted 'tagVARIANT', got 'char *')
  [C++ Error] Unit1.cpp(29): E2034 Cannot convert 'tagVARIANT' to 'long'
  [C++ Error] Unit1.cpp(30): E2034 Cannot convert 'long' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(30): E2342 Type mismatch in parameter 'RowIndex' (wanted 'tagVARIANT', got 'long')
  [C++ Error] Unit1.cpp(30): E2034 Cannot convert 'int' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(30): E2342 Type mismatch in parameter 'ColumnIndex' (wanted 'tagVARIANT', got 'int')
  [C++ Error] Unit1.cpp(30): E2034 Cannot convert 'long' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(30): E2342 Type mismatch in parameter 'Param3' (wanted 'tagVARIANT', got 'long')
  [C++ Error] Unit1.cpp(31): E2034 Cannot convert 'char *' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(31): E2342 Type mismatch in parameter 'Cell1' (wanted 'tagVARIANT', got 'char *')
  [C++ Error] Unit1.cpp(31): E2034 Cannot convert 'char *' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(31): E2342 Type mismatch in parameter 'Cell2' (wanted 'tagVARIANT', got 'char *')
  [C++ Error] Unit1.cpp(33): E2034 Cannot convert 'char *' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(33): E2342 Type mismatch in parameter 'Param1' (wanted 'tagVARIANT', got 'char *')
  [C++ Error] Unit1.cpp(36): E2034 Cannot convert 'long' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(36): E2342 Type mismatch in parameter 'RowIndex' (wanted 'tagVARIANT', got 'long')
  [C++ Error] Unit1.cpp(36): E2034 Cannot convert 'int' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(36): E2342 Type mismatch in parameter 'ColumnIndex' (wanted 'tagVARIANT', got 'int')
  [C++ Error] Unit1.cpp(36): E2034 Cannot convert 'char *' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(36): E2342 Type mismatch in parameter 'Param3' (wanted 'tagVARIANT', got 'char *')
  [C++ Error] Unit1.cpp(38): E2034 Cannot convert 'const TColor' to 'tagVARIANT'
  [C++ Error] Unit1.cpp(38): E2228 Too many error or warning messages
0
 
LVL 30

Expert Comment

by:Axter
ID: 12108563
Looks  like you don't have the right header files included.

Did you download this library on to your computer?

If so, do a keyword search for the above member function errors, and see if you can find the required header.
0
 

Author Comment

by:Masood_b
ID: 12111152
I tried to the search for the member function and could not find any info on them.
What should I use as the header and library.

0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12632996
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

  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 …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

636 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