Clipboard Related Question

  • Thread starter Thread starter S Shulman
  • Start date Start date
S

S Shulman

Hi

I want to write some VB code that copies to the clipboard then pastes it
later, however the Clipboard is a system device that is shared between all
applications and that may interfere with other application both ways.

Is there any way to solve this problem, I have noticed that some application
have more than 1 clipboard are these also system clipboard

Thank you in advance,
Shmuel Shulman
SBS Technologies LTD
 
I agree with everything you said but it is necessary because I wnt to insert
into Word formatted text and that is probably the only way

Cheers,
Shmuel
 
S said:
I agree with everything you said but it is necessary because I wnt to
insert into Word formatted text and that is probably the only way

Well, if you use the clipboard to transfer text to another application,
it's no longer strictly application-internal use, of course. Then again,
if the user doesn't expect the clipboard content to be changed at that
point (because he didn't click a Cut or Copy command), I'd still be
strongly opposed to it.

Why should that be the only way? Normally you use automation to control
Word from another application and there's really (nearly) nothing you
can't do this way. Here's a short introduction for doing this in C#:
http://www.c-sharpcorner.com/Code/2002/Mar/WordFromDotNet.asp

This came out of google, there's loads more to be found if you need it.



Oliver Sturm
 
Thank for your response,
What I want to do is the following: store in the database .rtf text then
paste it into a word doc with the important formatting!, if I will use the
standard method that you are using then the formating will be lost, that is
why I probably need to use the Clipboard that doesn't forget the formatting
(I can get it to the clipboard by reading from the database into RichText
control).

Cheers,
Shmuel
 
S said:
Thank for your response,
What I want to do is the following: store in the database .rtf text then
paste it into a word doc with the important formatting!, if I will use the
standard method that you are using then the formating will be lost, that
is why I probably need to use the Clipboard that doesn't forget the
formatting (I can get it to the clipboard by reading from the database
into RichText control).

Well, to say it most clearly: I think this is nonsense. I'm no expert on
Word automation, but I'm absolutely sure there is a way to control the
formatting of text, probably also of the RTF content you have. But whether
this is true or not, misusing the clipboard to perform the task is just
not an option I would consider.

I've been having a quick look and the only method to get the RTF text into
Word without using the clipboard seems to be inserting it from a file. Why
don't you do that from your app? I'm not saying there might not be a "more
direct" way available, but it's certainly an option to create a temporary
file with your RTF content and call Document.Content.InsertFile to get the
content into the Word document.


Oliver Sturm
 
Thanks again, however the option of inserting a file is not the best because
it is time consuming and tie is critical in this case.

Shmuel
 
Back
Top