Set tabs in Paragraph Style
Hi, i am creating paragraph Styles in JavaScript. I looked but found absolutely no info about setting tabs in a paragraph style.
Am i too tired? Can someone point me in the right direction please?
Thanks
Ben
I have made two InDesign scripts, one that deletes all TabStops from all ParagraphStyles of a Document and one that adds TabStops to all ParagraphStyles of a Document.
var oDoc = app.documents.item(0);
// First delete all tabstops
deleteTabStops(oDoc);
var iNumberOfTabsToAdd = 3;
var iTabDistance = 5;
// Then add tabstops
addTabStops(oDoc, iNumberOfTabsToAdd, iTabDistance);
function deleteTabStops(oDocument)
var iNumberOfParagraphStyles = oDocument.paragraphStyles.length;
for (var iParagraphStyleItem = 0; iParagraphStyleItem < iNumberOfParagraphStyles; iParagraphStyleItem++) {
var oParagraphStyle = oDoc.paragraphStyles.item(iParagraphStyleItem);
if (oParagraphStyle != null) {
var iNumberOfTabStops = parseInt(oParagraphStyle.tabStops.length);
if (iNumberOfTabStops > 0) {
var iLastTabStop = parseInt(iNumberOfTabStops - 1);
for (var iLastTabStopItem = iLastTabStop; iLastTabStopItem >= 0; iLastTabStopItem--) {
var oTabStop = oParagraphStyle.tabStops.item(iLastTabStopItem);
if (oTabStop != null) {
oTabStop.remove();
function addTabStops(oDocument, iNumberOfTabsToAdd, iTabDistance)
var iNumberOfParagraphStyles = oDocument.paragraphStyles.length;
for (var iParagraphStyleItem = 0; iParagraphStyleItem < iNumberOfParagraphStyles; iParagraphStyleItem++) {
var oParagraphStyle = oDoc.paragraphStyles.item(iParagraphStyleItem);
if (oParagraphStyle != null && iParagraphStyleItem > 0) {
for (iTabNumber = 1; iTabNumber <= iNumberOfTabsToAdd; iTabNumber++) {
var sPosition = parseInt(iTabDistance * iTabNumber) + 'mm';
var oTabStop = oParagraphStyle.tabStops.add();
oTabStop.alignment = TabStopAlignment.CENTER_ALIGN;
oTabStop.leader = '';
oTabStop.position = sPosition;
I hope this helps you further.
Similar Messages
-
Is it possible to set up a Paragraph Style leaving the Font Style field blank?
We often have to import text into InDesign from Word docs. We place the docs (Command-D, rather than copying and pasting) in order to preserve italics, bold text, etc. As it is now, we have to select all the text and set each element separately - leaving the Font Style field blank - in the Character Palette.
It would save a lot of time, if we could set up a Paragraph Style without specifying the Font Style, (leaving it blank), which overrides the formatting we are trying to preserve. Is this possible?The answer is "kind of". You can create the Paragraph Style you want to apply and select the paragraphs you want to apply it to - then right-click on the Paragraph Style and choose 'Apply "Body". Clear Character Styles.'
It is possible to do this as a Character Style if you click outside of a text area and create a new style. I do it all of the time as I import lots of Word documents to write to ePub (you have to define all of the styles to ensure the document looks right). Since the documents come in with small caps, bold, italics, different font sizes but the same font throughout.
So I have a style based on None with blank Font Size and Font Style which I apply to the whole document. If there is anything in these boxes you can just erase it by backspacing over the text. -
How to set composer to paragraph style
Hello to all,
i am trying to change the composer field value of each paragraph style as per user choice . But i am not getting the way to do this.
Can anyone knows the way of doing this?
- KannuThanks Peter.
But i don't want to set this field manually. i m trying like:
InterfacePtr<ITextAttributes>origAttrs(paraStyleUIDRef, IID_ITEXTATTRIBUTES);
const AttributeBossList* originalListofAttrs = origAttrs->GetBossList();
I also have the composer class id.
but still,
originalListofAttrs->ContainsAttribute(composerId[i]); // composerid : k2Vector<ClassID>
returns false.
will this originalListofAttrs contain the information about the composer used in the paragraph style?
Regards
Kannu -
Setting default paragraph style (InDesign CS4, AppleScript)
I'm trying to set the default paragraph style to [Basic Paragraph], but this produces an error.
Setting other styles does work, what's wrong with "[Basic Paragraph]"?
tell application "Adobe InDesign CS4"
tell active document
tell text defaults
set applied paragraph style to "[Basic Paragraph]"
end tell
end tell
end tell
Thanks,
PeterAlternatively you could use:
set applied character style of text defaults to character style 1
set applied paragraph style of text defaults to paragraph style 1
Cheers
Tobias -
Trouble with CS5 InDesign Paragraph Styles
I am creating a new template. I want one style to be "TOC Title", and another to be "TOC Level 1". All my concerns center around the Paragraph Style Options window (Type > Paragraph Styles > Create New Style >(double-click style to modify) )
1. No matter what I do, if I stipulate that "TOC Level 1" has leading (Tabs option, enter a "." or period in the Leader box), then InDesign does this for ALL my paragraph styles.
For the record, under the General option, my "Based On" box is set to "[No Paragraph Style]" for both paragraph styles.
So either I have to live with the TOC title having leading on it, or the TOC Level 1 having none, and in either case having to do something manually to the TOC everytime I use the template.
How can I fix this so that TOC Title has no Leader and TOC Level 1 has a Leader of "." ?
2. How can I set my TOC Title paragraph style so that it centers on the page?
Edit: Two days later and no reply - I would have gladly supplied more information if I did not make the issue clear enough, and I would have even appreciated a simple "Sorry, I don't know." Since it is highly improbable that nobody out there knows ANYTHING about Paragraph Style tabs in Adobe CS5 InDesign, I must conclude that my issue is simply not "in" enough to be considered worthy of attention from the unnamed scores of elitists which must run this forum.I think the only way I'm going to be able to understand the problem is to see a sample file. Please make a sample, even if it has nothing more than your style definitions that are failing, and post a link to it here.
-
Set tab position relative to column/table cell width?
I'm creating a form that, not surprisingly, has lots of "blanks" for users to fill out, many of them with $ signs preceding them, like so:
Mortgage $ _________________
Credit cards $ _______________
Loans $ ___________________
So the traditional nice way of doing this is to set a right tab at the right edge of the column with an underscore for a tab leader. I've set up a paragraph style with the tab set like this, so all I have to do is '$'-tab to fill the space.
But other sections of this form use multiple columns, something like:
Applicant 1 Applicant 2
Mortgage $ _______________ $ _______________
Credit cards $ _______________ $ _______________
Loans $ _______________ $ _______________
So I put these into tables.
Problem is, these columns are a different width than the others; and I have other widths throughout the document. I'd prefer not to have to create a new paragraph style for each column width. What I really need is a way to set a tab not at a fixed location but "at the right edge of the column" or something similar.
Is there a way to do this in InDesign?
Thanks.What you want is a "right indent" tab (Shift + Tab). These flaot with the column width, but becasue you don't set them in the tabs panel or the style definition, you can't easily apply a leader. You can however apply an underline to the tab itself, which a lot of us think is nicer, anyway. Use a character style to do that for efficiency (and you can do it in a nested style).
-
How do I stop ID from assigning a paragraph style to the TABLES?
In-Design is adding "H1" paragraph style to EVERY table is inserted, so the table headers formatting is affected by that H1 style.
I guess it chooses H1 because it's the FIRST style I created (and then modified the "basic paragraph" to modify the rest of default text).
It's like it's adding "Style_ID=1"
I tried placing the character in different places, to make sure it's not the style the cursor is in which is inherited, and no, no matter where I place the cursor, when I "insert table" the cursor is automatically placed into the first cell (header cell) and the paragraph "H1" is selected (and applied)
Adding a table with NO headers does the same, so it's not me that confused style names and applied some to the wrong place.
H1 is not used and table and cells styles are not based in it.
I don't know whether it's a bug, but IT FEELS like a bug.
How do I expect it to work?
I expect that by creating a table, NO style be applied other than the table's. (Not even the basic one)You might have set the default paragraph style for the document (which you set by selecting a paragraph style with no text frame selected) to your H1 paragraph style.
Make sure it's on "Basic paragraph" when you select the type tool.. -
[AS] How to change a paragraph style within any folder in Find Grep?
I want to change both text and paragraph style
I do that job very easily until I put paragraph styles in a folder
How to express the paragraph style "passage" within the folder "1st" in AppleScript?
In line 18 below, "1st:passage" may be wrong... so I've tried and search for an hour, but I can't get the answer..
sorry for bad english
my main()
on main()
mySnippet_test()
myTeardown()
end main
on mySnippet_test()
tell application "Adobe InDesign CS5.5"
set myDocument to document 1
set find grep preferences to nothing
set change grep preferences to nothing
set include footnotes of find change grep options to false
set include hidden layers of find change grep options to false
set include locked layers for find of find change grep options to false
set include locked stories for find of find change grep options to false
set include master pages of find change grep options to false
set find what of find grep preferences to "\\n"
set change to of change grep preferences to "\\r"
set applied paragraph style of change grep preferences to "1st:passage"
tell myDocument
change grep
end tell
--Clear the find/change preferences after the search.
set find grep preferences to nothing
set change grep preferences to nothing
end tell
end mySnippet_test
on myTeardown()
end myTeardownReplace the red line with… Replacing name strings to yours…
set myStyle to paragraph style "Style A" of paragraph style group "Style Group 1" of myDocument
set applied paragraph style of change grep preferences to myStyle -
Hi,
Is there anyway of using GREP (or some other magical wizardry) to create a paragraph style that automatically removes all spaces and forces words into lower case?
Strange request i know....I'm wanting to use it for datamerged email addresses.
Thanksso doing it through InDesign is a work around I'm exploring.
Excel has the 'LOWER' function and the ability to record macros for a quick find/replace on the spaces - so that's definitely a good option if it can't be solved purely in InDesign.
You can change case via scripting in InDesign. This AppleScript (OSX only) will set the case of the selected paragraph style to lower. It would be possible to add some code that would strip spaces as well:
tell application "Adobe InDesign CS6"
activate
set StyleList to name of every paragraph style of active document
set myDialog to make dialog with properties {name:"Document Paragraph Styles"}
tell myDialog
tell (make dialog column)
tell (make border panel)
tell (make dialog column)
make static text with properties {static label:"Choose a Style", min width:150}
end tell
tell (make dialog column)
set myPresetsDropdown to make dropdown with properties {string list:StyleList, selected index:0, min width:150}
end tell
end tell
end tell
end tell
set myResult to show myDialog
if myResult = true then
--+1 gets the correct name because list starts at 0
set myStyle to item ((selected index of myPresetsDropdown) + 1) of StyleList
else
return
end if
destroy myDialog
tell active document
set myStyle to paragraph style myStyle
repeat with j from 1 to (count stories)
repeat with i from 1 to (count paragraphs in story j)
if applied paragraph style of paragraph i of story j is myStyle then
--defines a variable to replace the generic this_text parameter in the handler
set SCText to the contents of paragraph i of story j
set contents of paragraph i of story j to my change_case_of(SCText)
end if
end repeat
end repeat
end tell
end tell
on change_case_of(this_text)
set the_comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set the_source_string to "abcdefghijklmnopqrstuvwxyz"
set the_new_text to ""
repeat with thisChar in this_text
set x to the offset of thisChar in the_comparison_string
if x is not 0 then
set the_new_text to (the_new_text & character x of the_source_string) as string
else
set the_new_text to (the_new_text & thisChar) as string
end if
end repeat
return the_new_text
end change_case_of -
Change paragraph style from X to Y in Pages Doc
Hi
Sorry for such a simple question, but I have looked through the Applescript manual and searched this forum and can't find a solution to my problem.
All I want to do is loop through the paragraphs of a Pages document and if the paragraph style is "Body Full", then change it to "Body Half". I have tried if statements repeat statements and everything I can think of but can't seem to get it to work. I can loop through all the paragraphs and change them to "Body Half", but as soon as I try to select only those whose paragraph style = "Body Full" it doesn't change any.
Here is an example of my attempt:
tell front document of application "Pages"
repeat with X from 1 to count (get paragraphs)
if paragraph style of paragraph X = "Body Full" then
set paragraph style of paragraph X to "Body Half"
end if
end repeat
end tell
If anyone could help I would be grateful. It's kind of embarrassing since I was a programmer for many years on mainframes and AS/400. Scripting is a new world to me.
Thanks in advance.
JimHello
Jim Kahler wrote:
I am also using iWorks 09. Now the indent level sets all paragraphs to the indent level of wherever the insertion point was when I ran the script.
? Still confused, it looks so easy!
Jim
Ok, i understand.
Here is the solution :
tell front document of application "Pages"
set sel to selection
set search_style to paragraph style "Body Full"
set new_style to paragraph style "Body Half"
repeat with X from 1 to count paragraphs
tell paragraph X to if its paragraph style = search_style then
select character 1
set Y to indent level
set its paragraph style to new_style
set indent level to Y
end if
end repeat
select sel
end tell -
IBook Author how do I add a paragraph style to TOC sections?
I am wanting to have secions with "Heading 1" paragragh style show up in my TOC. They show in Book outline view but not in Book Preview. I am using the plain book text template in portrait orientation.
Thanks
Russ--assumes existing paragraph ends with a return
set newText to "Me Either!" & return
tell application "Adobe InDesign CC"
tell document 1
set storyRef to parent story of text frame 1 of page 1
set paraStyle to paragraph style "New"
set insertRef to insertion point -1 of storyRef
set beginIndex to index of insertRef
tell insertRef
set contents to newText
end tell
set endIndex to beginIndex + (length of newText) - 1
set textRef to (a reference to characters beginIndex thru endIndex of storyRef)
set applied paragraph style of textRef to paraStyle
end tell
end tell -
Paragraph style unselects each time i hit enter
I'm batteling a really annoying problem with CS4. When I start typing in a new document, it defaults to the Basic Paragraph as it's supposed to. But EVERY time I hit enter, it defaults to the font selected in the toolbar and ignores the Basic Paragraph rules. How do I fix this?
Perhaps, for the Basic Paragraph style, the Next Style is set to [No Paragraph Style] rather than [Same style].
-
Following Paragraph Style Always Reverts to 'Same'
For my heading style, I set the Following Paragraph Style in the inspector to be 'body'. Then, next time I choose the heading style, the Following Paragraph Style has reverted to 'same'.
This is really frustrating. Is this a known bug, or is there any way to fix this?
TIAForget it. I see that you have to Update Style from Selection when you change the following paragraph style.
-
Problem applying Paragraph styles in CS4 InDesign
I boughtCS4 InDesign for Windows perhaps six months ago, and it worked fine with Windows XP. I have recently installed Windows 7 and find that the paragraph styles won't always work. Of ten when I try to use the shortcut for paragraph style the paragraph in question turns pink with small squares in it. If I undo the application of paragraph styles it goes back to text. I am using Times New Roman as the major font. However, I have tried other fonts and they won't work in paragraph style either.
I tried changing several pages of the manuscript to Times New Roman Special G1, but it won't do the commas, quotes, etc. (special characters).
Has anyone else had this problem? What can I do to fix this mess?
Thanks for any help.
Earl DavisWell, here's the situation now. But before describing it, let me thank Peter
Spier and Bob Levine who have endeavored to help me. Now, here's where we
are:
I copied a document over from Pagemaker into InDesign using Times New Roman
font. (I did the same for two other book manuscripts this past summer,
shortly after purchasing InDesign and had no problem). Suddenly a couple
weeks ago I found that the shortcut I set for the paragraph styles did not
format the paragraphs, etc., but rather turned the paragraph in which I
placed the cursor into a series of pink squares highlighted in pink. I have
tried the suggestions you fellows have given, such as copying the fonts
presently in the Windows Font Directory into the Adobe/InDesign/Fonts
directory, and then right-clicking on them and installing them. By the way,
the InDesign font directory only had the Times New Roman and Times New Roman
Special 1 and Renaissance font in it, until I copied all my fonts there and
installed them. Another oddity, I make the first letter of the first
paragraph of each chapter a decorative Renaissance font, spanning two lines.
I now find that when I do that, I may get a black square, which may turn
into the correct font after I adjust the size to two lines.
But on the general problem, I have tried changing the font in the
paragraph styles to Amerigo BT, and I sometimes get the shortcut to work,
and sometimes it still turns it into Times New Roman Special or black
squares. Also, I have opened a new file and put another copy of the text in
it, setting up the paragraph styles, etc. and still have the same problem.
So I'm at a loss what to do. I do think it's possible I am doing
something wrong with fonts or setting up the paragraph styles, but I don't
see any errors there. All my computer fonts show up in the fonts panel of
the document. Any more ideas? -
Trouble Linking TOC Paragraph Styles from a Word 2010 Document to a RoboHelp HTML Project
I apologize if this question has been answered elsewhere. I did my best to search the forums and the web, but I haven't seen anything that helps resolve the issue I'm having yet. I am new to RoboHelp 9. I am using Word 2010 and Windows 7.
I am working on creating a WebHelp that is linked to a Word 2010 document. For the most part, I have had no trouble with the linked document, but something seems to be wrong with the styles and formatting for the TOC paragraph styles that I created in the Word document: the formatting does not apply to the topics in RoboHelp. All of the other paragraph styles (Heading 1-4, Body Text, etc.) are working perfectly. The problem seems to apply ony to text using the paragraph styles TOC 1-4.
The TOC in the Word document looks like this:
The topic containing that TOC in the RoboHelp project looks like this:
In the Word document, the entries for 1. Introduction, 2. Punctuation, and 3. Numbers are all all set to the paragraph style TOC 1. The entries for Purpose, Audiance and Applicability, Scope and Other References, etc. are all set to the paragraph style TOC 2. Both of these paragraph styles contain formatting for font and indentations, and they also appear in the RoboHelp project's .CSS file as WD_TOC 1 and WD_TOC 2.
The problem, as far as I can tell, is that the TOC 1, TOC 2, and TOC 3 styles do not appear to be applied to the text in the topic.
I could resolve the issue by highlighting the text I'd like to apply the style to and applying the appropriate style using the Styles and Formatting pod, but then every time I update the Word document, the text would revert.
Does anyone have any suggestions?
Please let me know if anything is unclear or if I need to provide additional information.
Thank you!
RachelThanks for your response, Peter. I do understand that what I'm trying to do is not standard--and probably not best practice for WebHelp. I am following instructions to make the WebHelp function like the website we are using as a model, which features a TOC for each chapter as a separate page. So I understand that what I'm doing is essentially pounding a square peg into a round hole, but it seems like it should work as long as RoboHelp can pick up the right paragraph styles.
I can eliminate the page numbers pretty easily by choosing to use hyperlinks instead of page numbers in web output (this is an option in Word 2010), but the Hyperlink style is a character style that overlays the paragraph styles TOC 1, TOC 2, etc and suppresses page numbers. While the Hyperlink character style translates with no problem to RoboHelp, those underlying paragraph styles are still not linking up quite right. For the sake of trying to simplify things and address the real problem, I temporarily removed the hyperlinks (thereby including the page numbers) in order to straighten things out. Thank you for pointing out the apparent oversight, though!
What's confusing about the problem is that WD_TOC 1 and WD_TOC 2 are already defined--they just aren't being applied. I can apply them manually, but as soon as I do, the status indicator in the Project Manager pod changes to the yellow triangle with an exclamation point (), indicating that the project is out of sync. As soon as I update the topics, those TOCs revert to having no paragraph styles at all. Does that make sense?
Thanks again for your help!
Maybe you are looking for
-
I did the update On both my iPad and my phone and the phone is working just fine but my iPad is being complicated. Haha can someone pleases please please help me!!!!!!
-
What is the last resort if Adobe DNG PE still does not allow to increase WB adjustment range ?
what is the last resort if even Adobe DNG Profile Editor still does not allow to increase WB adjustment range sufficiently (through modified .dcp profile) ? the raw file in question = https://app.box.com/s/yyd43xq29cdsu2mvyp5w thx.
-
OSX Install DVD keeps ejecting
Hello, I have a 15" MacBook Pro purchased in June 2007. I am trying to format and reinstall all software and OS from the backup DVDs provided. When I put the DVD in the drive, it spins for about 15 seconds and then ejects. I've tested multiple CDs an
-
Patterns for attribute in a schema?
How do you set the patterns value for an attribute in a schema file?
-
What is the problem? When I am on my mac after a while screen will go blank , and the on light will start to blink so I move my mouse and clink the mouse also to try to get my screen back on but it doesn't respond? Sometimes I have to turn it off and