How to give Bold style inside Single Text Frame

Hi
I created a text frame with some text in it. It comes in three paragraphs. First para is the title with two words and below two are small description. All the text is kept in single textframe and I need that to be in single frame only. NOW, I need to bold the first para that is the title with two words. How can I write the code to give bold style to the first paragraph inside that frame? Do I need to take different frame? I want all in single actually. Also I want the entire text frame to give my customized text color.
Hoping a valuable suggestion
Thanks in advance.
Regards
P

Dave, Good questions(s)!!! Details below...
It's CS2. I need to put some text in all (many) documents I work regularly. Instead of copying from the previous file or any other source, as the text is same for all, I thought of writing the script with the text itself. Running that will create text frame and write the text. Got almost but was unable to bold the title of the text which I mentioned earlier as a first paragraph with two words.
Also I couldn't give the my color swatch to the text.
Here is my script:
var myTextFrame = app.activeWindow.activePage.textFrames.add()
var myParagraph = myTextFrame.paragraphs.item(0)
var myFont = app.fonts.item("Arial")
myTextFrame.geometricBounds = ["11.2in", "6in","9.57in","0.5in"];
myTextFrame.contents = "First Paragraph"
myTextFrame.parentStory.insertionPoints.item(-1).contents = "\r This is Second paragraph.";
myTextFrame.parentStory.insertionPoints.item(-2).contents = "\r\rHere comes the Third Paragraph with extra para space";
myParagraph.parentStory.appliedFont = myFont
myParagraph.parentStory.pointSize = 8
myParagraph.paragraphs.item(-1).spaceAfter = "0.05in"
myTextFrame.fit(FitOptions.frameToContent)
Hope this answers all your questions. Waiting for valuable solution. Have another question will ask after I got this. For now, two questions 1) making bold first two words 2) font color

Similar Messages

  • Apply different font styles in single text frame

    hi all
    how can i apply different font styles in a single text frame using indesign script ?
    for example :
    "dasdnasndasndlasndnasdlasdasdas"
    may i know is it possible to do that and how to do that ?
    thanks

    You can set (as well as read) every single property of any text range with scripts. This is javascript; it assumes you text cursor is inside a frame with some text.
    * Setting some specific characters to a color:
    app.selection[0].parentStory.characters.itemByRange(5,10).fillColor = "Red";
    * Change the font of words:
    app.selection[0].parentStory.words[3].appliedFont = "Arial\tBold";
    * .. or just the style:
    app.selection[0].parentStory.lines[2].fontStyle = "Italic";
    * .. or any other attribute (this one requires you to have at least 5 characters selected):
    app.selection[0].characters[5].underline = true;
    Of course these operations are not limited to something you select; they work the same with any text frames you can refer to.
    app.activeDocument.textFrames[1].paragraphs[2].appliedCharacterStyle = "charstyle";

  • Data merging: how to get multiple records in single text frame?

    Hi
    I'm experimenting with data merging in InDesign CS3. The biggest stumbling block I've come across is trying to get my records to flow as continuous text in a single text frame (which would, ideally, autoflow onto new pages in the document). The records vary considerably in length, and so I can't just create a standard text frame to repeat on the page.
    Perhaps data merging isn't the best way of doing this and I should be learning to script instead. I feel like I'm just one step away, though.
    Any suggestions would be appreciated.

    OK, new scenario now:
    Is it possible to set a text box to auto-resize to fit the content that comes in during the data merge?
    I have placed one of my data fields in a text box with a stroke and fill, and placed this as an anchored object in the main text box with the other fields. The problem is that the length of text in this field varies considerably, and I'd like the text to fit snugly within its box. Ideally this text box would not appear at all if the field is blank for a particular record.
    I hope I've explained all of that clearly enough. Any ideas?

  • How do I apply style within a text frame linked object

    I'm selecting the text frame in the object I want to apply an object style
    A script can be written
    within a text frame the linked object (selected text frame)
    how object style is applied

    Hi
    All you need is
    app.selection[0].appliedObjectStyle = app.activeDocument.objectStyles.itemByName ("Trevors Object Style");
    The below snippet will apply the style to all the anchored objects in the selection or document
    var doc = app.properties.activeDocument,
        myOnjectStyle = doc.objectStyles.itemByName ("Trevors Object Style"),
        myObjects, l;
    if (!myOnjectStyle.isValid) {
        alert ("Either add an Object Style Called:\nTrevors Object Style\nOr Make Significant Changes to The Script");
        quit ();
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "^a";
    myObjects = (app.selection && app.selection[0]).findText () || doc.findText ();
    l = myObjects.length;
    while(l--) myObjects[l].textFrames[0].appliedObjectStyle = myOnjectStyle;
    HTH
    Trevor

  • Scripting Selective XML into a Single Text Frame? (& Some Other Stuff...)

    Hi all, I could use some help (using version CS5.5).
    I want to import (via Javascript) an XML file similar to this:
    <movieRoot>
         <dvds>
              <movie>
                   <title>2001: A Space Odyssey</title>
                   <edition>Special Edition</edition>
                   <features>NOTHING</features>
                   <notes/>
              </movie>
              <movie>
                   <title>Airplane!</title>
                   <edition />
                   <features>Extra Laughs</features>
                   <notes/>
              </movie>
         </dvds>
    </movieRoot>
    I've been able to successfully do this, so no problem there.
    Then I want to dump the child elements under the XML element "<dvds>" into a single text frame that spans 2 columns per page. That's easy enough too, except:
    1) I want to filter the data so that empty elements or whose contents equal "NOTHING" do not appear.
    2) I want to add static text title above some of the elements that remain (outside the XML proper).
    3) Then I want to format the text (using Paragraph Styles).
    Tall order, I know, but I'm keen on figuring it out. I initially created a document using placeholders and used the standard XML Import to populate it with data, which was filtered using scripts to remove extraneous placeholders and static text. It gave me the result I wanted, but as the XML will be regularly updated and since the "filtered" tags result in non-standard XML entries, it means starting over from scratch after every XML update. So I turned to scripting...
    For point #1, I was able to filter properly using a recursive IF statement, tested here using message alerts:
    I've included a bunch of variables for (hopefully) easier viewing.
    var myXMLRoot = myDocument.xmlElements.item(0);  //movieRoot
    var myXMLParent = myXMLRoot.xmlElements.item(0);  //dvds
    var myXMLElement = myXMLParent.xmlElements.item(0);  //movie
    var currElement = myXMLElement.xmlElements.item(0);  //title
    for (i = 0; i < myXMLParent.xmlElements.length; i++)
        myXMLElement = myXMLParent.xmlElements.item(i);
        for (j = 0; j < myXMLElement.xmlElements.length; j++)
            currElement = myXMLElement.xmlElements.item(j);
            if (currElement.contents != "" && currElement.contents != "NOTHING")
                alert (currElement.markupTag.name + ": " + currElement.contents);
    It worked great until I tried to get it into an existing text frame. Since I want all the info in one text frame, placexml was out of the question, and markup worked but overwrote XML tags -- such as assigning the entire text frame to <movie/title> when I wanted it assigned to <dvds> with <movie/title> tags nested within it.
    If you can help me with anything, this is really where I need pointed in the right direction most. But if you're feeling generous or bored...
    Then for points #2 and #3, I want to take what's left ("filtered" XML data) and add additional text and formatting wherever certain tags are found.
    For example, applying the paragraph style "MovieTitles" for any text within <title></title> XML tags; or adding the phrase "Special Features" (with paragraph style "Headers") above any text marked with <features> tags, while the content within those <features> tags applies the paragraph style "NormalText."
    I've got some of this worked out in pieces already, but it generally falls apart because I can't get the tag structure correct in the text frame. I can provide more info as requested. Any help would be mighty appreciated!
    UPDATE: Surprisingly, I've actually had some good success this evening on solving most of these problems. I'll post my results once I've finished up just in case anyone else can be helped by what I've learned.
    One question remains for the moment: I've inserted text within an XML element, but outside of XML tags (e.g., </title>EDITION:<edition>) using "insertTextAsContent":
    [xmlElementHere].insertTextAsContent("EDITION:", XMLElementPosition.beforeElement); 
    Does anyone know a good way to apply a paragraph style to that text without using a find & replace function later (after placing the XML into a text frame)?

    As posted into the other thread:
    Yes, each record will be in its own frame.
    You can use one of a couple solutions to stitch (link) each frame to the other, delete all but the first page and the first merged record, then resize that first merge frame and reflow the entire document.
    https://forums.adobe.com/thread/1341730?start=0&tstart=0
    Please review this thread. There is a couple posts with a script and you would want the last version of that script. You would have to follow the directions, as well as add a column at the beginning of your data and fill it with consecutive numbers.
    Alternatively, there is a free plug-in by Rohiko for stitching merge data frames together, then follow the process above to reflow the document.
    https://www.rorohiko.com/wordpress/indesign-downloads/textstitch/
    Mike

  • Multiple columns within a single text frame

    Is it at all possible to make a single text frame containing first a single column followed by two columns?
    Why: I need to have my heading expanding across my two column body text. What's important is that I need the two column body text to automatically drop whenever I type (or paste) in more text in my heading. Like it would if the heading and body text was in a single column.
    My text frame options (I work in CS3) do not give me this option, I can only work in one "frame set". I have tried fixing this problem with combinations of tables, multiple text frames and text wrap, but nothing really works.

    Thank you Peter.
    Yes I did try it.
    InDesign CS3 just gives me this alert:
    I also tryed copying the files (HeadStraddler.jsx and HeadStraddler.indl) into a folder like you suggested.
    C:\Program Files\Adobe\Adobe InDesign CS3\Scripts\Scripts Panel\Version 4.0 Scripts\HeadStraddlerForCS2.
    But I just get the same alert.

  • Create a  continuous flow of records in a single text frame

    I've searched past posts and cannot find the answer (though I'm sure the questions been asked aplenty).
    I have an Excel file with Company names, addresses, telephone numbers, emails and websites, etc. which are to be placed in a directory. I can't extract each company's details and get get them to flow in a single text frame (instead each seems to extract into it's own frame).
    Can anyone tell me what to do, please. I've spent more than an hour looking at the forums and various tutorials, etc.
    Bongani

    It might help if you post what versions of InDesign and Excel that you use, what OS you are in, and what format the Excel file is (.xls, .xlsx, .txt, .rtf, etc.). Also, you said your data needs to be placed, but some people paste instead of place, so I thought I'd ask you to specify how you are getting your data into ID.
    EDIT: Are you getting a table, when you want a text frame? I only ask because a table can look like a bunch of separate text frames.

  • How to handle paragraph styles in imported text with no tagged paragraph styles

    Hi
    Im currently trying to import a file (word file / excel I have both formats) into an indesign book and formatting the text automatically!
    My question is: How is it possible to reflow text into frames and when changing frame it changes paragraph?
    Or how is it possible to change paragraph style when forcing a line break when using text reflow?
    I have already figured out how to reflow the text, and actually also managed to relow text into the frames and change paragraph style. I know how to use the keep option, and by this change the paragraph style when e.g. changing frame break/page break etc.  (but if the content being flowed-in is not tagged with style names then I cannot figure out how to do it) The document and its content I whish to import do not have any tagged paragraphs!
    Then I tried to look into "object styles" and format a text frame on a master page with an object style, and by using a "dilimiter character" forcing the text to start in a new frame when bringing the frame into live on a page. But here I cannot make the "text frame/object style" to apply or to work.
    If any of you have a hint, I would be more than happy to hear from you
    This picture are illustrating the outcome I would to get to....

    If the incoming text does not have styles, or has only one style, there is really not much you can do other than assign styles after the import. If there are recognizable patterns in the formatting, a lot of that can be done with Find/Change, and there are a few scripts floating around that can help automate some of that.
    Also, if your styles have a a good "next style" heirarchy built in, you can select large blocks of text (up to the point where applying next style would be incorrect), then right click the style name in the paragraph styles panel and choose apply style and next style (remove overrides). Warning. Removing overrides will remove any locally applied formatting like bold or italics, so local formatting should be converted to character styles first. Applied character styles are not overrides and will be preserved.

  • How do I create a series of text frames using values from Excel list?

    First of all, this is the very first script I'm attempting to write from scratch. I'm completely green at scripting, and I've picked up a few snippets from Adobe's ID scripting guide, but nothing has really stuck yet relating to this particular objective.
    My supervisor keeps a master list of ad spaces, with the name of the account, how wide the space is, and how tall the space is, all in an Excel sheet. These spaces can number in the hundreds, and I am stuck manually drawing one rectangle for every space, which takes a very long time.
    I'd like to create/have help creating a script that will take these values and "automagically" draw these spaces in the form of text frames, with the width (in columns) and the height (in inches) defined by the values in the master list, as well as the name of each account appearing in the subsequent text frames.
    The script doesn't necessarily need to be able to pull the values straight from the Excel sheet; I can transfer the values to a support text file if needed, or directly into the script, changing it as I need it. A big thing (if it is not able to pull right from an Excel sheet) is that the number of spaces changes weekly, and so do the accounts, and the width and the height. Accordingly, it would be ideal if the values from the sheet could be changed easily, so as to create a new set of spaces as needed.
    Positioning for each space is not crucial, only height and width. If they all appear on top of each other on the same page, that will be a result for me. The main idea is to not have to draw them all manually, one by one.
    To me, this sounds like a tall order, but hopefully some experienced scripters out there can assist me, as I wish to become experienced as well.
    So, the TL;DR version:
    - Script needs to draw a series of text frames.
    - Text frames dimensions need to be defined by width and height values from Excel sheet.
    - Text frames must have account name as contents (from account names in Excel sheet).
    - Accounts, width and height change every week in the Excel sheet, so must be relatively easy to exchange all of the values.
    - The width values are on the Excel sheet as columns. It would be ideal if the script could convert those numbers into multiples of columns as needed.
    - (Optional) Script can pull values directly from Excel sheet.
    - (Optional) Script can define text frame fill color as gray. (If it works as I think it will, I could just select all the resulting text frames myself and set them all to gray at once... I'm not that lazy )
    Thanks in advance to whomever can assist in any possible way, even if it is just a push in the right direction. This script will save 1-2 hours of tedium every week.

    Sound like the perfect thing for InDesign Scripting.
    I would copy the Excel contents into a text file, to get a format that is easily read from InDesign, and there will automatically be a TAB for each "cell" just using copy/paste.
    Here is a piece of code, that you perhaps could go on with (adding variable to change pages and location on page, and other stuff).
    The readFileLineByLine function, can be easily re-used with any function using "callback". You simply supply the function to it, that you want to be executed for every line of text that is read:
    const COLUMN_WIDTH = 2; // Define the column width in inch
    var pageIndex;
    var textFramesExported; // not implemented.
    // Add a new dokument. Set myDoc to app.activeDocument to use
    // the current document instead of creating a new one.
    var myDoc = app.documents.add();
    // The doSomethingWithTextRow function is called upon for every line of text read.
    readFileLineByLine('c:\\test.txt', doSomethingWithTextRow);
    function doSomethingWithTextRow(row){
        // We expect the text line to be TAB separated (\t = TAB). We get that from just copying the contents of an
        // excel file into a text document.
        var cells = row.split('\t');
        var companyName = cells[0]; // The Company name in the first slot of the array
        var width = COLUMN_WIDTH * cells[1];
        var height = cells[2];
        // Create a new text frame for every row handled
        if (pageIndex==undefined) pageIndex = 0; // Count up when you have exported a number of texts, I leave this for you to do.
        var newTextFrame = myDoc.pages[pageIndex].textFrames.add();
        newTextFrame.contents = companyName;
        // The text frame is created in the top left corner.
        newTextFrame.geometricBounds = [0, 0, height + ' in', width + ' in']; // Top, Left, Bottom, Right
        // You might want to move the textframes to other positions, keeping track of how many you put out per page.
        newTextFrame.move( [10, 10] );
    function readFileLineByLine(path, callbackFn){
        var myFileIn = new File(path);
        if (File.fs == 'Windows'){
            // This was probably added to recognize UTF-8 (even without its start marker?)
            myFileIn.encoding = 'UTF-8';
        myFileIn.open('r');
        var myEncoding = myFileIn.encoding;
        try{
            if (!myFileIn.exists){
                throw('Missing file: ' + myFileIn.fsName)
            var ln = '';
            while(!myFileIn.eof){
                // Read the lines from the file, until an empty line is found [now as a remark].
                ln = myFileIn.readln()
                // if(ln !='' && ln!='\n'){
                   // Call the function supplied as argument
                   callbackFn(ln);
        }catch(e){
            alert(e);
            gCancel = true;
        finally{
            myFileIn.close();
    The file in C:\ in my example was saved as UTF-8 and looks like this (showing hidden characters):
    Message was edited by: Andreas Jansson

  • How do I create a series of text frames from a list of files?

    And I'm back again.
    This time, I'm wondering how I can use JavaScript to place a series of text frames from a list of files, preferably with the ability to specify criteria before running the script.
    Here's the details: I work for a newspaper and I lay out stories for the pages (in addition to the other part of my job, laying out ad spaces, as detailed in a previous thread, for which I requested another script, thanks Andreas and Jongware ). The file names for the stories are labeled for the section they go in, like L- for Life, C- for Comment, S- for Sports, etc.
    I'd like to create a script that asks for a criteria in a text box (where I can type L-, C-, S- or whatever else I need) and then places all of the stories, in a specified directory, whose file names match what was typed in the box, one text frame for each.
    I can't rightly tell if this is a simpler or more difficult script to write out, but I plan on putting research into it as usual so I can develop it myself. However, I figured it would be more efficient to ask first, then research, so that while I'm researching, I can refer to the opinions of my fellow forumites, and/or the mods.
    Thanks again for any assistance offered.

    And I'm back again.
    This time, I'm wondering how I can use JavaScript to place a series of text frames from a list of files, preferably with the ability to specify criteria before running the script.
    Here's the details: I work for a newspaper and I lay out stories for the pages (in addition to the other part of my job, laying out ad spaces, as detailed in a previous thread, for which I requested another script, thanks Andreas and Jongware ). The file names for the stories are labeled for the section they go in, like L- for Life, C- for Comment, S- for Sports, etc.
    I'd like to create a script that asks for a criteria in a text box (where I can type L-, C-, S- or whatever else I need) and then places all of the stories, in a specified directory, whose file names match what was typed in the box, one text frame for each.
    I can't rightly tell if this is a simpler or more difficult script to write out, but I plan on putting research into it as usual so I can develop it myself. However, I figured it would be more efficient to ask first, then research, so that while I'm researching, I can refer to the opinions of my fellow forumites, and/or the mods.
    Thanks again for any assistance offered.

  • How to determine column inches in a text frame with intersecting frames?

    I am trying to write a script to determine how much text would fit in a text frame before actually having the text. If the frame has no run-around areas intruding on the frame it is the simple depth of the frame. Is there an easy way to determine the area of the frame with the obstructed areas subtracted?

    Maybe you could fill text frame with placeholder text:
    myTextFrame.contents = TextFrameContents.placeholderText;
    Hope that helps.
    tomaxxi
    http://indisnip.wordpress.com/

  • How can i find numberedList in a text frame?

    Hi,
    I need to find the numberedList in a text frame. so that i have written a script. Syntax is given below.
    app.findTextPreferences = NothingEnum.nothing
    app.findTextPreferences.bulletsAndNumberingListType = app.findTextPreferences.bulletsAndNumberingListType.ListType.numberedList;
    var res = app.activeDocument.textFrames[0].parentStory.find();
    alert(res.length)
    But it is not working. How can i write it?
    Regards,
    Subha

    app.findTextPreferences.bulletsAndNumberingListType = ListType.numberedList
    is I think the right syntax for the second statement.
    Dave

  • Text alignment inside custom text frame

    I created a custom text frame by combining a triangle and a rectangle using Pathfinder->Add but when I added text, this is how it looked --  but I wanted it to look this way.

    Ketchapay2 wrote:
    Thanks! I'll try that now. UPDATE: When I applied rounded corners, it also rounded the pointer which is supposed to be sharp.
    Well, that used to work, I think.
    In any case, I just tried something else and it seems to work. Make the round corner text frame and the the triangle as you did before. Put the triangle BEHIND the text frame and make the shape. There is however, another potential problem to this technique -- the text will want to flow into the triangle area. I don't think this is escapable without either putting the text into a seond rectangular frame in front, or adding an empty frame in the triangular area and applying text wrap to push the text back into line.
    Peter

  • How to disable Incopy option for a text frame

    Hi All,
    I encounter a document contains a lot of text boxes out of them one has a strange textframe. On right click this textframe I am unable to view 'Incopy' option.
    Isn't it strange?
    Does anyone know how to do it ?
    Please help.
    Thanks,
    D

    Hi Peter,
    I have tried to recover the document as suggested in the post you refere. My problem is still same.
    I figured out that, the story is bound to a xml structure with lots of tags according to the xml structure. If I do 'untag frame' then I am able to export this frame as Incopy story. Still I didn't know what exactly is the issue. As I am able to export other text frames which has tagged content.
    Is it related with tagged content which is tightly bound with xml tags ? Any ideas ??

  • How to copy a table from one text frame to another...

    Is there a way to copy a table from one text frame to another? I'm using JavaScript. The following will move a table from one text frame to another, but I need to copy.
    var srcFrame = document.textFrames.item("section-template");
    var dstFrame = document.textFrames.item("test");
    srcFrame.characters[0].move(LocationOptions.before, dstFrame.insertionPoints[0]);
    Thanks,
    Mike-

    Hi Bhupinder,
    According to your description, you want to copy a table with Primary keys from one database to another database.
    As per my understanding, I think the best method is use Transfer SQL Server Objects Task in SQL Server Integration Services. The Transfer SQL Server Objects task transfers one or more types of objects in a SQL Server database between instances of SQL Server.
    Server roles, roles, and users from the specified database can be copied, as well as the permissions for the transferred objects. Indexes, Triggers, Full-text indexes, Primary keys, Foreign keys can also be copied.
    To use the Transfer SQL Server Objects Task, we should create a SQL Server Integration Services Project in SQL Server Data Tools, then drag a Transfer SQL Server Objects Task to Control Flow pane. Specify SourceConnection, SourceDatabase, DestinationConnection
    and DestinationDatabase for the Connection, select the table in the ObjectsToCopy category, then change CopyPrimaryKeys to True and the other corresponding properties in the task.
    References:
    Transfer SQL Server Objects Task
    Transfer SQL Server Objects Task in SSIS 2008 R2 With Example
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • Error Message on Wiki When Attempting to Download File

    I have a wiki successfully set up. Authenticated users are able to log in and make changes to text, add pages, etc. The problem is, I get an error message any time I try to download a file: The wiki service is most certainly turned on. File type does

  • Best Practice for the Service Distribution on multiple servers

    Hi, Could you please suggest as per the best practice for the above. Requirements : we will use all features in share point ( Powerpivot, Search, Reporting Service, BCS, Excel, Workflow Manager, App Management etc) Capacity : We have  12 Servers excl

  • Refreshed universe and now reports are not working

    I added Restricked key figures and calculated key figures and I when I run my webi report I get this error message: Query 1 - Maintenance Orders Maintenance Plan and Actual - Regular Hours A database error occured. The database error text is: The MDX

  • Conversion to 9.0 from 8.0 lost ability to append emails to file

    We had everyone in the office on Acrobat 8.0 and Reader 8.0. I converted to Acrobat 9.0 and Reader 9.0.  I have since converted Reader back to 8.0 due to printing issues. I still use Acrobat 9.0.  The Outlook AdobePDF tab conversion setting is Acroba

  • JVM - Microsoft JScript.dll Memory Leak when using Java Web Start

    I have posted before a topic related to this matter, although now I have a lot more information about what is going on (although still no fix for it). This is the link to the earlier post, containing JVM HOTSPOT EXCEPTION_ACCESS_VIOLATION http://foru