469,953 Members | 2,403 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,953 developers. It's quick & easy.

Clipboard Related Question

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
Sep 15 '05 #1
6 1490
S Shulman wrote:
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.
True. You shouldn't use the clipboard as a means to send data from one
part of your application to another. It points at structural problems in
your app, and it's really annoying if the user uses an external clipboard
history program (like I do, ClipMate) and the clipboard is reset with new
content all the time.
Is there any way to solve this problem, I have noticed that some
application have more than 1 clipboard are these also system clipboard


I'm not quite sure about that. In fact, Office has such functionality and
I don't know exactly where it comes from - there might be an API
somewhere. But remember: the clipboard is a device that the user controls.
As a user, I want to decide what goes on my clipboard, whether there's
only one or multiple of them.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Sep 16 '05 #2
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
"Oliver Sturm" <ol****@sturmnet.org> wrote in message
news:xn***************@msnews.microsoft.com...
S Shulman wrote:
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.


True. You shouldn't use the clipboard as a means to send data from one
part of your application to another. It points at structural problems in
your app, and it's really annoying if the user uses an external clipboard
history program (like I do, ClipMate) and the clipboard is reset with new
content all the time.
Is there any way to solve this problem, I have noticed that some
application have more than 1 clipboard are these also system clipboard


I'm not quite sure about that. In fact, Office has such functionality and
I don't know exactly where it comes from - there might be an API
somewhere. But remember: the clipboard is a device that the user controls.
As a user, I want to decide what goes on my clipboard, whether there's
only one or multiple of them.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Sep 17 '05 #3
S Shulman wrote:
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/20...FromDotNet.asp

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

Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Sep 18 '05 #4
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
"Oliver Sturm" <ol****@sturmnet.org> wrote in message
news:xn****************@msnews.microsoft.com...
S Shulman wrote:
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/20...FromDotNet.asp

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

Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Sep 18 '05 #5
S Shulman wrote:
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
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Sep 18 '05 #6
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

"Oliver Sturm" <ol****@sturmnet.org> wrote in message
news:xn****************@msnews.microsoft.com...
S Shulman wrote:
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
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Sep 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nithi Gurusamy | last post: by
2 posts views Thread by Roy Gunnarsson | last post: by
6 posts views Thread by S Shulman | last post: by
3 posts views Thread by Jaez | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.