FontSize Object Members in SuiteScript Reference
FontSize object enables precise control over font size and unit specifications in SuiteScript workbooks.
The FontSize object provides developers with properties to manage font sizes in workbook scripts effectively. This object enables precise specification of font dimensions, which is essential for creating well-formatted documents and reports.
What is the FontSize Object?
The FontSize object is utilized within the workbook.createStyle(options) method. It allows developers to define font specifications for workbook styles dynamically.
Available Members of the FontSize Object
The members of the FontSize object include:
| Member Name | Type | Description | Supported Script Types |
|---|---|---|---|
| FontSize.size | number | Numeric size of the font | Server scripts |
| FontSize.unit | string | Unit of the font size | Server scripts |
How to Use the FontSize Object
Developers can create a FontSize object using the following syntax:
var myFontSize = workbook.createFontSize({ // myFontSize is a workbook.FontSize size: 12, unit: workbook.UNIT.PX});This example initializes the font size as 12 pixels, allowing for flexibility in document design. Ensure that the size is a number to avoid the WRONG_PARAMETER_TYPE error.
Additional Code Example
Here’s how to use the FontSize object in conjunction with other style properties:
var mySecondStyle = workbook.createStyle({ fontSize: workbook.FontSize.LARGE, fontStyle: workbook.FontStyle.ITALIC, fontWeight: workbook.FontWeight.BOLD});Best Practices
Important: Always ensure the numeric values are valid to prevent runtime errors. Also, review the expected units when defining font sizes as dealing with different units can impact document rendering.
Conclusion
By utilizing the FontSize object, users can enhance their workbook styling capabilities effectively, allowing for greater control over how information is presented visually.
Key Takeaways
- The FontSize object allows for customizable font properties in SuiteScript.
- Key members include size and unit, both of which are essential for precise styling.
- Use the workbook.createFontSize() function to create FontSize objects efficiently.
Frequently Asked Questions (4)
How do I initialize a FontSize object in SuiteScript?
What script types support the FontSize object's members?
What error might occur if I use an incorrect data type for the size property in FontSize?
Can the FontSize object be used with other style properties in a workbook?
Was this article helpful?
More in SuiteScript
- Common SuiteScript Errors and Solutions for NetSuite
Common NetSuite script errors include INVALID_SCRIPT_DEPLOYMENT_ID and SSS_AUTHORIZATION_HEADER_NOT_ALLOWED. Learn effective solutions.
- Setting Field Values in SuiteScript for Effective Record
Learn to set field values in SuiteScript effectively, troubleshooting common errors and understanding data types.
- SuiteScript 2.1 Enhancements and API Updates in NetSuite
SuiteScript 2.1 enables execution of 2.0 scripts and supports PATCH method for enhanced API capabilities.
- Enhancements to SuiteScript User Role Context Clarification
SuiteScript updates clarify the user and role contexts for script executions, improving deployment understanding and management.
Advertising
Reach SuiteScript Professionals
Put your product in front of NetSuite experts who work with SuiteScript every day.
Sponsor This Category