You understood exactly what I am doing, and That's exactly what I need I tried that many ways, but couldn't manage to figure out how to do that. I hope I am not bothering too much, but would you mind showing me an example ??? Thanks a lot Alexandre Amato On 04/06/2010, at 16:44, Brendan Murphy wrote: > First you need to do some time measurement of the various segments > of code so you can see the relative time that is consumed in the > search and replace operation. > > It looks like you are extracting the XMl, doing the replace, and > then reinserting the XML. There is a lot of overhead associated > with that algorithm and some risk in corrupting the xml. What I > think you want to do is walk through the internal paragraphs in > the FTC checking each style run for the target text and the > replacing the text in each style run. Note, you need to account > for replacements that span multiple style runs. > > Alexandre Amato wrote: >> Hi Brendan, >> >> All my software is based on searching and replacing some variables. >> So I need to do that a lot, and it is very time consuming. >> >> >> my current code is: >> ... >> >> resultadoformatado = ReplaceAll(resultadoformatado, "asagoldman$", >> asaNUM2) >> resultadoformatado = ReplaceAll(resultadoformatado, "medico$", >> medico.Text) >> resultadoformatado = ReplaceAll(resultadoformatado, "goldman$", >> GoldmanNUM) >> resultadoformatado = ReplaceAll(resultadoformatado, "goldmanrisco >> $", GoldmanRisco) >> resultadoformatado = ReplaceAll(resultadoformatado, "nome$", >> nome.Text) >> >> ... >> >> where resultadoformatado is a string that holds all the text and >> images; and after all the replacing: >> >> ... >> >> Dim sr as FTStyleRun >> Dim p as FTParagraph >> ' Create the paragraph. >> p = ResultadoF.getDoc.addNewParagraph >> ' Create a style run. >> sr = new FTStyleRun(ResultadoF) >> ' Add the text to the style run. >> ResultadoF.getDoc.setXML (resultadoformatado) >> ResultadoF.update(true, true) > > FTC Website: http://www.truenorthsoftware.com/formattedtextcontrol > Set List Options (digest and vacation modes): www.freelists.org/list/ftcdev > List Archive: www.freelists.org/archives/ftcdev > Unsubscribe: Send email to ftcdev-request@xxxxxxxxxxxxx with "unsubscribe" in > the subject field. > > > FTC Website: http://www.truenorthsoftware.com/formattedtextcontrol Set List Options (digest and vacation modes): www.freelists.org/list/ftcdev List Archive: www.freelists.org/archives/ftcdev Unsubscribe: Send email to ftcdev-request@xxxxxxxxxxxxx with "unsubscribe" in the subject field.