Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
M O J O M O J O is offline
external usenet poster
 
Posts: 4
Default Search and replace my custom tags in WordML??

Hi,

I need to open a wordml document and search/replace some custom tags.

The problem is, that when I open a wordml doc, the tags are messed up.

My text look likes this "Dear @customername@, ....", but when I open the
wordml doc, it can look like this....

w:rPrDear w:b/@/w:rPrw:tcustomername/w:t@/w:r
or
w:rPrDear w:b//w:rPr@w:tcustomername@/w:t/w:r
etc.

I want to keep the @ and unsername together like this...

w:rPrDear w:b//w:rPrw:t@customername@/w:t/w:r

Is that possible???

Thanks!

Mojo


  #2   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
Cindy M -WordMVP- Cindy M  -WordMVP- is offline
external usenet poster
 
Posts: 370
Default Search and replace my custom tags in WordML??

Hi M,

I need to open a wordml document and search/replace some custom tags.

The problem is, that when I open a wordml doc, the tags are messed up.

My text look likes this "Dear @customername@, ....", but when I open the
wordml doc, it can look like this....

w:rPrDear w:b/@/w:rPrw:tcustomername/w:t@/w:r
or
w:rPrDear w:b//w:rPr@w:tcustomername@/w:t/w:r
etc.

I want to keep the @ and unsername together like this...

w:rPrDear w:b//w:rPrw:t@customername@/w:t/w:r

Is that possible???

I very much doubt that the WordML you're getting when you save a Word 2003
document looks like the samples you're showing us above. "Dear " would
certainly have to be within w:t tags; the @ as well. I'm guessing that
you may be formatting the customername characters differently than the
surrounding @? That would break up the text run...

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 :-)

  #3   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
M O J O M O J O is offline
external usenet poster
 
Posts: 4
Default Search and replace my custom tags in WordML??

Hi Cindy,

My point was just to show that the '@' signs wasn't always together with
the customername. )

Let's say I want to load the xml file into Notepad and do a search and
replace (I don't want to use word to do the search and replace ... it
will be done on a computer that does not have word installed).

How can I make my own "tags" that will not be messed up by wordml-tags?

I want my user to create a word doc, type in text and add variables like
@customername@. Then my own .net application must open the xml file and
do a search and replace. Therefore the @customername@ must stick together.

Hope you understand what I mean.

This is a BIG problem for me. (

Thanks!

Mojo


Cindy M -WordMVP- skrev:
Hi M,

I need to open a wordml document and search/replace some custom tags.

The problem is, that when I open a wordml doc, the tags are messed up.

My text look likes this "Dear @customername@, ....", but when I open the
wordml doc, it can look like this....

w:rPrDear w:b/@/w:rPrw:tcustomername/w:t@/w:r
or
w:rPrDear w:b//w:rPr@w:tcustomername@/w:t/w:r
etc.

I want to keep the @ and unsername together like this...

w:rPrDear w:b//w:rPrw:t@customername@/w:t/w:r

Is that possible???

I very much doubt that the WordML you're getting when you save a Word 2003
document looks like the samples you're showing us above. "Dear " would
certainly have to be within w:t tags; the @ as well. I'm guessing that
you may be formatting the customername characters differently than the
surrounding @? That would break up the text run...

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 :-)

  #4   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
Dr. Eckehard Pfeifer Dr. Eckehard Pfeifer is offline
external usenet poster
 
Posts: 1
Default Search and replace my custom tags in WordML??

Hi, I dont know, If I understand you correctly. Whats about your own
namespace concerning the parameters you signed as @parameter@? Like
param xmlns="myNamespace"value/param.

--
MfG EP
Entwicklung - Beratung - Training (www.dr-e-pfeifer.net)
(Microsoft Certified Application Developer)
neu: MS Office 2003 - Das Entwicklerbuch (ISBN 3-86063-688-X)

  #5   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
Cindy M -WordMVP- Cindy M  -WordMVP- is offline
external usenet poster
 
Posts: 370
Default Search and replace my custom tags in WordML??

Hi Mojo,

But you see, on my machine the @ signs aren't separated from the rest of the
text. Unless I format them differently or use Insert/Symbol. So it would be
important for you to show us EXACTLY what the problem is that you're
encountering - the WordML you're struggling with.

My point was just to show that the '@' signs wasn't always together with
the customername. )

Let's say I want to load the xml file into Notepad and do a search and
replace (I don't want to use word to do the search and replace ... it
will be done on a computer that does not have word installed).

How can I make my own "tags" that will not be messed up by wordml-tags?

I want my user to create a word doc, type in text and add variables like
@customername@. Then my own .net application must open the xml file and
do a search and replace. Therefore the @customername@ must stick together.

Hope you understand what I mean.

This is a BIG problem for me. (


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 :-)



  #6   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
M O J O M O J O is offline
external usenet poster
 
Posts: 4
Default Search and replace my custom tags in WordML??

Hi Cindy,

I want my user to write a "template" in word and save it as xml. This
template will later be used for our own mailmerge system.

Therefore if my users open a new document and enters the field
@customoername@, the wordml will look like this...

....ww:rw:t@customername@/w:t/w:r....

This is very easy to open the xml file in our .net-crm application and
do a search/replace on the variable @customername@.

But if the user wants to make it bold and by mistake forgets to
highlight the last @, the wordml will look like this...

w:rPrw:b//w:rPrw:t@customername/w:t/w:rw:rw:t@/w:t

Then I will not be able to from my .net-crm application to open the word
as a tectfile and do a search/replace on the @customername@, because
it's now called...

@customername/w:t/w:rw:rw:t@

I would like my users to be able to enter a fieldname like @customernam@
in word and no matter what formatting they do on the field, the
@customername@ must be intact.

Hope you get what I mean.

)

Thanks for still trying to help me out here!!

Mojo

Cindy M -WordMVP- skrev:
Hi Mojo,

But you see, on my machine the @ signs aren't separated from the rest of the
text. Unless I format them differently or use Insert/Symbol. So it would be
important for you to show us EXACTLY what the problem is that you're
encountering - the WordML you're struggling with.

My point was just to show that the '@' signs wasn't always together with
the customername. )

Let's say I want to load the xml file into Notepad and do a search and
replace (I don't want to use word to do the search and replace ... it
will be done on a computer that does not have word installed).

How can I make my own "tags" that will not be messed up by wordml-tags?

I want my user to create a word doc, type in text and add variables like
@customername@. Then my own .net application must open the xml file and
do a search and replace. Therefore the @customername@ must stick together.

Hope you understand what I mean.

This is a BIG problem for me. (


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 :-)

  #7   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Search and replace my custom tags in WordML??

I don't believe there is any way you can force Word to fix this at the point
when you save the document, unless you know how to write a transform that
could do it (I don't), particularly...

I would like my users to be able to enter a fieldname like @customernam@
in word and no matter what formatting they do on the field, the
@customername@ must be intact.


....when you want that much flexibility. What you're implying is that there
could be any number of formatting tags within the @customername@ "tag". Nor
is it going to be simple even to identify what is and what is not a tag,
partly because a character such as "@" is quite likely to be used in other
ways in a document (especially in e-mail addresses), and partly because the
user may accidentally omit an "@".

Personally I would consider two approaches to solving this:
a. either provide a macro that the user either invokes or is invoked
automatically when the document is closed, or can be run as a check after
closing, to go through the document looking for @tag@ tags, reporting on any
"solitary" "@" characters it can find, then applying (or more likely,
removing) consistent formatting, in a way that you have determined by
experiment leaves you with w:t@tag@/w:t
b. or postprocess the resulting XML, using any appropriate language, in a
three-stage process:
- make a copy of the XML and strip all XML tags so that the user-defined
@tag@ tags are reconstituted
- perform much the same checking for "solitary" "@" chaaracters as in (a)
and flag any stuff you cannot recognise
- if all is OK, reprocess the original XML by identifying the start and
end of @tag@ tags and successively swapping the positions of XML tags and
plain text until the @tag@ is reconsituted.

If (a) is feasible, it looks an awful lot simpler to me than (b). I also
suspect it might be a whole lot more reliable if you didn't use a common
character such as "@" as your tag marker, or doubled it up to @@. Personally
I like "¬" (who on earth uses that?), but that's primarily because it's
available on a UK keyboard. Of course th logical problem remains whatever
you use.

Peter Jamieson

"M O J O" wrote in message
...
Hi Cindy,

I want my user to write a "template" in word and save it as xml. This
template will later be used for our own mailmerge system.

Therefore if my users open a new document and enters the field
@customoername@, the wordml will look like this...

...ww:rw:t@customername@/w:t/w:r....

This is very easy to open the xml file in our .net-crm application and do
a search/replace on the variable @customername@.

But if the user wants to make it bold and by mistake forgets to highlight
the last @, the wordml will look like this...

w:rPrw:b//w:rPrw:t@customername/w:t/w:rw:rw:t@/w:t

Then I will not be able to from my .net-crm application to open the word
as a tectfile and do a search/replace on the @customername@, because it's
now called...

@customername/w:t/w:rw:rw:t@

I would like my users to be able to enter a fieldname like @customernam@
in word and no matter what formatting they do on the field, the
@customername@ must be intact.

Hope you get what I mean.

)

Thanks for still trying to help me out here!!

Mojo

Cindy M -WordMVP- skrev:
Hi Mojo, But you see, on my machine the @ signs aren't separated from the
rest of the text. Unless I format them differently or use Insert/Symbol.
So it would be important for you to show us EXACTLY what the problem is
that you're encountering - the WordML you're struggling with.
My point was just to show that the '@' signs wasn't always together with
the customername. )
Let's say I want to load the xml file into Notepad and do a search and
replace (I don't want to use word to do the search and replace ... it
will be done on a computer that does not have word installed).
How can I make my own "tags" that will not be messed up by wordml-tags?
I want my user to create a word doc, type in text and add variables
like @customername@. Then my own .net application must open the xml file
and do a search and replace. Therefore the @customername@ must stick
together.
Hope you understand what I mean.
This is a BIG problem for me. (


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 :-)



  #8   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
Cindy M -WordMVP- Cindy M  -WordMVP- is offline
external usenet poster
 
Posts: 370
Default Search and replace my custom tags in WordML??

Hi Mojo,

I get what you mean. And I agree with Peter's analysis.

The only additional thought I have is that it should be possible to use
XPath rather than a text search. XPath should let you extend what's picked
up until you hit the "end symbol", and to pick up only the t tag's
contents. As long as you're using XML, make the most of it and use the
tools that are available for working with it :-) XML wasn't designed to be
worked with in "text editor"...

I want my user to write a "template" in word and save it as xml. This
template will later be used for our own mailmerge system.

Therefore if my users open a new document and enters the field
@customoername@, the wordml will look like this...

....ww:rw:t@customername@/w:t/w:r....

This is very easy to open the xml file in our .net-crm application and
do a search/replace on the variable @customername@.

But if the user wants to make it bold and by mistake forgets to
highlight the last @, the wordml will look like this...

w:rPrw:b//w:rPrw:t@customername/w:t/w:rw:rw:t@/w:t

Then I will not be able to from my .net-crm application to open the word
as a tectfile and do a search/replace on the @customername@, because
it's now called...

@customername/w:t/w:rw:rw:t@

I would like my users to be able to enter a fieldname like @customernam@
in word and no matter what formatting they do on the field, the
@customername@ must be intact.

Hope you get what I mean.


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 :-)

  #9   Report Post  
Posted to microsoft.public.office.developer.automation,microsoft.public.word.mailmerge.fields,microsoft.public.office.xml
M O J O M O J O is offline
external usenet poster
 
Posts: 4
Default Search and replace my custom tags in WordML??

Hi Peter and Cindy,

Thank you both for the elaborating answers.

I will try to parse the file as an xml file.

Thanks again!!

Mojo

M O J O skrev:
Hi Cindy,

I want my user to write a "template" in word and save it as xml. This
template will later be used for our own mailmerge system.

Therefore if my users open a new document and enters the field
@customoername@, the wordml will look like this...

...ww:rw:t@customername@/w:t/w:r....

This is very easy to open the xml file in our .net-crm application and
do a search/replace on the variable @customername@.

But if the user wants to make it bold and by mistake forgets to
highlight the last @, the wordml will look like this...

w:rPrw:b//w:rPrw:t@customername/w:t/w:rw:rw:t@/w:t

Then I will not be able to from my .net-crm application to open the word
as a tectfile and do a search/replace on the @customername@, because
it's now called...

@customername/w:t/w:rw:rw:t@

I would like my users to be able to enter a fieldname like @customernam@
in word and no matter what formatting they do on the field, the
@customername@ must be intact.

Hope you get what I mean.

)

Thanks for still trying to help me out here!!

Mojo

Cindy M -WordMVP- skrev:
Hi Mojo,
But you see, on my machine the @ signs aren't separated from the rest
of the text. Unless I format them differently or use Insert/Symbol. So
it would be important for you to show us EXACTLY what the problem is
that you're encountering - the WordML you're struggling with.
My point was just to show that the '@' signs wasn't always together
with the customername. )

Let's say I want to load the xml file into Notepad and do a search
and replace (I don't want to use word to do the search and replace
... it will be done on a computer that does not have word installed).

How can I make my own "tags" that will not be messed up by wordml-tags?

I want my user to create a word doc, type in text and add variables
like @customername@. Then my own .net application must open the xml
file and do a search and replace. Therefore the @customername@ must
stick together.

Hope you understand what I mean.

This is a BIG problem for me. (


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 :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search and replace with a numbered reference a_nokes Microsoft Word Help 8 May 5th 06 03:41 AM
Pasting into a search and replace Ben K. Bullock New Users 6 March 6th 06 05:50 AM
Search and Replace not working if I select a Format for Heading St Sherrie Deen Microsoft Word Help 0 April 27th 05 08:53 PM
search and replace symbol characters Patricia G. Kurz Microsoft Word Help 1 December 29th 04 03:11 AM
search and replace symbols pattyjo Microsoft Word Help 2 December 29th 04 03:10 AM


All times are GMT +1. The time now is 06:21 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"