Special characters appearing in form Fields in Word

C

Collin

We Have an EJB Application which gets Data from the Database which is
containts the Follwoing format ELEMENTNAME=DATA^ELEMENT... , The
Element name Represent the BOOKMARK name for the the Form Fields,. The
data retrieved By the EJB Application is Processed by a COM Object
which opens a Handle to the Template which contains the FORM FIELDS
Defined with the Bookmarks. Most of the Element Data gets populated
Correctly to the FIELDS. We are having some problemd with setting the
Data to a form field which contains line breaks. When the Document is
generated and Opened, In the Form Field which the Multiple Line Data
was Set , we can see some box ( special Character ) appearing before
the start of the next line. I have tried to check the String which
has the Line Breaks. The Line Break characterrs in the string are
\r\n. I have verified this , by displaying character by character as a
byte as well. and also opening the string in a binary editor.

Just to add to it, we use _com_util::convertBSTRToString( ) in the COM
Object for formatting the string before it is set on the Field.

In Some Cases the Paragraphs work fine with no special character. this
happens only certain time. To verify if the line were any different, i
also checked the paragraph which works fine to check for anything
different. all i found was a \r\n


Let me know if any one has encountered such an issue. Is this issue
related to word or related to the way COM object formats the string.

Thanks

Collin
 
C

Cindy M -WordMVP-

Hi Collin,

\r\n means nothing to me. What ANSI codes do these represent? Generally,
Word prefers Chr$(13) (vbCR in VB-speak) and Chr$(10) (line feeds) can
cause problems.

Another factor you have to watch out for is form fields in table cells.
If the table cell does not contain a paragraph mark, itself, this can
result in paragraphs inserted using VBA to display boxes.
We Have an EJB Application which gets Data from the Database which is
containts the Follwoing format ELEMENTNAME=DATA^ELEMENT... , The
Element name Represent the BOOKMARK name for the the Form Fields,. The
data retrieved By the EJB Application is Processed by a COM Object
which opens a Handle to the Template which contains the FORM FIELDS
Defined with the Bookmarks. Most of the Element Data gets populated
Correctly to the FIELDS. We are having some problemd with setting the
Data to a form field which contains line breaks. When the Document is
generated and Opened, In the Form Field which the Multiple Line Data
was Set , we can see some box ( special Character ) appearing before
the start of the next line. I have tried to check the String which
has the Line Breaks. The Line Break characterrs in the string are
\r\n. I have verified this , by displaying character by character as a
byte as well. and also opening the string in a binary editor.

Just to add to it, we use _com_util::convertBSTRToString( ) in the COM
Object for formatting the string before it is set on the Field.

In Some Cases the Paragraphs work fine with no special character. this
happens only certain time. To verify if the line were any different, i
also checked the paragraph which works fine to check for anything
different. all i found was a \r\n


Let me know if any one has encountered such an issue. Is this issue
related to word or related to the way COM object formats the string.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

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