Paragraph style, first line "BOLD"

Hi all

I try to give a column in a table definition in which the first line is "BOLD" and the rest of the cell is not, like this:

---------------------------------------------------------------------------------

2 3 column cell

Name of the company
Address

Address

2 4 column cell

Name of the company
Address

Address

---------------------------------------------------------------------------------

I don't know if this is even possible, but it would be a great help.

I apply the paragraph as follows to the second column:

---------------------------------------------------------------------------------

myTable.columns [1].cells.everyItem () .texts [0] .applyParagraphStyle (contentText);

---------------------------------------------------------------------------------

Here's the paragraph contentText:

---------------------------------------------------------------------------------

contentText var = myDocument.paragraphStyles.item ("contentText");

Try

{

var contentTextName = contentText.name;

}

catch (MonErreur)

{

contentText = myDocument.paragraphStyles.add({name:"contentText"});)

}

contentText.appliedFont = "Arial";

contentText.fontStyle = "Regular";

contentText.pointSize = 10;

contentText.spaceAfter = 10;

contentText.spaceBefore = 10;

contentText.fillColor = myDocument.colors.item ("Black");

---------------------------------------------------------------------------------

Is there a way to leave only the first line to be bold?

Thanks in advance,

Greetings

Hello

You can work with a line for your paragraph style style, if your lines of text are not separated by the sign of paragraph as in a good example shown here:

If your text is composed as in the example on the left using signs of paragraph, you need a paragraph style distinct for the first paragraph with Arial Bold.

As already noted Willi Adelberger.

Example for adding a nested line style:

var doc = app.documents[0];

// Your paragraph style name that later should contain a line style:
var paraStyleName = "contentText";
// For defining a line style we need a character style:
var charStyleName = "FirstLineBold";
// All properties for the paragraph style:
var paraStyleProperties =
{
    name : paraStyleName ,
    appliedFont : "Arial" ,
    fontStyle : "Regular",
    pointSize : "10 pt",
    spaceAfter : "10 pt",
    spaceBefore : "10 pt",
    fillColor : "Black"
};
// All properties for the character style we need for the line style:
var charStyleProperties =
{
    name : charStyleName ,
    fontStyle : "Bold"
}

// Check, if the needed styles are there:

// The paragraph style.
// using IS NOT VALID is recommended
if(!doc.paragraphStyles.itemByName(paraStyleName).isValid)
{
    var paraStyle = doc.paragraphStyles.add(paraStyleProperties);
}
else
{
    var paraStyle = doc.paragraphStyles.itemByName(paraStyleName);
    paraStyle.properties = paraStyleProperties;
};

// The character style.
// using IS NOT VALID is recommended
if(!doc.characterStyles.itemByName(charStyleName).isValid)
{
    var charStyle = doc.characterStyles.add(charStyleProperties);
}
else
{
    var charStyle = doc.characterStyles.itemByName(charStyleName);
    charStyle.properties = charStyleProperties;
}

// At this point we have a valid paragraph style and a valid character style.
// Now let's add a line style.

/*
    Note and warning:
    In case the paragraph style already has one or several line styles we
    have to either remove them to get our new line style at "pole position",
    because there is no move() method to bring a new line style up in the stack of line styles.

    Or we have to redefine the first line style. Which is done below.

    About removing line styles:
    Tested and is not working with CS6. Could be a bug.
    paraStyle.nestedLineStyles.everyItem().remove()
    So I think it is best to loop through and remove them one by one.

*/

// Redefining the first line style if there is already one.
// Else add a new one.

// Note: Using the properties-property is not working here:

if(paraStyle.nestedLineStyles.count()>0)
{
    paraStyle.nestedLineStyles[0].appliedCharacterStyle = charStyle;
    paraStyle.nestedLineStyles[0].lineCount = 1;
}
else
{
    paraStyle.nestedLineStyles.add({appliedCharacterStyle : charStyle , lineCount : 1});
}

For DOM documentation, see the following sources:

Jongware:

InDesign JavaScript help

Gregor Fellenz:

InDesign ExtendScript API (8.0)

InDesign ExtendScript API (10.0)

InDesign ExtendScript API (11.0)

Kind regards
Uwe

Tags: InDesign

Similar Questions

  • First line indent Null

    Hello

    I need a null value in the paragraph Style "first line indent. See my code below

    --------------

    pstyle var = app.documents.item (0).paragraphStyles.everyItem () .getElements ();

    for (i = 0; i < pstyle.length; i ++)

    If (.appliedParagraphStyle [i] pstyle is '04 space pause FL')

    {

    pStyle [i] .firstLineIndent = null;

    }

    --------------

    So now my space FL 04 with removal of first line Break tag is 1 p, but I need to set to null, the value.

    By

    Assia

    Hi @Murali_Vetha,.

    There are two errors in your code.

    • You should compare the name of the style.
    • NULL is not a value

    Try this:

    var pstyle = app.documents.item(0).paragraphStyles.everyItem().getElements();
    for (i=0; i
    

    Have fun

  • How do to "BOLD" in the first line of text on a number of sections of text at a time

    CS5 using (but we have CS5

    .5 available) we will create a business directory. Each page has columns of type

    business listings with the company name on top, under this address under this phone, etc.  Each ad is separated

    by a single line. There are thousands of ads, and we need to "BOLD" in the top line of each. How can do us

    without making them individually?

    Each line a paragraph, or each list a paragraph with soft returns (forced line breaks)?

    It's very simple and basic in both cases an operation. It is especially easy if each ad has the same number of lines, so we will focus first with this case.

    Each line should be a separate paragraph. If you have 4 lines, as your example, you might want to mention their name, street, city, and phone. You can and should, all the styles that will be similar in appearance on the same basic model and change only the atrributes that are different, so, for example, if all lines use the same font, many use the same size and weight and only the top line is different and only by being "BOLD" and or larger size start by defining the street, then city and phone based Street and you don't need to define something more than the next Style, I'll get to in a second.

    For topics, set name based as well on the street, but change the font characters. Now all the features of the basic fonts can be changed in one place, the definition of the style Stree.

    Since you have the same number of lines in each list, you can set up a loop "next style". For name, style next street is, the street is the city, for the city it is the phone and is name for the phone. You will also need to toe after the add space in the name, or space on the phone to book spaces registration and you probably also consider to assign everything except phone keep with the next line to prevent a list from breaking across a page or column break. If currently you have blank lines as separators (empty paragraphs), get rid of them. There are change queries find already registered in ID that will do that.

    Once the text is in place and the styles are defined, you can select all, then right click on the style name in the paragraph Styles Panel and choose apply following Style and name. Reformatted your entire list. IT IS CRITICAL in this method that the structure of each list is identical, and if there are no empty lines between the lists.

    If each line is a paragraph, but there is line different counts, you will probably reach with just two styles, one for the headings oand one for everything else, but the beat of following style will not work. If there is something unique that appears in all the headings you can use find/replace to make search and reformat in shape, but I suspect that this will not be the case on in the real world, there will be a manual work involved.

    Where a lisitn is a single paragraph, line break forced (which is better suited to the case of an uneven lines by registration number) you can define a character style nested to be applied by means of a line break forced to make the first line "BOLD", red or any other thing you want.

    At this point, you are probbly, noting that a bit before planningn is a good idea when you do a directory so that your ads have some sort of coherent structure that allows for automation. I have no idea whre that your text is coming from or how it is done in the code. If it can be established as a .csv or a tab-delimited text file, you can use data merge to fill a file based on a model of merge (i.e., how to build directories for my clients who need). You can set styles in the model to each field or paragraph that contains several fields, and merge data will remove empty lines if all row fields are null and there is no punctuation or whitespace on the line.

    A multiple records per page fusion will give you individual blocks of text for each record, and you can, if you wish, thread them using the script text point of Rorohiko.com.

  • Character vs drop cap style paragraph style

    I guess that I do not understand the character styles and having problems with them carrying through when I don't want them.

    I created a called the body text paragraph style. I then created a paragraph called style, first paragraph, which is the same as the body of the text except that it uses one style character drop cap, which is a different color and melting.

    When I apply the body text of a paragraph, it works fine. However, if I apply the first paragraph, but changed my mind and apply the body of the text, I can't get rid of different color and the police of the drop cap. In fact, it apply this character style to the whole paragraph.

    Of course, I did something wrong. Any clue?

    I think you're on the right track, but you have made some bad decisions. First of all, you want your style of bodywork with your first paragraph style to be the same, with the exception of the drop cap. It can be useful if you were to remove the first paragraph style and then make a new copy of the body style, rename it, first paragraph and make it based on body style. Simply change the appearance of the drop cap number of characters and lines you want.

    You want not any formatting local on paragraphs, so the first thing to do is to select the first two paragraphs and click the style of body while pressing the Option key (Mac, maybe the Alt key if you are using Windows). This will apply the paragraph style of the body with no local replacement (the style). Then claire on character styles by selecting no style in the palette styles of character (while the two paragraphs are always selected with the text tool).

    Now, click in the first paragraph and select the first paragraph style. It should look the same as the body style, but have a drop cap. At this point, if you want a different font, bold/italic, color, etc., you can start thinking about a character style. You will apply the character style in the portion of the paragraph style initials, and it will effect only the number of characters that you specified for the drop cap.

    Make a new character style and only define the perameters that you want to be different. For example, if you want time to your basic fonts and italic foie gras for the drop cap, set font Style in the Formats section of basic characters of the character in Bold Italic Style palette, but leave the empty police. In this way, if you decide later than Helvetica as standard paragraph font, you will not be left with a drop cap times bold italic character (instead of this, bold and italic are going to stay, but they will on Helvetica).

    So, you have a character style and a paragraph style. Just set the character style to the drop cap in the paragraph style, first paragraph, (its just beside the number of characters and lines). You can then switch back between the body and the first paragraph without the problem you are having now.

    EDIT: I just had another thought. Your paragraph styles contain nested styles?

  • How to create a numbered list paragraph style?

    You know what you would think it would be simple to make a numbered list paragraph style.  I created a new paragraph. style is then in the bullets and numbers on the style. Here, I chose dial. When I applied it in 11 paragraphs each begins with 1.

    If I go to the toolbar at the top and click numbered list market then it works as expected. My style of "Numbered list", and then has a +, 'Redefining the Style' is grey so I can redefine to try to fix it.

    What I am doing wrong?

    BTW, I also want to use a style of tank inside it for the first line, which is the main point of the ball being made (small caps/bold) < paragraph return > then, normal text for the rest of this bullet

    Thank you

    You are also asked to do the first line "BOLD". You indicate that it is its own paragraph, so you'll want a paragraph style that includes character attributes and the attributes of type numbered list while you're there. You use character styles only if there is more than one style in the paragraph which is not the case here. And then create a paragraph style second which is indented and non-bold for text "complementary." If you skillfully use the tags 'next paragraph style', you can have styles replacing automatically as you type, then you can apply styles to an entire list with a single command using the context menu command "style Apply, then next style." So, in short, I would use three paragraph styles:

    1 FirstNumberedList style (resets the paragraph style counter next is number 1, "BOLD", "Description")

    Style of description (withdrawal, non-fat, is paragraph style following "NumberedList").

    2 NumberedList style (continue the numbering, "BOLD", is style of following "Description" paragraph)

    Style (even before) description

    3 NumberedList style (the same as before)

    Style description... etc.

    To apply all the styles on a typical previously part of the text in one: select the entire list, and then Ctrl-click on the 'FirstNumberedList' style in the palette paragraph styles, and then choose "Apply"FirstNumberedList"then next Style." The first paragraph will be in the FirstNumberedList format, and all of the following in your choice will have a format based on the "next paragraph style" of the previous paragraph.

  • make the first line of each paragraph "BOLD"

    Hi all

    I read this forum, but I can't really find the answer, I need.

    Here's my problem, we intend to automate the flow of text in our Organization, that's what I have to do

    -read the input from the story of a database

    -flow text into a text box in particular for example 4.5 cm wide

    -each paragraph will be had 2 new lines

    -Select the first line of each paragraph then putting in bold.

    in the above list, I can do everything except the first paragraph selection and putting in bold. I am looking for the selection of text I see there is a function called textframe.select?

    Can someone help me with this please?

    This severely reduced your options. (Which reminds me, you can specify a detail important like that from the beginning the next time.)

    The simple solution would be to apply your "BOLD" font (or better: a character style) in the first line of each paragraph by using the property of a paragraph .lines. UH customary ‑‑ link to the HTML version of the omitted OMV, it seems I'm not coming back as much as CS2... (Is there a CHM for it to http://www.jongware.com/idjshelp.html).

    This should work:

    App.Selection [0] .paragraphs [0]. Lines [0] .appliedCharacterStyle = "YourBoldCharStyle";

    ... With your cursor in the paragraph you want to change. Will adjust to meet your specific needs.

    There is a drawback of the simple method. Unless you use a special police who makes bold with the same width as her (quite rare) usually, the text will be redistributed after he applied. So there are one or more words in bold on the next line, so you must remove the tank style "BOLD" of those. But! At that time InDesign may determine that these non-bold words may go back on the first line!

    Well written code does not help, because it could be possible the same word oscillates backwards with each change between the first and the second line, each time to cheat... At * some * point you'll have to help the poor ID a bit; perhaps to fix this first line with No Break applied.

  • How to set the alignment of the grid as "First line only" for any style of paragraph

    Hello.. Please help me.

    I have to set the alignment of the grid as "First line only" for any paragraph style.

    I use the code below to set the alignment of the grid as "all lines".

    *********************************************************************************

    TextAttributes InterfacePtr < ITextAttributes > (styleInfo, UseDefaultIID());

    AttrGridAlignment InterfacePtr < ITextAttrGridAlignment > (: CreateObject2 < ITextAttrGridAlignment > (kTextAttrGridAlignmentBoss));

    attrGridAlignment-> SetGridAlignment (Text::kGABaseline);

    textAttributes-> ApplyAttribute (attrGridAlignment);

    Here, I created the text attribute of the alignment of the grid and applied to the styleInfo of the style.

    Now, the problem is that I tried all available of Text::GridAlignmentMetric values, but none of them affect the 'first line only. Please tell me the solution of this problem. I'm short on time.

    Thanks in advance.

    You apply this attribute via kEditTextStyleCmdBoss or equivalent? If this is not the case, consider to do.

    kGABaseline is what you need. In addition (see dialogue change style to a "pipe") you will need kTAGridAlignOnlyFirstLineReportBoss - IID_ITEXTATTRBOOLEAN set to true...

    Dirk

  • How can I get the first line of a paragraph style indent, but others not in withdrawal

    I created a style of paragraph indented on the first line of each paragraph. In most of the books, at the start of the first line of a chapter, this line is not indented while the rest are. Is there a way to set up in InDesign CS3? Is the only way to make this work is to manually go out the tab at the start of each chapter?

    2 paragraph styles.

    1 paragraph style has no dash

    2nd paragraph style has dash

    set "next style" in 1st paragraph for paragraph 2e style style

    the "next style" value in the style of paragraph 2 to "even".

    Existing text.

    Select all of the text

    Right-click on the 1 paragraph style and select apply style then next style.

    New text (typeing)

    Start typing with the selected 1 paragraph style. When you press ENTER to start a new paragraph, the style will switch automatically to the 2nd paragraph style to what manually enable you return.

    HTH

    -mt

  • First line indent except the first line of a paragraph

    Hello

    I would create a paragraph style with a first line indent, with the exception of the first line, which I have no dash.

    Attached an example of how I want it to look.

    Best regards

    Vincent

    Schermafbeelding 2016-07-29 om 11.01.28.png

    You need a second style to the first paragraph. Based on the other model and the withdrawal of first line value of 0.

  • Paragraph style with different key on the 1st and 2nd lines

    Hello

    I want to do a paragraph for a caption style. The font size is 5. the first line must have 5 pt leader and the second line must have 6 main points. Is it possible to select this as a paragraph style or I have to put the different leading to each line manually each time?

    Adrian

    Could be done, I suppose, using a style of character as a nested line Style, but why do you need to do this? The leading of the first line value does not actually affect the first base line in a block of text. Would probably be a better way to fix the first line of base to 5.

  • change the first line of a table to a cell style

    Hello

    I want to change the first line of a table to a cell style.

    Is this possible in javascript?

    Patrick

    Hi patrickbcm,

    Try the threshold.

    app.activeDocument.stories.everyItem().tables.everyItem().rows[0].cells.everyItem().appliedCellStyle = app.activeDocument.cellStyles.item("row1");
    

    THX,

    csm_phil

  • Apply a paragraph style to the first cell in the first row of a table

    I want to apply a paragraph style to the first cell in the first row of a table.

    I use JavaScript with ID CS 5.

    Thank you.

    . aragraphStyles.itemByName ("NameOfStyle") .p appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.itemByName ("NameOfGroup")

  • I need help to write a script that detects the first instance of a paragraph style and then change

    I need help to write a script that detects the first instance of a paragraph style and then he goes to a different paragraph style.  I don't necessarily need someone to write all this, by the biggest problem is to find how to find just the first instance of the paragraph style.  Any help would be greatly appreciated, thank you!

    Hello

    then try this with your active doc:

    ....................

    myDoc var = app.activeDocument;

    mStyle var = myDoc.paragraphStyles.item ("PS_NameToFind"); change the name to paraStyle

    var mStyle_1 = myDoc.paragraphStyles.item ("PS_NameToChange"); change the name to paraStyle

    var mFrames = myDoc.pages.everyItem ().textFrames.everyItem () .getElements ();

    app.findTextPreferences = null;

    app.findTextPreferences.appliedParagraphStyle = mStyle;

    for (var k = 0; k)< mframes.length;="">

    {

    currFound = mFrames [k] .findText ();

    If (currFound.length > 0)

    currFound [0] .paragraphs [0] .appliedParagraphStyle = mStyle_1;

    }

    app.findTextPreferences = null;

    ................

    Rgds

  • Problem with white - style commentary on the first line of the select statement.

    SQL * more error? :
    It seems that the parser does not like "-" at the end of the first line of the request.
    I see this error "ORA-00936: lack of expression" or "ORA-00933: not correctly completed SQL command.
    SQL * Plus costs number not the 2nd line when I do that.
    If a space follows-, '-', I still get the error.
    a single "-" at the end of the line is ignored and the query works
    But, "-." will not get the error.
    I think that I had this problem before on the inside in the middle of a procedure from PL/SQL package.
    --
    It is of course easy to avoid. Is this just a quirk or am I missing something?
    -----
    SQL * more: 9.0.1.4.0 output
    Oracle Database 10 g Enterprise Edition release 10.2.0.3.0

    ----------------------------------------------
    -- These provoke an error
    ----------------------------------------------
    SQL select 'a' --
     from dual;
    select 'a' - from dual
                 *
    ERROR at line 1:
    ORA-00936: missing expression
    
    /* the -- is "-- " */
    SQL select 'a','b','c' --
     from dual;
    select 'a','b','c' - from dual
                         *
    ERROR at line 1:
    ORA-00936: missing expression
    
    SQL select --
     select 'a' from dual --
     ;
    select - select 'a' from dual -
             *
    ERROR at line 1:
    ORA-00936: missing expression
    
    
    SQL select 'a' from dual --
     ;
    select 'a' from dual -
                         *
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    ----------------------------------------------
    -- These are OK 
    ----------------------------------------------
    SQL select 'a' --.
      2  from dual;
    
    '
    -
    a
    Elapsed: 00:00:00.00
    SQL select
      2  'a' --
      3  from dual;
    
    '
    -
    a
    
    ------- a single "-" at the end of the line is ignored, query works
    SQL select 'a' from dual -
     ;
    
    '
    -
    a
    
    
    SQL

    Actually, it's in the docs, but we rarely know.

    >
    Continuing a long SQL More control on additional lines *.
    You can continue a long SQL * more command by typing a hyphen at the end of the line and press return. If you want, you can type a space before you type the hyphen. SQL * Plus displays a right angle (>) support as a prompt for each additional line (not in iSQL * more).

    For example:

    SALARY $99 999 COLUMN FORMAT-
    SECTION "WAGES."
    Since SQL * Plus identifies the hyphen as a continuation character, entering a hyphen in a statement SQL is ignored by SQL * more. SQL * more does not identify the declaration as a SQL statement until after the treatment of entry has joined lines together and removed the hyphen. For example, enter the following:

    SELECT - 200
    100 DOUBLE;
    Returns the error:

    >

    It only happens for the first line of a sql statement, because at that time there you are not in the edit buffer. And the order could still be a sql * more order and not a sql command.

    Published by: Sven w. on August 7, 2009 16:51

  • Script or a paragraph Style?

    I have an Excel worksheet with name, phone and category.

    It is true - I'm a noob InDesign - but I pick up things quickly.

    I want to format this info (more than 600 entries) in an almost "telephone directory" as put on the page.

    3 columns, "BOLD" first line, tabs: leader dashed, the phone number of regular fonts, the line category: italics.

    This link:

    The name of the company ... (555) 555-5555

    Financial services

    I also need to adjust the spacing between each (space) after paragraph, kerning between company name and the beginning of the «...» "(and after).

    Paragraph style does not... style entry all as the first line.

    Should I build a script?

    Thanks to anyone who takes the time to add an idea.

    -Josh

    Here's a little cast of the screen.

    There is a small blunder that grep change should have been made before the text of the amendment.

Maybe you are looking for

  • How to create an active hyperlink in an email from mozilla?

    I typed a web address into an e-mail message and click the option link it into a hyperlink to the Web site. When I send the message to the receiver says that the link does not Web site in a browser. It doesn't do anything.

  • Y510P stolen serial number

    Hi all! Unfortunately, I recently had my laptop stolen. I contacted Newegg to ask what was the serial number and they gave me this: "1S59406636xxxxx." Of course, it's too long for just a serial number of the product. Can anyone knock me what all this

  • Password no longer works to connect to the computer

    I lost the password on my computermain page * original title - my stoppedd of passwords workin for the home page I have not reset disk I just the disk that came with it? *

  • unble to print wireless hp photosmart 3310

    I'm trying to print wireless HP Photsmart 3310. Print job goes to the print queue, but does not print. When I check Windows printer and peripheral, it has a tick, saying that the printer is ready.  I've set up Wifi with precision which gives the corr

  • findChild with TextField gives error

    In my main.qml, I have a TextField with objectName: "mainMsgTxtFieldObj" Then in my applicationui.hpp file I have using the suite of codes #include ... private: bb::cascades::TextField *msgTextField; Finally, I try to access this TextField inside my