Skip navigation
Currently Being Moderated

Remove Character Format Override From Text Range

Dec 17, 2013 8:10 AM

Tags: #framemaker10 #extendscript #beginner #scripts

This should be simple, but I am wracking my brains trying to figure this out.


I simply want to take a text range and remove any character format override (CTRL-I or CTRL-O) and remove the override. I am thinking I need to create a special PropVal variable, but I am trying to figure out how to do this properly.




  • Currently Being Moderated
    Dec 17, 2013 8:27 AM   in reply to mdver



    If you simply want to remore all overrides (i.e. not change the current overrides to existing formats), there is a much simpler and faster method. To explain this, you need to know about the Import Formats function. Please open the command File > Import > Formats and look at the dialog. Select all the formats you want to remove the overrides for and select the option for "While Updating, Remove: Other Formats/Layout Overrides". The listbox "Import from Document" shows the current document by default, which is what you want to do. This effectively removes overrides without doing anything else (as the formats are overwritten by the formats from the same document, which changes nothing to them).


    Translated into ExtendScript code, this is what it looks like:


    var oDoc = app.ActiveDoc;

    oDoc.SimpleImportFormats ( oDoc, Constants.FF_UFF_FONT | Constants.FF_UFF_REMOVE_EXCEPTIONS );


    If you also want to remove paragraph format overrides, add Constants.FF_UFF_PGF. Make sure to use a single pipe ( | ) symbol to create a bitwise OR on the constants, as using a double pipe ( || ) is a logical OR and will leave you stunned.


    Kind regards



    Mark as:
  • Currently Being Moderated
    Dec 17, 2013 10:15 AM   in reply to mdver

    Hi Marc,


    It should really work via the menu if you use the Remove Overrides option, otherwise there may be a character format you do not know about (possibly applied via the EDD ?). If you cannot remove the overrides this way, it may not be possible to remove them by a script either.


    I do understand you want to do it range by range, though. Are you going to remove all character formats from the paragraphs or just remove the overrides while keeping the character formats that were applied?





    Mark as:
  • Currently Being Moderated
    Dec 18, 2013 10:05 AM   in reply to mdver

    OK, but with no EDD there is no reason that the character format overrides cannot be removed using the Import Formats function. But as you want to convert the overrides, that would not help you, anyway.


    If you can send me a sample document I will have a look at and see if I can create the script for you. It should not be too difficult. The main trick is in finding the sections with the overrides and there are several ways to do this. I don't trust the Find method all too much, so I would move from one paragraph to the next and use GetText to retrieve the sections with character overrides. Ones you have those, it is a walk in the park.


    Kind regards


    Jang (my mail adress is jang at jang dot nl)

    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