Angular Using Workbooks

    The Infragistics Angular Excel Engine enables you to save data to and load data from Microsoft® Excel®. You can create workbooks and worksheets, input data, and export the data to Excel using the library’s various classes. The Infragistics Angular Excel Engine makes it easy to export the data in your application as an Excel spreadsheet as well as import data from Excel into your application.

    Angular Using Workbooks Example

    Change Default Font

    First create a new instance of IWorkbookFont. Next, add the new font to the styles collection of the Workbook. This style contains the default properties for all cells in the workbook, unless otherwise specified on a row, column, or cell. Changing properties of the style will change the default cell format properties in the workbook.

    var workbook = new Workbook();
    var font: IWorkbookFont;
    font = workbook.styles().normalStyle.styleFormat.font; = "Times New Roman";
    font.height = 16 * 20;

    Setting Workbook Properties

    Microsoft Excel® document properties provide information to help organize and keep track of your documents. You can use the Infragistics Angular Excel Library to set these properties using the Workbook object’s documentProperties property. The available properties are:

    • Author

    • Title

    • Subject

    • Keywords

    • Category

    • Status

    • Comments

    • Company

    • Manager

    The following code demonstrates how to create a workbook and set its title and status document properties.

    var workbook = new Workbook();
    workbook.documentProperties.title = "Expense Report";
    workbook.documentProperties.status = "Complete";

    Workbook Protection

    The workbook protection feature allows you to protect the structure of the workbook. That is, the ability for a user to add, rename, delete, hide, and reorder the worksheets in that workbook.

    The protection is not enforced via the Infragistics Excel Engine's object model. It is a responsibility of the UI visualizing this object model to honor these protection settings and allow or restrict the user from performing the corresponding operations.

    Protection is applied to a workbook by invoking its protect method.

    When a Workbook is protected without a password, the end user may unprotect the Workbook in Excel without having to supply a password. To programmatically unprotect a Workbook, one may use the unprotect method.

    When a Workbook is protected, the values of the properties of the WorkbookProtection instance from this Workbook's protection property indicate the disabled operations.

    If isProtected is already true, the protect method will be ignored.

    var workbook = new Workbook();
    workbook.protect(false, false);

    Check if a workbook has protection. This read-only property returns true if the workbook has any protection set using the overloads of the Protect method.

    var workbook = new Workbook();
    var protect = workbook.isProtected;

    This read-only property returns an object of type WorkbookProtection which contains properties for obtaining each protection setting individually.

    var workbook = new Workbook();
    var protection =;

    API References