How do I format the value of a field programmatically?

F

funeeldy

I need to satisfy a picky boss. He wants my revision history field(custom
docproperty) to look like this:
/main/2 15-August-2006 user

Fixed typo in the first word in the third section that misled

people to think that I discovered cold fusion technology.

/main/1 12-August-2006 user

Initial revision

How do I set a value that contains new line chars? I have tried ^l, ^p etc,
and they just show up as text in my doc.
 
D

Doug Robbins - Word MVP

I am not really sure what you are doing, but in vba to insert a new
paragraph, use vbCr

--
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
 
F

funeeldy

Doug;
When I run my perl script, it adds the new text to the docproperty, but I
get no line feeds. Here is the resulting text. Each new line should start
with main\version num. I just don't know what character I need to use to
tell word to put the text on a new line. ^l, ^p and \n do not work.

main\13 14-September-2006 mcote another checkin
commentmain\12 14-September-2006 mcote^p another checkin comment which
has more than 1 line in it^pmain\11 14-September-2006 mcote^p my first
comment line
 
D

Doug Robbins - Word MVP

Sorry, I don't know anything about perl.

--
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
 
J

Jean-Guy Marcil

funeeldy was telling us:
funeeldy nous racontait que :
Doug;
When I run my perl script, it adds the new text to the docproperty,
but I get no line feeds. Here is the resulting text. Each new line
should start with main\version num. I just don't know what character
I need to use to tell word to put the text on a new line. ^l, ^p and
\n do not work.

main\13 14-September-2006 mcote another checkin
commentmain\12 14-September-2006 mcote^p another checkin comment which
has more than 1 line in it^pmain\11 14-September-2006 mcote^p my first
comment line

Don't know about perl (This is a vba group!), but this may be useful.
Normally, in vba, you would use something like this:

ActiveDocument.CustomDocumentProperties("Test").Value = "Real new Text"
& vbCrLf & "New line"
or
ActiveDocument.CustomDocumentProperties("Test").Value = "Real new Text"
& Chr(13) & "New line"

This will create a document property value that includes a paragraph mark
(¶).
What is the equivalent of Chr(13) in perl? Can you use Unicode in perl?

This may be a question for a perl NG...

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

funeeldy

Thanks for all the help. I finally tried \r and it now puts the paragraph
mark in the word doc. Someone who programs in TCL helped me.
 

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