Copy link to clipboard
Copied
Hi is there any way to identify that paragraph style is an override or not using indesign sdk?
Thanks in advance.
Hi @Jethika27555372y6gg ,
Using InDesign SDK, You can use the following code snippet to check whether para style is overridden for the underlying text or not -
InterfacePtr<IAttributeStrand> iParaAttributeStrand(((IAttributeStrand*)iTextModel->QueryStrand(kParaAttrStrandBoss, IAttributeStrand::kDefaultIID)));
DataWrapper<AttributeBossList> paraStyleAttrListOverrides = iParaAttributeStrand->GetLocalOverrides(startIndex, ¶StyleOverrideLength, &outStartIndex);
if(paraStyleAttrListOverri
...You need to know the boss class of the attribute that you want to fetch. For that you need to search InDesign SDK or use InDesign debug build.
Also, internal attribute boss names might differ what is shown in the UI. It won't be exactly the same.
Refer the below code -
InterfacePtr<ITextAttrBreakBeforeMode> iTextAttrBreakBeforeMode((ITextAttrBreakBeforeMode*)paraStyleAttrListOverrides->QueryByClassID(kTextAttrGotoNextXBoss, IID_ITEXTATTRBREAKBEFOREMODE));
if(!iTextAttrBreakBeforeMode)
brea
...Copy link to clipboard
Copied
You can identify type which has an override of a paragraph style by using the Style Override Highlighter icon at the upper right of the Paragraph Styles panel:
Copy link to clipboard
Copied
The following method seems to work with a textStyleRange (but I'm having trouble getting it to work consistently for a paragraph).
textHasOverrides (charOrParaStyle:StyleType, [charStyleAsOverride:Boolean=Boolean])
charOrParaStyle: StyleType.CHARACTER_STYLE_TYPE or StyleType.PARAGRAPH_STYLE_TYPE
Style type to look at.
charStyleAsOverride: Boolean
Whether to consider character styles as overrides or not (Optional)
(default: true)
Copy link to clipboard
Copied
Hi @Jethika27555372y6gg , As @danaken3 suggests you would have to check the story’s text ranges—at least with JavaScript. If you check the paragraph with JS, it would only return true if the entire paragraph is overriden. So here I have 3 paragraphs with one word overridden:
This loop through textStyleRanges returns false, true, false:
var dp = app.documents[0].stories.everyItem().textStyleRanges.everyItem().getElements();
for (var i = 0; i < dp.length; i++){
$.writeln(dp[i].textHasOverrides(StyleType.PARAGRAPH_STYLE_TYPE))
//returns false, true, false
};
But this loop through paragraphs returns false, false, false because only one word in paragraph 2 is overridden
var dp = app.documents[0].stories.everyItem().paragraphs.everyItem().getElements();
for (var i = 0; i < dp.length; i++){
$.writeln(dp[i].textHasOverrides(StyleType.PARAGRAPH_STYLE_TYPE))
//returns false, false, false
};
Copy link to clipboard
Copied
There is no "textHasOverrides" in VB6?? Will have to use DoScript().
Is there any way - from JS - to get what exactly is different?
Copy link to clipboard
Copied
Hi @Jethika27555372y6gg ,
Using InDesign SDK, You can use the following code snippet to check whether para style is overridden for the underlying text or not -
InterfacePtr<IAttributeStrand> iParaAttributeStrand(((IAttributeStrand*)iTextModel->QueryStrand(kParaAttrStrandBoss, IAttributeStrand::kDefaultIID)));
DataWrapper<AttributeBossList> paraStyleAttrListOverrides = iParaAttributeStrand->GetLocalOverrides(startIndex, ¶StyleOverrideLength, &outStartIndex);
if(paraStyleAttrListOverrides->CountBosses() == 0)
CAlert::InformationAlert("There are no para overrides");
else
CAlert::InformationAlert("para style is overridden")
To get the which parastyle is overridden you can use iParaAttributeStrand->GetStyleUID()
- Rahul Rastogi
InDesign SDK C++ Custom Plugin Architect
Copy link to clipboard
Copied
Thank you @Rahul_Rastogi this method works.
Copy link to clipboard
Copied
Hi @Rahul_Rastogi there is one antoher question lets say i override a paragraph using keep option ->In Next Column
is there any way to get this next column attribute as a string variable
Copy link to clipboard
Copied
You need to know the boss class of the attribute that you want to fetch. For that you need to search InDesign SDK or use InDesign debug build.
Also, internal attribute boss names might differ what is shown in the UI. It won't be exactly the same.
Refer the below code -
InterfacePtr<ITextAttrBreakBeforeMode> iTextAttrBreakBeforeMode((ITextAttrBreakBeforeMode*)paraStyleAttrListOverrides->QueryByClassID(kTextAttrGotoNextXBoss, IID_ITEXTATTRBREAKBEFOREMODE));
if(!iTextAttrBreakBeforeMode)
break;
if(iTextAttrBreakBeforeMode->Get() == Text::kAtColumn)
CAlert::InformationAlert("At next column");
// As per InDesign SDK for possible values of break mode -
kNoForcedBreak
kStartAnywhere
kAtColumn
kAtPage
kAtFrameBox
kAtOddPage
kAtEvenPage
- Rahul Rastogi
InDesign SDK C++ Custom Plugin Architect