• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Javascript - retrieving style info from Page Label

Explorer ,
Aug 28, 2022 Aug 28, 2022

Copy link to clipboard

Copied

I'm still fairly new to javascript and I was hoping someone could assist with a dilemma I'm having.  I'm trying to create a script that can retrieve the Page Label of a page, check if it's using the roman numeral style and if so, skip that page and check the next page until it finds a non-roman numeral page.  Once roman numerals are no longer applied, it will start paginating from that page onward until the end of the document.  I was able to get the Page Label by using the following code, where i is an incrementing variable:

getPageLabel(i);

This of course will just report back the Page Label of the current page it's on.  I can create "if" statements for the first 10 roman numerals but that seems inefficient.  Is there a way to extract the style applied to the page so that if it's set to "R" or "r" (roman numberal style according to reference guide), it will skip that page?  I tried getPageLabel(i).cStyle and getPageLabel(i).aLabel but they come back as undefined in the console.  Any help would be appreciated, thanks.

 

TOPICS
How to , JavaScript

Views

173

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

This properties are not available.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 30, 2022 Aug 30, 2022

Copy link to clipboard

Copied

LATEST

We can't access this property but we can test the value of the Page Label with a GREP regex, for example (not tested):

 

var str1 = this.getPageLabel(i);
if (str1.match(/(?<=^)M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})(?=$)/) == null) {// script for not roman numeral}
else {// script for roman numeral}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines