EaxDocument.checkSheetName

Syntax

checkSheetName(newSheetName);

Parameters

newSheetName. New name of the express report document sheet.

Description

The checkSheetName method checks if the name of the express report document sheet is correct.

Comments

The method returns False if express report name is invalid: that is, it is empty or matches name of an already available sheet. Otherwise the method returns True.

Criteria of sheet name invalidity are defined by elements of the PP.Exp.EaxDocument.SheetNameError enumeration.

Example

Executing the example requires that the HTML page contains the ExpressBox component named expressBox (see Example of Creating the ExpressBox Component). Rename the active sheet of the express report document, and check if the new sheet name is correct:

// Get  express report document
var eaxDocument = expressBox.getSource();
var sheetName = "!123";
var result = eaxDocument.checkSheetName(sheetName);
if (result) {
    // Get active sheet    
    var sheet = eaxDocument.getActiveSheet();
    // Rename document sheet
    var sheets = eaxDocument.getDocumentMetadata().sheets.its.it;
    for (var i = 0; i < sheets.length; i++) {        
        if (sheets[i].k == sheet.getKey()) {
            sheets[i].n = sheetName;       
        }
    }
    console.log("New name of express report sheet: " + eaxDocument.getSheetName(sheet.getKey()));
} else {
    console.log("Sheet name is incorrect. The sheet will not be renamed.");
}
// Refresh the express report to seereshed sheet name 
expressBox.refreshAll();

After executing the example active sheet of the express report document is renamed:

The new sheet name is displayed in the browser console:

New name of the express report sheet: !123

See also:

EaxDocument