> Hi =?Utf-8?B?dGFydGFuY2xp?=,
>
> > The replacement text doesn't come from another Word
> > document. It is dynamically generated and depends upon the original text and
> > some data taken from persistent store. What i really want to do is to
> > maintain the original formatting for the replacement text.
> >
> Can you be any more specific about this? Maybe a couple of examples (use <markup> to
> indicate formatting in both original and alternate)?
>
> There's not going to be any "simple" way to do this that matches the example you
> show. If we have some details, we may be able to suggest some alternate approaches.
> You should also tell us which version of Word is involved as that can affect the
> possibilities available to you.
>
> Further: should this be available in "any and every" document, or just certain types
> of document?
>
> > > > I have a C# Word add-in where I want to replace the text of each paragraph
> > > > with alternate text. I achieve this as follows:
> > > >
> > > > foreach paragraph in the document
> > > > r = p.Range;
> > > > text = r.Text;
> > > > alternateText = getAltText(text)
> > > > r.Text = alternateText
> > > >
> > > > This works fine for replacing the text. However I do lose formatting
> > > > information (e.g. where one word in the paragraph is italisised or where a
> > > > hypertext link is included). Is there another way to do what I want without
> > > > losing formatting?
> > > >
> > > Formatting within a paragraph is at the character level. Plus, the Text
> > > property deals only with text, no formatting.
> > >
> > > Assuming the alternateText is being picked up from a Word document, and
> > > contains the required formatting, then you can use r.FormattedText =
> > > otherr.FormattedText (in this case getAltText should return a range).
> > >
> > > That's about all one can say without knowing where the alternate text is coming
> > > from, or what kind of formatting is involved.
> >
>
> 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 :-)
>
>