Empty properties shows property name when printing

K

kjetil.stolen

I am working with Microsoft Word 2007.

I insert Document Properties into the document (Insert -> Quick Parts -
Document Property). When a property is empty, the name of the
property will show in the document. If you click on the property name
you can enter some information into the property. This is a nice
feature.

The problem occures if you want to print the document. If a property
is empty the property name will be printed, when the logical would be
a empty field.

In a normal document I would be able to enter a space into each empty
field before I print it, but the problem I'm facing is that this
document gets these properties from Sharepoint and then a space in a
field will be converted to an empty field each time I save the
document.

Is is possible in some way to prevent empty properties fields to be
printed?

Regards,

Kjetil Stolen
 
C

Cindy M.

I am working with Microsoft Word 2007.
I insert Document Properties into the document (Insert -> Quick Parts -
property will show in the document. If you click on the property name
you can enter some information into the property. This is a nice
feature.

The problem occures if you want to print the document. If a property
is empty the property name will be printed, when the logical would be
a empty field.

In a normal document I would be able to enter a space into each empty
field before I print it, but the problem I'm facing is that this
document gets these properties from Sharepoint and then a space in a
field will be converted to an empty field each time I save the
document.

Is is possible in some way to prevent empty properties fields to be
printed?
These "property fields" are actually content controls. And for built-in
document properties they're linked to XML in the document (or perhaps on
Sharepoint). Certain parts of the fields can be managed via the Developer
Tab, Controls group.

The Placeholder text, however, can only be accessed using the object
model (a macro). The following line of code will set the placeholder text
for the first Content control in the document, for example:

ActiveDocument.ContentControls(1).PlaceholderText = ""

This bit of sample code will loop through all content controls in the
document and compare the content with the placeholder text. If there's a
match, both are removed.

Sub ReplaceCCPlaceholder()
Dim cc As Word.ContentControl

For Each cc In ActiveDocument.ContentControls
If cc.Range.Text = cc.PlaceholderText Then
cc.PlaceholderText = ""
cc.Range.Text = ""
End If
Next

End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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