Custom feature similar to bookmark\fields

A

Andrew

Hello,

I need to find a way, a feature to assign text in document to a metadata.
For example, I need a similar feature to bookmarks but I don't need to
interfere with standard Word features. I need something new in order not to
interfere to whatever the user already uses in a document (If I were to use
bookmarks, a user can modify by mistake the bookmark).
I need a bookmark or a field like feature:
- on a selected text, user pushes a button from my plugin
- the selected text is associated with the metadata (metadata is just an
integer value)
- the user needs to be able to visually see somehow that the text is
associated with the metadata. for example, bookmarks have square brackets. I
would like to put a line under the whole associated text.
- the visual cues must not appear when they are printed
- similar to bookmarks\fields, if you insert text in the text which is
already associated with metadata, the range of associated characters expands
(you can see how the end bookmark is kept to the same character)

I hope I succeeded to explain what I need.

Do you think it's possible to do that ? I am not an expert on Word
extensibility so I need an advice.

Thank you.
 
H

Helmut Weber

Hi Andrew,

maybe assigning a custom color to some text would help.
It is just a trick, hoping that the color of "some text"
can be modified without spoiling otherwise colored text.

I was thinking of:

Sub Macro1()
With selection.Font
.Color = RGB(0, 0, 1)
End With
End Sub

which makes practically no difference to text in ordinary black.

In can be found in that way:

Sub findcolor()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Font.Color = RGB(0, 0, 1)
While .Execute
rDcm.Select
Stop
Wend
End With
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
A

Andrew

Hello Helmut,

I need to keep the metadata associated with the text somehow.
Also, like I explained with bookmarks, if you have a text "ABCDE" which is
bookmarked and you enter a char in the middle, "ABCXDE" the bookmark still
begins from A and ends with E.
Can I catch events in char typing and figure out if there are characters
added\inserted in the range which I know it's associated with metadata ?

Color is not an option as I don't want to change the color of the text.
I need some other way to mark the text.
 
D

Doug Robbins - Word MVP on news.microsoft.com

How about setting the Display of Field Shading so that it is alwasy on and
then use the following code the mark the text

ActiveDocument.Fields.Add Selection.Range, wdFieldEmpty, "Quote " & Chr(34)
& Selection.Range.Text & Chr(34)


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
A

Andrew

Hello Doug,
Thanks for your idea but it's not what I am looking for.
I had the same idea but it's not what I need. Comments are even better than
fields.
Is there a way to create (by a plugin in C++ or C#) a new type of Bookmarks
or Comments or Fields, from the perspective of what I want ?
Like I said, I would like to be able to mark text in some proprietary way
(maybe drawing a rectangle around the text) but without the standard tools
(Bookmark, Comments, Fields) and without being able to remove the mark using
standard tools (for example borders are not an option since can be removed
by accident by the user).
Does Word offer the power to add custom rendering like I need ?
At least give me some directions. I am still searching the MSDN for
something.

Thanks.
 
D

Doug Robbins - Word MVP on news.microsoft.com

I admit that I do not really understand what you want, nor do I know how to
do anything in C++ of C#

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
S

Scott McPhillips [MVP]

For a somewhat similar requirement I used "content controls" to contain each
text section, and used a background color ("shading") to provide a visual
indication of state. Content controls are available only in Word 2007. It
is possible for a user to defeat/remove them, but only through the
normally-hidden Developer tab. Not a perfect solution, but the best I could
find. The entire Word object model is available to you in a C++ or C# COM
add-in, but for the most part you have to limp along with the VB
documentation on the Word API.
 

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