---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Cell - Scoped, Global

# Cell - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 11 minutes to read

Creates a Cell object as a cell in a table. You can use this API to format the cell and include additional blocks, such as paragraphs and images.

This API is part of the ServiceNow PDF
Generation Utilities plugin (com.snc.apppdfgenerator) and is provided within the
`sn_pdfgeneratorutils` namespace. The plugin is activated by default.

This API is a component used with the [Document API](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") to generate a
PDF.

## Cell - Cell(Number rowspan, Number colspan) {#ariaid-title2}

Instantiates a new Cell object. Creates a cell which takes a custom
amount of cell spaces in the table.
Note:  
If you provide a negative number for either parameter, the value sets to 1.
{#Cell-Cell_N_N__table_twm_hjk_34b__entry__3}

| Name | Type | Description |
|-|-|-|
| rowspan | Number | Number of rows this cell is to occupy. Default: 0 |
| colspan | Number | Number of columns this cell is to occupy. Default: 0 |
[Table 1. Parameters]

{#Cell-Cell_N_N__table_twm_hjk_34b}  
The following example shows how to create a Cell object spanning a
single row and single column.

    var cell = new sn_pdfgeneratorutils.Cell(1, 1);

## Cell -- addImage(Image image) {#ariaid-title3}

Adds an image to a table cell.
{#Cell-addImage_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| image | [Image](https://servicenow-prod.fluidtopics.net/ulntT09aQ0TR~gRUuuS2Eg#ImageBothAPI "Creates an Image object representing an image and its layout insert in a PDF. Enables defining attributes such as scale, alignment, and border color.") | Image to add to a table cell. |
[Table 2. Parameters]

{#Cell-addImage_O__table_vv5_52h_44b} {#Cell-addImage_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 3. Returns]

{#Cell-addImage_O__table_wv5_52h_44b}  
The following example shows how to instantiate an existing image attachment and add it to a
cell in a table. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 1);

    var image = new Image("<attachment_sys_id>");

    cell.addImage(image);

## Cell -- addParagraph(Paragraph paragraph) {#ariaid-title4}

Adds text to a table cell.
{#Cell-addParagraph_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| paragraph | [Paragraph](https://servicenow-prod.fluidtopics.net/F66I_9eaQar0UBmo_g7irw#ParagraphBothAPI "Creates a Paragraph object representing a block of text in a PDF.") | Text to add to a table cell. |
[Table 4. Parameters]

{#Cell-addParagraph_O__table_vv5_52h_44b} {#Cell-addParagraph_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 5. Returns]

{#Cell-addParagraph_O__table_wv5_52h_44b}  
The following example shows how to instantiate paragraph objects and add the content cells
in a table. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);
    var para = new sn_pdfgeneratorutils.Paragraph("Paragraph text.");
    cell.addParagraph(para);

## Cell -- addStyle(Style style) {#ariaid-title5}

Applies a predefined style to table cells.
{#Cell-addStyle_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| style | [Style](https://servicenow-prod.fluidtopics.net/EJ1CwYDsf~Ytpinx1B9fbg#StyleBothAPI "Creates a style for defining properties such font size, border, and alignment. You can apply the same style to multiple objects simultaneously.") | Style to apply to this element. |
[Table 6. Parameters]

{#Cell-addStyle_O__table_vv5_52h_44b} {#Cell-addStyle_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 7. Returns]

{#Cell-addStyle_O__table_wv5_52h_44b}  
The following example shows how to apply a style to a table cell. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);
    var style = new sn_pdfgeneratorutils.Style();
    style.setBold();
         
    cell.addStyle(style);

## Cell -- addTable(Table table) {#ariaid-title6}

Adds a table to a cell.
{#Cell-addTable_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| table | [Table](https://servicenow-prod.fluidtopics.net/IaWzvxiBPOHtuTwBsfUUOg#TableBothAPI "Creates a Table object to add to a PDF document. Defines the data to use in each cell and sets styles, margins, and alignment.") | Table to add to a cell. |
[Table 8. Parameters]

{#Cell-addTable_O__table_vv5_52h_44b} {#Cell-addTable_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 9. Returns]

{#Cell-addTable_O__table_wv5_52h_44b}  
The following example shows how to instantiate a table object and add it to a cell. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 1);

    var columnWidths = [100, 50, 50];

    var table = new Table(columnWidths, false);

    cell.addTable(table);

## Cell -- getColumn() {#ariaid-title7}

Gets the number of the column in which the cell is located.
{#Cell-getColumn__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 10. Parameters]

{#Cell-getColumn__table_vv5_52h_44b} {#Cell-getColumn__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| Number | Number of the column position for a cell. |
[Table 11. Returns]

{#Cell-getColumn__table_wv5_52h_44b}  
The following example shows how to get the number of a column position for a cell.

    var cell = new sn_pdfgeneratorutils.Cell(1, 1);

    var columnWidths = [100, 50, 50];

    var table = new sn_pdfgeneratorutils.Table(true, columnWidths, false);

    table.addCell(cell);

    var colNum = cell.getColumn();

    gs.info("The column position for cell is " + colNum);

Output:

    The column position for cell is 1

## Cell -- getRow() {#ariaid-title8}

Gets the number of rows in which the cell is located.
{#Cell-getRow__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 12. Parameters]

{#Cell-getRow__table_vv5_52h_44b} {#Cell-getRow__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| Number | Number of the row position for a cell. |
[Table 13. Returns]

{#Cell-getRow__table_wv5_52h_44b}  
The following example shows how to get the number of a row position for a cell.

    var cell = new sn_pdfgeneratorutils.Cell(1, 1);

    var rowWidths = [100, 50, 50];

    var table = new sn_pdfgeneratorutils.Table(true, rowWidths, false);

    table.addCell(cell);

    var rowNum = cell.getRow();

    gs.info("The row position for cell is " + rowNum);

Output:

    The row position for cell is 4927

## Cell -- setBackGroundColor(Color color) {#ariaid-title9}

Specifies a background color for the cell.
{#Cell-setBackGroundColor_O__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Background color. |
[Table 14. Parameters]

{#Cell-setBackGroundColor_O__table_vv5_52h_44b} {#Cell-setBackGroundColor_O__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 15. Returns]

{#Cell-setBackGroundColor_O__table_wv5_52h_44b}  
The following example shows how to set cell background color. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var color = new sn_pdfgeneratorutils.Color([1, 0.9, 0.9]); // provided as array of RGB float values

    cell.setBackGroundColor(color);

## Cell -- setBorder(Number width) {#ariaid-title10}

Sets a border for all four edges of a cell.
{#Cell-setBorder_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Cell border width in points. |
[Table 16. Parameters]

{#Cell-setBorder_N__table_vv5_52h_44b} {#Cell-setBorder_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 17. Returns]

{#Cell-setBorder_N__table_wv5_52h_44b}  
The following example shows how to set a cell border of one point to all four edges of a
cell. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 1.0;

    cell.setBorder(width);

## Cell -- setBorderBottom(Number width) {#ariaid-title11}

Sets a border for the lower limit of a cell.
{#Cell-setBorderBottom_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Cell border width in points. |
[Table 18. Parameters]

{#Cell-setBorderBottom_N__table_vv5_52h_44b} {#Cell-setBorderBottom_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 19. Returns]

{#Cell-setBorderBottom_N__table_wv5_52h_44b}  
The following example shows how to set a cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 1.0;

    cell.setBorder(width);

## Cell -- setBorderLeft(Number width) {#ariaid-title12}

Sets a border for the left limit of a cell.
{#Cell-setBorderLeft_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Cell border width in points. |
[Table 20. Parameters]

{#Cell-setBorderLeft_N__table_vv5_52h_44b} {#Cell-setBorderLeft_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 21. Returns]

{#Cell-setBorderLeft_N__table_wv5_52h_44b}  
The following example shows how set a left-side cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 1.0;

    cell.setLeftBorder(width);

## Cell -- setBorderRight(Number width) {#ariaid-title13}

Sets a border for the right limit of a cell.
{#Cell-setBorderRight_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Cell border width in points. |
[Table 22. Parameters]

{#Cell-setBorderRight_N__table_vv5_52h_44b} {#Cell-setBorderRight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 23. Returns]

{#Cell-setBorderRight_N__table_wv5_52h_44b}  
The following example shows how to set a right-side cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 1.0;

    cell.setRightBorder(width);

## Cell -- setBorderTop(Number width) {#ariaid-title14}

Sets a border for the upper limit of a cell.
{#Cell-setBorderTop_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| width | Number | Cell border width in points. |
[Table 24. Parameters]

{#Cell-setBorderTop_N__table_vv5_52h_44b} {#Cell-setBorderTop_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 25. Returns]

{#Cell-setBorderTop_N__table_wv5_52h_44b}  
The following example shows how to set a top cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 1.0;

    cell.setBorderTop(width);

## Cell -- setColoredBorder(Color color, Number width) {#ariaid-title15}

Sets a colored border for all four edges of a cell.
{#Cell-setColoredBorder_O_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Cell border color. |
| width | Number | Cell border width in points. |
[Table 26. Parameters]

{#Cell-setColoredBorder_O_N__table_vv5_52h_44b} {#Cell-setColoredBorder_O_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 27. Returns]

{#Cell-setColoredBorder_O_N__table_wv5_52h_44b}  
The following example shows how to set a colored cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var width = 1.0;

    cell.setColoredBorder(borderColor, width);

## Cell -- setColoredBorderBottom(Color color, Number width) {#ariaid-title16}

Sets a colored border for the lower limit of a cell.
{#Cell-setColoredBorderBottom_O_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Cell border color. |
| width | Number | Cell border width in points. |
[Table 28. Parameters]

{#Cell-setColoredBorderBottom_O_N__table_vv5_52h_44b} {#Cell-setColoredBorderBottom_O_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 29. Returns]

{#Cell-setColoredBorderBottom_O_N__table_wv5_52h_44b}  
The following example shows how to set a colored lower cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var width = 1.0;

    cell.setColoredBorderBottom(borderColor, width);

## Cell -- setColoredBorderLeft(Color color, Number width) {#ariaid-title17}

Sets a colored border for the left limit of a cell.
{#Cell-setColoredBorderLeft_O_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Cell border color. |
| width | Number | Cell border width in points. |
[Table 30. Parameters]

{#Cell-setColoredBorderLeft_O_N__table_vv5_52h_44b} {#Cell-setColoredBorderLeft_O_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 31. Returns]

{#Cell-setColoredBorderLeft_O_N__table_wv5_52h_44b}  
The following example shows how to set a colored left cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var width = 1.0;

    cell.setColoredBorderLeft(borderColor, width);

## Cell -- setColoredBorderRight(Color color, Number width) {#ariaid-title18}

Sets a colored border for the right limit of a cell.
{#Cell-setColoredBorderRight_O_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Cell border color. |
| width | Number | Cell border width in points. |
[Table 32. Parameters]

{#Cell-setColoredBorderRight_O_N__table_vv5_52h_44b} {#Cell-setColoredBorderRight_O_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 33. Returns]

{#Cell-setColoredBorderRight_O_N__table_wv5_52h_44b}  
The following example shows how to set a colored right cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var width = 1.0;

    cell.setColoredBorderRight(borderColor, width);

## Cell -- setColoredBorderTop(Color color, Number width) {#ariaid-title19}

Sets a colored border for the upper limit of a cell.
{#Cell-setColoredBorderTop_O_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| color | [Color](https://servicenow-prod.fluidtopics.net/0EiXfws~5CY1d9dHdAL1UQ#ColorBothAPI "Creates a Color object used to define color attributes that you can apply to elements in a PDF; such as cells, tables, and lines.") | Cell border color. |
| width | Number | Cell border width in points. |
[Table 34. Parameters]

{#Cell-setColoredBorderTop_O_N__table_vv5_52h_44b} {#Cell-setColoredBorderTop_O_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 35. Returns]

{#Cell-setColoredBorderTop_O_N__table_wv5_52h_44b}  
The following example shows how to set a colored top cell border. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var borderColor = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var width = 1.0;

    cell.setColoredBorderTop(borderColor, width);

## Cell -- setHeight(Number height) {#ariaid-title20}

Sets the height of a cell.
{#Cell-setHeight_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Number | Cell height in points. |
[Table 36. Parameters]

{#Cell-setHeight_N__table_vv5_52h_44b} {#Cell-setHeight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 37. Returns]

{#Cell-setHeight_N__table_wv5_52h_44b}  
The following example shows how set a cell height of 10 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var height = 10;

    cell.setHeight(height);

## Cell -- setHorizontalAlignment(String alignment) {#ariaid-title21}

Sets the horizontal alignment for this cell.
{#Cell-setHorizontalAlignment_S__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| alignment | String | Horizontal alignment setting. Valid values: * center: Align contents to the center. * left: Align contents to the left. * right: Align contents to the right. {#Cell-setHorizontalAlignment_S__ul_i43_swq_p4b} |
[Table 38. Parameters]

{#Cell-setHorizontalAlignment_S__table_vv5_52h_44b} {#Cell-setHorizontalAlignment_S__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 39. Returns]

{#Cell-setHorizontalAlignment_S__table_wv5_52h_44b}  
The following example shows how to set horizontal alignment on a cell. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var alignment = "center";

    cell.setHorizontalAlignment(alignment);

## Cell -- setMaxHeight(Number value) {#ariaid-title22}

Sets the maximum height of a cell.
{#Cell-setMaxHeight_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Number | Maximum cell height in points. |
[Table 40. Parameters]

{#Cell-setMaxHeight_N__table_vv5_52h_44b} {#Cell-setMaxHeight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 41. Returns]

{#Cell-setMaxHeight_N__table_wv5_52h_44b}  
The following example shows how set a maximum cell height of 409 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var height = 409;

    cell.setMaxHeight(height);

## Cell -- setMaxWidth(float value) {#ariaid-title23}

Sets the maximum width of a cell.
{#Cell-setMaxWidth_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Number | Maximum cell width in points. |
[Table 42. Parameters]

{#Cell-setMaxWidth_N__table_vv5_52h_44b} {#Cell-setMaxWidth_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 43. Returns]

{#Cell-setMaxWidth_N__table_wv5_52h_44b}  
The following example shows how set a maximum cell width of 1530 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 1530;

    cell.setMaxWidth(width);

## Cell -- setMinHeight(Number value) {#ariaid-title24}

Sets the minimum height of a cell.
{#Cell-setMinHeight_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Number | Minimum cell height in points. |
[Table 44. Parameters]

{#Cell-setMinHeight_N__table_vv5_52h_44b} {#Cell-setMinHeight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 45. Returns]

{#Cell-setMinHeight_N__table_wv5_52h_44b}  
The following example shows how set a minimum cell height of 12.75 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var height = 12.75;

    cell.setMinHeight(height);

## Cell -- setMinWidth(Number value) {#ariaid-title25}

Sets the minimum width of a cell.
{#Cell-setMinWidth_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| value | Number | Minimum cell width in points. |
[Table 46. Parameters]

{#Cell-setMinWidth_N__table_vv5_52h_44b} {#Cell-setMinWidth_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 47. Returns]

{#Cell-setMinWidth_N__table_wv5_52h_44b}  
The following example shows how set a minimum cell width of 50.58 points. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var width = 50.58;

    cell.setMinWidth(width);

## Cell -- setOpacity(Number opacity) {#ariaid-title26}

Sets the opacity of cell content, borders, and background.
Note:  
This setting affects all child elements of the cell.
{#Cell-setOpacity_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| opacity | Number | Float decimal value from 0 through 1, in which 0 is transparent and 1 is fully opaque. Default: 0 |
[Table 48. Parameters]

{#Cell-setOpacity_N__table_vv5_52h_44b} {#Cell-setOpacity_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 49. Returns]

{#Cell-setOpacity_N__table_wv5_52h_44b}  
The following example shows how to set the opacity of a cell.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var opacity = 0.5;

    cell.setOpacity(opacity);

## Cell -- setPadding(Number padding) {#ariaid-title27}

Sets the padding of all four sides of a cell to the same width.
See also:

* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingBottom_N "Sets the value of the bottom padding width of a cell.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingLeft_N "Sets the value of the left padding width of a cell.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingRight_N "Sets the value of the right padding width of a cell.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingTop_N "Sets the value of the top padding width of a cell.")
{#Cell-setPadding_N__ul_rjs_hgr_p4b}
{#Cell-setPadding_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 50. Parameters]

{#Cell-setPadding_N__table_vv5_52h_44b} {#Cell-setPadding_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 51. Returns]

{#Cell-setPadding_N__table_wv5_52h_44b}  
The following example shows how to set the bottom cell to one point. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var padding = 1.0;

    cell.setPadding(padding);

## Cell -- setPaddingBottom(Number padding) {#ariaid-title28}

Sets the value of the bottom padding width of a cell.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPadding_N "Sets the padding of all four sides of a cell to the same width.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingLeft_N "Sets the value of the left padding width of a cell.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingRight_N "Sets the value of the right padding width of a cell.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingTop_N "Sets the value of the top padding width of a cell.")
{#Cell-setPaddingBottom_N__ul_rjs_hgr_p4b}
{#Cell-setPaddingBottom_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 52. Parameters]

{#Cell-setPaddingBottom_N__table_vv5_52h_44b} {#Cell-setPaddingBottom_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 53. Returns]

{#Cell-setPaddingBottom_N__table_wv5_52h_44b}  
The following example shows how to set bottom cell padding to one point. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var padding = 1.0;

    cell.setPaddingBottom(padding);

## Cell -- setPaddingLeft(Number padding) {#ariaid-title29}

Sets the value of the left padding width of a cell.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPadding_N "Sets the padding of all four sides of a cell to the same width.")
* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingBottom_N "Sets the value of the bottom padding width of a cell.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingRight_N "Sets the value of the right padding width of a cell.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingTop_N "Sets the value of the top padding width of a cell.")
{#Cell-setPaddingLeft_N__ul_rjs_hgr_p4b}
{#Cell-setPaddingLeft_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 54. Parameters]

{#Cell-setPaddingLeft_N__table_vv5_52h_44b} {#Cell-setPaddingLeft_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 55. Returns]

{#Cell-setPaddingLeft_N__table_wv5_52h_44b}  
The following example shows how to set left cell padding to one point. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var padding = 1.0;

    cell.setPaddingLeft(padding);

## Cell -- setPaddingRight(Number padding) {#ariaid-title30}

Sets the value of the right padding width of a cell.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPadding_N "Sets the padding of all four sides of a cell to the same width.")
* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingBottom_N "Sets the value of the bottom padding width of a cell.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingLeft_N "Sets the value of the left padding width of a cell.")
* [setPaddingTop()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingTop_N "Sets the value of the top padding width of a cell.")
{#Cell-setPaddingRight_N__ul_ydd_f4r_p4b}
{#Cell-setPaddingRight_N__table_x2n_v4g_r4b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 56. Parameters]

{#Cell-setPaddingRight_N__table_x2n_v4g_r4b} {#Cell-setPaddingRight_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 57. Returns]

{#Cell-setPaddingRight_N__table_wv5_52h_44b}  
The following example shows how to set right cell padding to one point. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var padding = 1.0;

    cell.setPaddingRight(padding);

## Cell -- setPaddingTop(Number padding) {#ariaid-title31}

Sets the value of the top padding width of a cell.
See also:

* [setPadding()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPadding_N "Sets the padding of all four sides of a cell to the same width.")
* [setPaddingBottom()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingBottom_N "Sets the value of the bottom padding width of a cell.")
* [setPaddingLeft()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingLeft_N "Sets the value of the left padding width of a cell.")
* [setPaddingRight()](https://servicenow-prod.fluidtopics.net/uii5Qv66Cr~ri3bGB3uEvw#Cell-setPaddingRight_N "Sets the value of the right padding width of a cell.")
{#Cell-setPaddingTop_N__ul_rjs_hgr_p4b}
{#Cell-setPaddingTop_N__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| padding | Number | Padding width in points as a decimal value. |
[Table 58. Parameters]

{#Cell-setPaddingTop_N__table_vv5_52h_44b} {#Cell-setPaddingTop_N__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 59. Returns]

{#Cell-setPaddingTop_N__table_wv5_52h_44b}  
The following example shows how to set top cell padding to one point. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var padding = 1.0;

    cell.setPaddingTop(padding);

## Cell -- setTextAlignment(String alignment) {#ariaid-title32}

Sets the text alignment of this cell.
{#Cell-setTextAlignment_S__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| alignment | String | Text alignment position. Valid values: * text-center: Aligns text to the center. * text-justified: Modifies the space between characters to completely fill text between the left and right sides. The final line is left-aligned. * text-justified-all: Justifies text alignment including the final line. * text-left: Align text to the left. * text-right: Align text to the right. {#Cell-setTextAlignment_S__ul_sgj_44p_p4b} |
[Table 60. Parameters]

{#Cell-setTextAlignment_S__table_vv5_52h_44b} {#Cell-setTextAlignment_S__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 61. Returns]

{#Cell-setTextAlignment_S__table_wv5_52h_44b}  
The following example shows how to set the cell text to left alignment.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var alignment = "text-left";

    cell.setTextAlignment(alignment);

## Cell -- setVerticalAlignment(String alignment) {#ariaid-title33}

Sets the vertical alignment for this cell.
{#Cell-setVerticalAlignment_S__table_vv5_52h_44b__entry__3}

| Name | Type | Description |
|-|-|-|
| alignment | String | Vertical alignment setting. Valid values: * bottom: Aligns contents to the bottom. * mid: Aligns contents to the center. * top: Aligns contents to the top. {#Cell-setVerticalAlignment_S__ul_ifh_p5q_p4b} |
[Table 62. Parameters]

{#Cell-setVerticalAlignment_S__table_vv5_52h_44b} {#Cell-setVerticalAlignment_S__table_wv5_52h_44b__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 63. Returns]

{#Cell-setVerticalAlignment_S__table_wv5_52h_44b}  
The following example shows how to set vertical alignment on a cell. For a document usage example, see [Document](https://servicenow-prod.fluidtopics.net/oJ48cUW_0DIZl2sK2PI~9A#DocumentBothAPI "The Document API provides methods to initialize a PDF, add content, and close the PDF. After adding content, the document can be attached to a target record.") API.

    var cell = new sn_pdfgeneratorutils.Cell(1, 3);

    var alignment = "mid";

    cell.setVerticalAlignment(alignment);


