469,623 Members | 1,800 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

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 3041

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 devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.