472,145 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

How can I clear the Clipboard buffer after a reading a Word document?

jen
this works fine it i operate on one .doc file; however, if i process
multiple files, i get the following error: Requested Clipboard
operation did not succeed.

i suspect i need to clear my clipboard at some point, er something. in
the code below see the comment, as far as clearing the data object...

i appreciate any input....thanks to all

--
jen

-Major code snippage <-
while (FileListEnumerator.MoveNext())
{

lbFilesProcessed.Items.Add(FileListEnumerator.Key. ToString());

Word.Application app = new Word.ApplicationClass();
object nullobj = System.Reflection.Missing.Value;

object file = FileListEnumerator.Key.ToString();
Word.Document doc = app.Documents.Open(
ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj, ref nullobj);

doc.ActiveWindow.Selection.WholeStory();

doc.ActiveWindow.Selection.Copy();

IDataObject data = Clipboard.GetDataObject();

lbResults.Items.Add(data.GetData(DataFormats.Text) .ToString());
//maybe clear the data object here?

doc.Close(ref nullobj, ref nullobj, ref nullobj);
app.Quit(ref nullobj, ref nullobj, ref nullobj);

}
-Major code snippage <-

Oct 5 '06 #1
0 3118

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Risto Heinonen | last post: by
6 posts views Thread by S Shulman | last post: by
2 posts views Thread by zbcong | last post: by
15 posts views Thread by Peter Duniho | last post: by
331 posts views Thread by Xah Lee | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.