how to determine if Clipboard contains bullets and numbering?

S

saint

hi,

im overriding the EditPaste command and would like to determine whether the
Clipboard contains bullets and numbering before pasting. (or if not the
Clipboard any way i could determine whether the text i am about to paste
contains bullets and numbering. i need the info to decide on how i will paste
or make changes to the document before pasting (ie. if text contains bullet,
i will bypass the paste). is there a way do that?

im actually working with VSTO C# but hoping i could get some ideas since
from vba.

would appreciate any comment. tnx in advance.
 
J

Jean-Guy Marcil

saint was telling us:
saint nous racontait que :
hi,

im overriding the EditPaste command and would like to determine
whether the Clipboard contains bullets and numbering before pasting.
(or if not the Clipboard any way i could determine whether the text i
am about to paste contains bullets and numbering. i need the info to
decide on how i will paste or make changes to the document before
pasting (ie. if text contains bullet, i will bypass the paste). is
there a way do that?

im actually working with VSTO C# but hoping i could get some ideas
since from vba.

would appreciate any comment. tnx in advance.

I do not think that you can read the clipboard content to get that kind of
detailed information. I know you can get the type of information in the
clipboard (Text, Image, etc.), but not details about the text itself.

You could paste the text to a dummy temporary document (invisible if you are
dealing with XP and higher) and then check the content of the range to see
if it has bullet/numbers by using ".Range.ListFormat.ListType"


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

saint

Thank you for the suggestion.

I got the text from the clipboard using different formats and when i used
HTML format in retrieving the content, i examined the resulting html text for
something unique when there are bullets and numbers and came up with these.

string marker = "/* List Definitions */";
if(Clipboard.GetText(TextDataFormat.Html).Contains(marker))
{ // process

it looks like a dirty solution but could live with it for the moment. Will
try the paste into a temp document approach though since it looks more
reliable than depending on whether there is occurence of "List Definitions"
when retrieving HTML format from clipboard.

Thanks for the idea, it helped a lot.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top