problem with export lines from memo to excel but in different cells in bcb6

This is a discussion on problem with export lines from memo to excel but in different cells in bcb6 within the C++ Programming forums, part of the General Programming Boards category; hello i use bcb6 and i have problem with export every line from a memo to a different cells in ...

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    3

    problem with export lines from memo to excel but in different cells in bcb6

    hello i use bcb6 and i have problem with export every line from a memo to a different cells in a excel.i have write this code but export only the first line in the first cell exported.
    this is my code:
    Code:
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      ExcelApplication1->Connect();
       ExcelApplication1->Workbooks->Add();
      ExcelWorkbook1->ConnectTo(ExcelApplication1->ActiveWorkbook);
       ExcelWorksheet1->ConnectTo(ExcelApplication1->ActiveSheet);
     ExcelApplication1->set_SheetsInNewWorkbook(LOCALE_USER_DEFAULT, 1);
       int j;
       int i;
       for (j=2;j<=Memo1->Lines->Count;j++)
       {
              for(i=1;i<Memo1->Lines->Count;i++)
            {
            AnsiString temp = Memo1->Lines->Strings[i];
            ExcelWorksheet1->Cells->set_Item(TVariant(j), TVariant("A"), TVariant(temp));
           ExcelApplication1->set_Visible(LOCALE_USER_DEFAULT,1);
       ExcelApplication1->Disconnect();
             }
     }
    }
    have you any ideas for my problem;
    thank you in advance

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    > ExcelApplication1->Disconnect();
    Why is this inside your innermost loop?

    Your indentation is awful enough to not spot this.
    SourceForge.net: Indentation - cpwiki
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    So, with the mistake fixed in your cross-posted code over here -> Hello I Have Problem To Export Memo To Excel,use Bcb6 - C And C++ | Dream.In.Code

    What is interesting is that the code here seems to be a degrade.

    Are you just making random edits, and posting each new failure on a different forum?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    May 2012
    Posts
    3
    hello again,i am new in programming ,so its normal to have failures,and yes i had written in differed forum cause i am register both of two...
    i only ask for help not for critisism.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,396
    It is normal to have failures. Salem didn't suggest otherwise.

    If you post in one forum, let that forum have a real opportunity to help you solve your problem before you post to a second forum. If, after some time passes, you aren't getting any help feel free to post on another forum.

    If you post the same problem at multiple forums at the same time you should expect people to be cranky with you.

    It is not just bad etiquette. (Though, it is absolutely bad etiquette.) It makes you come off as a jerk. People trying to help you solve the same problem at the same time without knowing about each groups efforts are doomed to repeat some of that effort. That wastes the time of the people trying to help you.

    Understand this though, "not getting help" is not the same as "not working with the help you receive"; posting to another forum is still wrong when a forum is trying to help you and you aren't cooperating or just don't get what is being said.

    Soma

  6. #6
    Registered User
    Join Date
    May 2012
    Posts
    3
    i understand now what you say...i didn't think that way.But it isn't right to swear too..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading Excel Row Cells A through J
    By CheyenneWay in forum C++ Programming
    Replies: 37
    Last Post: 03-17-2011, 09:00 AM
  2. Write/Read Excel Cells
    By rogster001 in forum C Programming
    Replies: 15
    Last Post: 02-26-2008, 04:54 AM
  3. Merging the cells of excel from vc++
    By yongzai in forum Windows Programming
    Replies: 1
    Last Post: 06-16-2006, 04:42 AM
  4. Datagrid Export to MS Excel with C++ .NET
    By Gerudom in forum Windows Programming
    Replies: 3
    Last Post: 06-09-2006, 08:58 AM
  5. excel spreadsheets / blank cells
    By xddxogm3 in forum Tech Board
    Replies: 3
    Last Post: 06-14-2005, 01:10 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21