FontSize Object Members in SuiteScript Reference
The FontSize object in SuiteScript enables precise control over font styling in workbooks, including size and unit specifications.
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
- SuiteScript 2.1 Enhancements in NetSuite February Updates
SuiteScript 2.1 now supports async features and PATCH method. Discover the latest API and SuiteProcurement improvements.
- Scheduling Map/Reduce Script Deployments in NetSuite
Learn to schedule map/reduce script submissions, including one-time and recurring options in NetSuite.
- Binary File Support in N/https Module for SuiteScript
SuiteScript enhances capabilities with binary file support in the N/https module, allowing improved data handling in external communications.
- API Governance Units Calculation in NetSuite 2026.1
NetSuite 2026.1 introduces examples illustrating API governance unit calculations for both user event and scheduled scripts.
