Skip navigation
nikasd8
Currently Being Moderated

making the first line in each paragraph bold

May 23, 2012 1:34 AM

Tags: #text #indesign #selection #textframe

hello all

I have been reading this forum but i cant really seem to find the answer i need.

Here is my problem, we are planning to automate the flowing of text in our organisation, this is what i have to do

-read story entries from a database

-flow the text in to a text box of particular width eg 4.5cm

-each paragraph will be sepearted by 2 new lines

- select the first line of each paragraph then make it bold.

 

from the above list i can do everything except the select first line of paragraph and make it bold. I have been looking for text selection as far as i can see there is a function called textframe.select?

Can anybody help me out with this please?

 
Replies
  • Currently Being Moderated
    May 23, 2012 2:18 AM   in reply to nikasd8

    Is there a reason why you cannot use a Nested Line Style for this?

     

    (see http://help.adobe.com/en_US/indesign/cs/using/WSE33E49F9-94CE-4043-AA5 1-4761408A63F4a.html)

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2012 7:59 AM   in reply to nikasd8

    They were introduced in CS4.

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    May 23, 2012 10:43 AM   in reply to Harbs.

    That severly limits your options. (Which reminds me, you might want to state a major detail like that up front next time.)

     

    The straightforward solution would be to apply your bold font (or, better: a character style) to the first line of each paragraph using the .lines property of a paragraph. Uh -- customary link to the HTML version of the OMV omitted, it seems I don't go back as far as CS2 ... (There is a CHM for it at http://www.jongware.com/idjshelp.html).

     

    This ought to work:

     

    app.selection[0].paragraphs[0].lines[0].appliedCharacterStyle = "YourBoldCharStyle";

     

    ... where your cursor is inside the paragraph you want to change. Adjust at will to cater for your special needs.

     

    There is a downside to the straightforward method, though. Unless you are using a special font which has bolds with the same width as its regular (quite unusual), the text will reflow after you applied it. So then there are one or more bold words on the next line, and you should remove the bold char style from those. But! At that point InDesign may decide those non-bold words can fit again on the first line!

     

    Well-written code does not help, as it might be possible the same word oscillates back and forth with every change between the first and the second line, each time getting it wrong ... So at *some* point you are going to have to help poor ID a bit; perhaps by fixating that first line with No Break applied to it.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points