Copy link to clipboard
Copied
Hi,
When i used the below code to override master page items, textframe gets override but the position of the textframe gets changed.
I need to override the textframe without changing the position of the textframe (master page items). When we do that in manual there is no change in their position but when do that using code its getting change. I dont know the reason.
Why its getting change?? How to do that without changing the position???
Code :
overrideMaster()
function overrideMaster()
{
var allPgs = app.activeDocument.pages;
for(var pCnt = 0; pCnt < allPgs.length; pCnt++)
{
var pg = allPgs[pCnt];
var masItms = pg.masterPageItems;
for(var miCnt = masItms.length-1;miCnt >= 0;miCnt--){
//try{
masItms[miCnt].override(pg);
//}catch(e){}
}//for
}
}//fun
Copy link to clipboard
Copied
Be more specific what exactly you want to do?
Your question is a bit unclear!
Copy link to clipboard
Copied
I want to do override master page items of pages. When doing this, textframe position is get changed. But when we do it manually its not changing.
Without changing the position how to override the master page items?? Pls see screenshot... I have placed before and after of the process... Using code....
Copy link to clipboard
Copied
Hi Sudha,
could be a bug. To work around this you could move the overridden page items to their original places.
I think, we already discussed this bug here in the forums. So search the InDesign Scripting forum.
Regards,
Uwe
Copy link to clipboard
Copied
Also see into the menu action for overriding master page items:
Indiscripts :: InDesign Scripting Forum Roundup #4
Ah, and finally found this:
Override elements by script problems
( Forum search is very lazy today… )
Regards,
Uwe
Copy link to clipboard
Copied
Hi,
Thank you for the links...
I searched in forum but i got the same kind of code which i used..
I have used the menu action for all pages of document. Now position is not change but its get overset if the near by objects have wrap option so its get overset.
Actually i thought to capture the object after overridden and clear the overset but override method overrides the master page item and return it as new object. so i couldnot able to capture the overridden object and can't proceed that.
How to clear overset of the overridden object when it nearby objects have wrap??
Can anyone suggest how to proceed this??
Copy link to clipboard
Copied
Hi Sudha,
regarding moving overridden objects to their original position I gave you a link to a thread that exactly handles this.
In the same thread I suggested some code to correct this:
Re: Override elements by script problems
To solve your other problem with text wrap see into:
textFrame.textFramePreferences.ignoreWrap
Set that to true.
Regards,
Uwe
Copy link to clipboard
Copied
Hi,
I had tested the override code for pages using menu active.
app.menuActions.itemByName('$ID/Override All Master Page Items').invoke();
I feel it was working fine but the textframe got overset. I tried to capture those (overriden textframe) to apply text wrap but i could not able to capture. So finally I set the text wrap to the textframe (master page item) as manual.
I would be helpful if i capture the textframe or object after overriden master page items...