Home > Back-end >  C Builder 2007: Copy the data into excel
C Builder 2007: Copy the data into excel

Time:11-03

There's a very fantasy problem, ask everybody to help me see ~
In my own development Tool machine (Windows 7), to Copy the data into excel file, use the try catch won't have any exception,
But in other machines, when I Copy the data, the try catch pops out accident, always open a clipboard, such a hint, the code is as follows:
TClipboard * Clipboard;
The Clipboard=new TClipboard ();
The Clipboard - & gt; AsText=Data;
Delete the Clipboard;


WorkSheet. OlePropertyGet (" Cell ", iRow, iCol). OleProcedure (" Select ");
WorkSheet. OleProcedure (" Paste ");

Trouble you to help me see, this program is contained in the try, thank you ~ ~

CodePudding user response:

Didn't see you Copy the data code, and delete the Clipboard is not too early,

CodePudding user response:

reference 1st floor ooolinux response:
didn't see you Copy the data code, and delete the Clipboard is not too early,


Clipboard AsText is added to the part of the Data, Delete the I also feel a bit early, but apparently does not affect the operation, I think this part is the system has been done so you can Delete it directly, then operate excel Paste directly, could you please have a look at this operation is ok? Perhaps there is no other copy advice, can not use the Paste?
Thank you ~

CodePudding user response:

I don't like, I remember a CopyToClipboard class methods,

CodePudding user response:

Try to move the delete statement to paste the statement,

CodePudding user response:

reference 4 floor frog studio response:
try after the delete statement which moved to paste,


Hello, I've tried, this had no effect, the phenomenon is still the same, the development machine is ok as usual, other machine error will happen!

CodePudding user response:

The Clipboard is a global thing, reliability is not high, who can read and write, you can insert code to data into Excel spreadsheet, don't need to paste way,

CodePudding user response:

refer to 6th floor ooolinux response:
the Clipboard is a global thing, reliability is not high, who can read and write, you can change the code to insert data into Excel spreadsheet, don't paste way,

For your guidance! How an insertion method, because the clipboard can direct shear before more convenient, excuse me is there any other sample in addition to this method,
In fact, I think reliability when trial... Is really not good, please advise

CodePudding user response:

Ole to read and write Excel, or third party controls to read and write Excel, the former, I collect the original demon elder brother of several pages, now a lot of people in the latter,

CodePudding user response:

Ole way, speaking, reading and writing, the machine must be installed with Excel, it seems with the third party controls can do not need,

CodePudding user response:

references 9 f ooolinux response:
ole way, speaking, reading and writing, on the machine must be installed with Excel, it seems with the third party controls can do not need,

It is to operate Excel, but local machine but can not install Excel, how to understand this?
Operated by OLE Excel can do many things, what also do not need additional installation auxiliary, is a good solution,

CodePudding user response:

references 9 f ooolinux response:
ole way, speaking, reading and writing, on the machine must be installed with Excel, it seems with the third party controls can do not need,


Is OLE way ah, originally, are made or Copy and Paste is to compare wonder why I am different environment will lead to the error, but didn't find the fundamental reasons, just to avoid you submitted I know, this was really fantasy
  • Related