2 Replies Latest reply on Nov 12, 2012 10:03 AM by frameexpert

    Apply Condition to paragraph's content

    frameexpert Level 4

      Hi,

       

      I want to apply a condition to a paragraph. In some instances, I only want to apply the condition up to the paragraph's return, but not include the return. Here is a function that works for entire paragraphs, but I am not sure what to use when I want to leave the return unconditional. Any help would be appreciated.

       

      function applyCondition (pgf, condName, includeReturn, doc) {
          
          condName = String(condName);
          var condFmt = doc.conditions.itemByName(condName) ;
          if (condFmt.isValid === false) {
              // If the condition does not exist, create it.
              doc.conditions.add ({name: condName});
          }
      
          // Make sure the condition is visible.
          condFmt.visible = true;
          
          if (includeReturn === true) {
              // Apply the condition to the entire paragraph.
              pgf.applyConditions (condFmt, true);
          } else {
              // Apply the condition to the paragraph up to the return.
          }
      }
      

       

      Rick