FontSize Object Members in SuiteScript Reference

The FontSize object in SuiteScript enables precise control over font styling in workbooks, including size and unit specifications.

·2 min read·View Oracle Docs

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 NameTypeDescriptionSupported Script Types
FontSize.sizenumberNumeric size of the fontServer scripts
FontSize.unitstringUnit of the font sizeServer scripts

How to Use the FontSize Object

Developers can create a FontSize object using the following syntax:

suitescript
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:

suitescript
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.

Source: This article is based on Oracle's official NetSuite documentation.

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?
You can initialize a FontSize object using the workbook.createFontSize() method. You specify the size as a number and the unit, such as pixels, using workbook.UNIT.PX.
What script types support the FontSize object's members?
The FontSize object's members, like size and unit, are supported in server scripts.
What error might occur if I use an incorrect data type for the size property in FontSize?
If the size is not a number, you may encounter a WRONG_PARAMETER_TYPE error during runtime.
Can the FontSize object be used with other style properties in a workbook?
Yes, the FontSize object can be used in conjunction with other style properties like fontStyle and fontWeight within the workbook.createStyle() method.
Source: FontSize Object Members Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →