replace text that keeps the issue of style

I am trying to replace text in a textframe and maintain the style applied to the text that I replace. For example, I want to replace:

< text1 >

< Text2 >

with

This text is bold

This text is italic

The code I use is just a simple javascript regex to replace text:

var myContents = new String(myPageItem.parentStory.contents);


var re1 = new RegExp("<copy1>","gi");
myContents = myContents.replace(re1,"this text is bold");


var re2 = new RegExp("<copy2>","gi");
myContents = myContents.replace(re2,"this text is italic");


myPageItem.contents = myContents;

However, after running the above code, I get:

this tex t is "BOLD"

This text is italic

It seems that only seven characters (which incidentally in < copy1 > also has seven characters) Gets the first style and the rest of the text after the 7 characters Gets the second style. ANY help would be greatly appreciated!

Thanks in advance.

Play with the material is delicate, because this change just the characters 'in' the text - it has no effect on the formatting.

See http://forums.adobe.com/thread/791512?tstart=0

Tags: InDesign

Similar Questions

  • Data from Web service to a Web service that keeps the Session control

    Following the example set by Rama cricket in [maintaining Session with JAX - WS | http://weblogs.java.net/blog/ramapulavarthi/archive/2006/06/maintaining_ses.html]; I could create a WebService that keeps the sessions using JAX - WS.

    Now, I want to use this WebService, from control data in an ADF application, but unfortunately, I do not know how to tell from this data control that I want to maintain the session.

    I don't know if I should extend and overwrite the FactoryClass (oracle.adf.model.adapter.DataControlFactoryImpl) or if I have to do with the application definition (oracle.adfinternal.model.adapter.webservice.WSDefinition)

    I'm new to ADF and I understand that it can be simple, I just need an example or documentation to read.

    Thank you

    For the service, you can create a proxy of jax - ws and as mentioned in the document that you cited, activate the session on the client.
    This client class, you can then create a data bean control and use it in your ADF application.

    Vishal-

  • Remove frames of related texts that has the same content

    Hi Forum,

    I have this script, this will remove all the textFrame which contained © LW...

    There are several managers of related texts which contained © LW.

    I want to keep a block of text that has content © LW in it.and remove all others textFrame which contained © LW.

    myDoc var = app.activeDocument;

    var myPageItems = myDoc.allPageItems;

    for (var i = 0; i < myPageItems.length; i ++) {}

    App.Select (myPageItems [i]);

    mySel var = app.selection [0];

    var Cont = app.selection.contents;

    try {}

    mySel.locked = false;

    } catch (e) {};

    If (mySel.constructor.name == "TextFrame") {}

    If (mySel.contents == "© LW") {}

    try {}

    If (mySel.contents > 1) {}

    mySel.remove ();

    }

    } catch (e) {};

    }

    App.Selection = null;

    }

    }

    Thank you...

    myDoc var = app.activeDocument;

    ignore the var = true;

    var allFrames = myDoc.allPageItems;

    While (t = allFrames.pop ()) {}

    If (t instanceof TextFrame & t.contents == "© LW" & jumping == false) {}

    t.Locked = false;

    t.Remove ();

    }

    Else if (t instanceof TextFrame & t.contents == "© LW" & skip == true) {}

    jumping = false;

    }

    }

  • White text "BOLD" on the issues of color block?

    Hello world

    This may seem like a simple question, but I have problems creating a PDF document that contains the "BOLD" white text on colored blocks? Surprisingly, plain white text (normal text with paper as a character Style color) print on a block of dark color. But the problem occurs with the bold or bold italic (just character style "BOLD" thing). Really do anything "BOLD". Now, if I save it in jpeg format, then everything prints fine. My document is in mode overlay that lists problems related to the characters of the white text on colored blocks. By default, all white color have overprinting uncheck and grayed out. So, I'm unable to handle it.

    Any ideas on how I can get the white text "BOLD" (character Style) to print to a PDF file instead of create JPEGs of each document and then bring them together into a PDF file?

    Thanks for any help. Happy holidays.

    OK, so he put for overprinting in some way. It is VERY difficult to achieve in the ID, but it is easy to import the white text in Illustrator which is set to overprint. The only way that I know so he can get to text ID native, is however effects or blending modes, self check the effects Panel...

  • keep the issue of options

    upload to adobe.jpgHello indesigners.

    Im trying to understand the options of Dungeon, but not with much luck.ive make a document with 2 spreads and text 2 columns.

    and im trying to see what the keep options can do with selected paragraphs, marked in red, making the text frames must be linked in a way for the

    keep the options to be taken into account?

    Of course. The text does not keep with next lines of text. If there are no more lines of text, it will and stays there.

    If you bind the text blocks or use a frame 2 column, then set them keep Options should motivate more.

  • How to fix the runtime error that keeps the appearance?

    Whenever I get on a website like Facebook or a gambling site it is said there is a runtime error and it will stop. I have to keep revisiting the sites. It is also said that there is a mistake in line___

    try to uninstall and reinstall IE8. but before you do, try to install another browser as backup...
    I hope this helps... Good luck!
  • How can desktop icon font color - I change the font color of the text that describes the desktop icons?

    I am running Windows 7 Ultimate 32 bit. How can I change the color of the font describing the desktop icons?

    I am running Windows 7 Ultimate 32 bit. How can I change the color of the font describing the desktop icons?

    Hello

    You cannot change the font color of desktop.

    Because desktop wallpaper images have different colors, it is easy for the colors of unreadable fonts if they are on top of the same color in a background image to display. For example, a black font on top a dark part of the background image or a white font on a white part of a background image.

    The desktop icon fonts are dynamic and show white on dark background and change in white with a shadow effect black on a light background.

    I hope this helps.

    Thank you for using Windows 7

    Ronnie Vernon MVP

  • When I move my cursor on the screen, it will highlight all of the text that affects the cursor. It also happens when I read my email. I don't hold down any other key touhing anything else.

    I use Windows 7 and office.  MY email account is through yahoo att.net

    Could be a hardware problem with your mouse or touchpad.

    If you are using a mouse, have you tried to plug in a different mouse?

    If you use a Tablet, have you tried to use a mouse?

  • The icons that accompany the text in the box of bookmarks disappeared. Its got on my two computers. How can we get these icons.

    The icons that accompany the text that indicates the name of the site in the drop-down list of Firefox bookmarks are missing.
    How to make a comeback?

    Hi larremag,

    You should take a look at this article which deals with the problems with the latest version of Firefox. There is some information there about the problem you are experiencing. It should provide all the steps you need.

    Hope this helps!

  • How can I add a text field for the main menu?

    I have a project with a menu.  He has a title.  I wanted to add an additional track on the menu, what I had done in an earlier draft.  I would have thought he would have intuitively obvious, as highlighting the existing title I and do a copy and paste.  However, I learned that nothing is intuitive with Premiere elements 12.  Can someone tell me how to get a 2nd title on my main menu?  I have done it before, but apparently did not write it and I was faced with that I falsely assumed would take me 30 seconds to accomplish.  Thank you.

    Rick

    Do you really need a second title for the page in the main menu and the selection of scene or you page fixed for your Adobe title in more than one line?

    I wonder

    I wanted to add an additional track on the menu, what I had done in an earlier draft.

    Is it possible that as soon as you use a theme which came with 'subtitle', as the trip/Beach Resort, not all do.

    Workaround for the title with more than one line of text can backfire on you. But you can try. Excerpt from my first items 13 on this blog

    0019 first Elements 13 movie Menu title question: multiple lines of text


    A first elements 13/13.1 user reports that, if it creates a 3 lines of title text for the main menu of the fake big screen theme in the customization area of Movie Maker project, these 3 lines of text eventually "encoded" in the project of reopening after that that there had been closed.

    We have confirmed this report and extended it to include this problem appears for 13 of Menus other than the fake Widescreen cinema. This issue is not seen in first items 12/12.1 and earlier versions.

    BEFORE REOPENING THE CLOSE SAVE

    Figure 1. Main menu of Spring Flower home with 3 lines of text, as seen before the closure of the Reopen

    AFTER THE REOPENED NARROW SAVE


    Figure 2. Spring Flower main Menu title initially with 3 lines of text, as seen from the closure of the Reopen



    The only way found so far to get the final product to have 3 lines of title text for menus in the final product is to customize the theme to the movie Menu in the customization of the Menu movie of the project area, do not save, close the project at this time and can do the burn to.


    Many variables were examined to explain this behavior. So far, no answer for why.

    If you are determined to use a particular theme that comes with the title menu and subtitle, look at the text of the Palette layers layers in the editing menu .psd file (.psd Editor could be Photoshop CS or higher).

    Regarding

    on my project last year that was the menu that I liked with 2 text fields, I have also got rid of the "arrow" shortly before the text that was the menu key.  Anyone know how I do that?  I can't figure that out now.

    Could you be more specific. But, for now, consider... If you Play All text, you double-click to open the text of the amendment, the deleted text, click OK. Play All disappeared. Sometimes, in page and removal of text "main menu" scene selection to the navigation button... double click on the button to open the changes to the text, delete text, press ENTER, and then bar spacing, and click OK.

    Please let us know if everything above the target you wanted to know.

    Thank you.

    RTA

  • How to display text copied in the right order?

    I have a PDF document with text created from a Photoshop file.

    There are several layers of text in this Photoshop document.

    Problem:

    When I do 'select all of the text' in Acrobat and then "copy" and then paste them into a text editor text is pasted into the mess.

    It's a bit predictable because of the several layers of text in the original Photoshop file.

    Question:

    How can I find out the desired order of the text layers Photoshop when you create the PDF file?

    The layers are stacked in the correct order in the Panel layer in Photoshop. I was hoping that's the issue, but it is not. Is there another way in which I can specify the order of text?

    Your help will be very appreciated!

    It seems to work in reverse somewhat as a first In, First Out model. The best thing to do at this point is to open the navigation of content in Acrobat format Panel, locate objects and move them in the right order.

  • [FM11] Print the link to the Image and the markers of Index with the specific character Style

    Hello

    I'm new with scripts for Framemaker. I want to export FM docs to RTF, so I can import into InDesign. For placed images I want to insert a line of text that shows the link to the image (reference). In addition, I want to show the Index markers at the insertion location of brand with a different character Style. Can someone help me with this?

    Best regards, Sjoerd

    Sjoerd Hello,

    A note on your method to retrieve all related graphics: this will also deal with graphics that could be linked in master pages and reference. Just to be safe against unwanted side effects, you should limit your list of charts to those in the main flow of your document.

    On the tLoc: looking for really the cornerstone of the anchored frame that contains the chart. It's a little confusing that FM called the anchored frame and any graph of the same name. Even if you add a framework anchored in the text to an equation or a text box in your document, the anchored frame will appear in the list of the chart in the document. If you have a framework anchored containing an imported graphic file, you have a list of graphic objects inside the anchored frame, who himself appears in the list of graphical objects in the document.

    This function should do what you want to do:

    function ListGraphics (doc)

    {

    var had is doc. FirstGraphicInDoc;

    While (had. {ObjectValid()})

    If (aframe.constructor.name == "Eu") {}

    image = had. FirstGraphicInFrame;

    If (graphic.type is Constants.FO_Inset)

    doc. AddText (had. TextLoc, graphic. InsetFile);

    }

    had had =. NextGraphicInDoc;

    }

    }

    I suppose you also want to remove the anchored frames (imported image files) the text. This can be done in the same routine, but you first have to catch the next element in the linked list graphics in the doc before deleting the current. If you do not delete the first and end up with an object not valid. The method simpler and more secure to do is to create an array of items to delete. After the while loop, you delete these objects. Get the complete code looks like this:

    function ListGraphics (doc)

    {

    var toDelete = [];

    var had is doc. FirstGraphicInDoc;

    While (had. {ObjectValid()})

    If (aframe.constructor.name == "Eu") {}

    image = had. FirstGraphicInFrame;

    If (graphic.type == Constants.FO_Inset) {}

    doc. AddText (had. TextLoc, graphic. InsetFile);

    toDelete.push (had);

    }

    }

    had had =. NextGraphicInDoc;

    }

    for (i = 0; i< todelete.length;="" i++="" )="">

    toDelete [i]. Delete();

    }

    }

    This works on a small test file created. If you are in need of more support, do not hesitate to contact me: jang to jang dot nl

  • Add the waveform, keep the timestamp

    I'm reading of a module of 500 Hz USB data acquisition. To achieve this within the period of the loop, I need to acquire several samples per loop. Once I have these samples (waveform output), is it possible to add the waveform that keeps the timestamps?

    I am currently using the 'time to get picture', and then insert the data into a the same shift register. I would like to re - insert the data in the rest of the waveform added to simplify the writing of information that much easier. If this does not work, I'll probably just to do a string 2D array to write the data.

    Thank you!


  • Programs that overlap the taskbar in Vista

    Whenever I have to use a program such as firefox or photoshop, any program at all, and it is a maximized, it covers my taskbar. I can't access my taskbar until I'm close or minimize all programs. I got on the scale of my programs so that they fit without covering the taskbar, but it would be inaccurate and messy.
    Is there a way to solve this problem, so that the taskbar is always visible, and programs, when maximized, do not cover it?

    Right click on a space empty of the taskbar.  Click Properties and make sure that "Keep the taskbar above other windows" is checked.  Click on apply and OK

  • How fix us a cursor that keeps jumping while SMS.

    My laptop with windows 7 home, are problems with the cursor jumping around while SMS, what to do?

    Most of the time when I met users and myself to this question, it tends to be that we were accidentally mouse pad contact area of the notebook causing the cursor to move. Try typing carefully kept your palms/inches clear of this mousepad and see if that helps the issue. If you need you can disable the mouse pad in the Device Manager and use an external mouse, if it proves to be too uncomfortable...

    Disabling a device: http://msdn.microsoft.com/en-us/library/cc758424 (WS.10) .aspx

Maybe you are looking for