---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Table - スコープ対象、グローバル

# Table - スコープ対象、グローバル {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：48分

PDF ドキュメントに追加する Table オブジェクトを作成します。各セルで使用するデータを定義し、スタイル、マージン、配置を設定します。
この API は、 ServiceNow PDF Generation Utilities プラグイン (com.snc.apppdfgenerator) の一部であり、 `sn_pdfgeneratorutils` 名前空間内で提供されます。このプラグインはデフォルトでは有効になっています。

この API は、PDF を生成するために[ドキュメント API](https://servicenow-prod.fluidtopics.net/PkT2cVgUF6xDOPZvUnjHtw#DocumentBothAPI "Document API には、PDF の初期化、コンテンツの追加、PDF のクローズを行うメソッドが用意されています。コンテンツを追加した後、ドキュメントをターゲットレコードに添付できます。") とともに使用されるコンポーネントです。

このクラスのメソッドを使用して Table オブジェクトを構築します。次の追加クラスを使用して、セル、パラグラフ、およびスタイルをテーブルに追加できます。

[Cell API](https://servicenow-prod.fluidtopics.net/WSUFZ9uZam0WKcEP7nd_Cw#CellBothAPI "Cell オブジェクトをテーブルのセルとして作成します。この API を使用して、セルを書式設定し、パラグラフや画像などの追加ブロックを含めることができます。")
:   Cell API を使用してセルを作成します。次に、以下のいずれかのメソッドを使用してセルをテーブルに追加します。

    * Table.addCell()
    * Table.addCellWithStyle()
    * Table.addHeaderCell()
    * Table.addImageCell()
    * Table.addParagraphCell()
    * Table.addTextCell()
    {#TableBothAPI__ul_wys_yc3_r4b}

[Paragraph API](https://servicenow-prod.fluidtopics.net/DNVFPz3e14qDLgV2NvVtdg#ParagraphBothAPI "PDF 内のテキストのブロックを表す Paragraph オブジェクトを作成します。")
:   Paragraph API を使用してパラグラフを作成します。 Cell.addParagraph() を使用して、テーブル内のセルにパラグラフを追加します。

[Style API](https://servicenow-prod.fluidtopics.net/R_g4izcGbP1c0BKAWWKIug#StyleBothAPI "フォントサイズ、境界線、配置などのプロパティを定義するスタイルを作成します。同じスタイルを複数のオブジェクトに同時に適用することができます。")
:   Style API を使用してスタイル、色、および境界線を設定します。以下のいずれかのメソッドを使用してスタイルをテーブルに追加します。

    * Table.setDefaultStyle()
    * Table.setHeaderStyle()
{#TableBothAPI__ul_v5m_hd3_r4b}  
その後、次のクラスとメソッドを使用して、PDF ドキュメントに Table オブジェクトを適用できます。

[Document API](https://servicenow-prod.fluidtopics.net/PkT2cVgUF6xDOPZvUnjHtw#DocumentBothAPI "Document API には、PDF の初期化、コンテンツの追加、PDF のクローズを行うメソッドが用意されています。コンテンツを追加した後、ドキュメントをターゲットレコードに添付できます。")
:   Document.addTable() メソッドを使用して、テーブルを PDF ドキュメントに追加します。Document.saveAsAttachment() メソッドを使用すると、ドキュメントをレコードに添付できます。

## Table - Table(ブーリアン ltr, アレイ columnWidths, ブーリアン largeTable) {#ariaid-title2}

テキストの方向、列幅、およびレイアウト設定を使用して、新しい Table オブジェクトをインスタンス化します。
{#Table-Table_A_B__table_twm_hjk_34b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| ltr | ブーリアン | テーブル内の言語のテキストの向きを示すフラグ。詳細については、「[W3C：スクリプトの向きと言語 (W3C: Script direction and languages)](https://www.w3.org/International/questions/qa-scripts.en)」を参照してください。 有効な値： * true：テキストの向きは左から右である。 * false：テキストの向きは右から左である。 {#Table-Table_A_B__ul_j2d_l31_1rb} |
| columnWidths | アレイ | テーブルの各列の幅を指定する数値。サイズは比例配分されます。例えば、`var columnWidths = [2, 1, 1];` は 3 列のテーブルで、1 列目が他の 2 列の 2 倍のサイズです。 デフォルト：各列が同じ幅です。 |
| largeTable | ブーリアン | 100％ 幅と固定レイアウトが暗黙的に設定されているかどうかを示すフラグ。 有効な値： * true：テーブルが固定レイアウトで 100％ 幅を使用する。true の場合、すべてのコンテンツが追加されたときに complete() メソッドを使用して、テーブルが完成したことを示します。 * false：自動テーブルサイズ。 {#Table-Table_A_B__ul_hny_krf_44b} デフォルト値：false |
[表 : 1. パラメーター]

{#Table-Table_A_B__table_twm_hjk_34b}  
次の例は、2 列の Table オブジェクトを作成する方法を示しています。

    var table = new sn_pdfgeneratorutils.Table(true, [70,200], false);

## Table -- addCell(セル cell) {#ariaid-title3}

セル要素をテーブルに追加します。
{#Table-addCell_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| cell | [セル](https://servicenow-prod.fluidtopics.net/WSUFZ9uZam0WKcEP7nd_Cw#CellBothAPI "Cell オブジェクトをテーブルのセルとして作成します。この API を使用して、セルを書式設定し、パラグラフや画像などの追加ブロックを含めることができます。") | テーブルに追加するセル要素。 |
[表 : 2. パラメーター]

{#Table-addCell_O__table_vv5_52h_44b} {#Table-addCell_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 3. 返される内容]

{#Table-addCell_O__table_wv5_52h_44b}  
この例では、インシデントテーブルから Table オブジェクトを作成し、各行に \[番号\] と \[簡単な説明\] のセルを追加する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var greyColor =  sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);
     
    // Query Incident
    var gr = new GlideRecord("incident");
    gr.query();
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [70,200], false);
     
    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);
     
    var nParagraph = new sn_pdfgeneratorutils.Paragraph("Number");
    var sParagraph = new sn_pdfgeneratorutils.Paragraph("Short Description");
     
    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
     
    hdrCell1.addParagraph(nParagraph);
    hdrCell2.addParagraph(sParagraph);
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);
     
    var row = 0;
     
    while(gr.next()) {
       var numCell = new sn_pdfgeneratorutils.Cell;
       var sdCell = new sn_pdfgeneratorutils.Cell;
     
       var numberParagraph = new sn_pdfgeneratorutils.Paragraph(gr.number);
       var sdParagraph = new sn_pdfgeneratorutils.Paragraph(gr.short_description);
      
       numCell.addParagraph(numberParagraph);
       sdCell.addParagraph(sdParagraph);
     
       if (row % 2 == 1) {
          table.setDefaultbackGroundColor(greyColor);
       } else {
          table.setDefaultbackGroundColor(whiteColor);
       }
     
       table.addCell(numCell);
       table.addCell(sdCell);
     
       row = row + 1;
     
    }
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- addCellWithStyle(セル cell, スタイル style) {#ariaid-title4}

スタイルを適用したセル要素をテーブルに追加します。
{#Table-addCellWithStyle_O_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| cell | [セル](https://servicenow-prod.fluidtopics.net/WSUFZ9uZam0WKcEP7nd_Cw#CellBothAPI "Cell オブジェクトをテーブルのセルとして作成します。この API を使用して、セルを書式設定し、パラグラフや画像などの追加ブロックを含めることができます。") | テーブルに追加する Cell オブジェクト。 |
| style | [スタイル](https://servicenow-prod.fluidtopics.net/R_g4izcGbP1c0BKAWWKIug#StyleBothAPI "フォントサイズ、境界線、配置などのプロパティを定義するスタイルを作成します。同じスタイルを複数のオブジェクトに同時に適用することができます。") | セルに適用するスタイル。 |
[表 : 4. パラメーター]

{#Table-addCellWithStyle_O_O__table_vv5_52h_44b} {#Table-addCellWithStyle_O_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 5. 返される内容]

{#Table-addCellWithStyle_O_O__table_wv5_52h_44b}  
この例では、指定されたセルにスタイルを適用し、そのドキュメントをレコードに添付する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var greyColor =  sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var cellBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);
     
    // Query Incident
    var gr = new GlideRecord("incident");
    gr.query();
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [70,200], false);
     
    var cellStyle = new sn_pdfgeneratorutils.Style;
    cellStyle.setBackgroundColor(cellBgColor);
    cellStyle.setTextAlignment("text-center");
    cellStyle.setBold();
    cellStyle.setFontColor(whiteColor);
     
    var nParagraph = new sn_pdfgeneratorutils.Paragraph("Number");
    var sParagraph = new sn_pdfgeneratorutils.Paragraph("Short Description");
     
    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
     
    hdrCell1.addParagraph(nParagraph);
    hdrCell2.addParagraph(sParagraph);
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);
     
    var row = 0;
     
    while(gr.next()) {
       var numCell = new sn_pdfgeneratorutils.Cell;
       var sdCell = new sn_pdfgeneratorutils.Cell;
     
       var numberParagraph = new sn_pdfgeneratorutils.Paragraph(gr.number);
       var sdParagraph = new sn_pdfgeneratorutils.Paragraph(gr.short_description);
      
       numCell.addParagraph(numberParagraph);
       sdCell.addParagraph(sdParagraph);
     
       if (row % 2 == 1) {
          table.setDefaultbackGroundColor(greyColor);
       } else {
          table.setDefaultbackGroundColor(whiteColor);
       }
     
       table.addCellWithStyle(numCell, cellStyle);
       table.addCell(sdCell);
     
       row = row + 1;
     
    }
     
    document.addTable(table);
    document.saveAsAttachment("incident", "sys_id", "filename.pdf");

## Table -- addHeaderCell(セル cell) {#ariaid-title5}

ヘッダーの Cell オブジェクトをテーブルに追加します。
{#Table-addHeaderCell_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| cell | [セル](https://servicenow-prod.fluidtopics.net/WSUFZ9uZam0WKcEP7nd_Cw#CellBothAPI "Cell オブジェクトをテーブルのセルとして作成します。この API を使用して、セルを書式設定し、パラグラフや画像などの追加ブロックを含めることができます。") | テーブルに追加するヘッダーセル。 |
[表 : 6. パラメーター]

{#Table-addHeaderCell_O__table_vv5_52h_44b} {#Table-addHeaderCell_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 7. 返される内容]

{#Table-addHeaderCell_O__table_wv5_52h_44b}  
この例では、Paragraph オブジェクトを含むテーブルにヘッダーセルを追加する方法を示します。Paragraph オブジェクトの詳細については、「[Paragraph API](https://servicenow-prod.fluidtopics.net/DNVFPz3e14qDLgV2NvVtdg#ParagraphBothAPI "PDF 内のテキストのブロックを表す Paragraph オブジェクトを作成します。")」を参照してください。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var greyColor =  sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);
     
    // Query Incident
    var gr = new GlideRecord("incident");
    gr.query();
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [70,200], false);
     
    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);
     
    var nParagraph = new sn_pdfgeneratorutils.Paragraph("Number");
    var sParagraph = new sn_pdfgeneratorutils.Paragraph("Short Description");
     
    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
     
    hdrCell1.addParagraph(nParagraph);
    hdrCell2.addParagraph(sParagraph);
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);
     
    var row = 0;
     
    while(gr.next()) {
       var numCell = new sn_pdfgeneratorutils.Cell;
       var sdCell = new sn_pdfgeneratorutils.Cell;
     
       var numberParagraph = new sn_pdfgeneratorutils.Paragraph(gr.number);
       var sdParagraph = new sn_pdfgeneratorutils.Paragraph(gr.short_description);
      
       numCell.addParagraph(numberParagraph);
       sdCell.addParagraph(sdParagraph);
     
       if (row % 2 == 1) {
          table.setDefaultbackGroundColor(greyColor);
       } else {
          table.setDefaultbackGroundColor(whiteColor);
       }
     
       table.addCell(numCell);
       table.addCell(sdCell);
     
       row = row + 1;
     
    }
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- addImageCell(画像 image) {#ariaid-title6}

画像を含むセルをテーブルに追加します。
{#Table-addImageCell_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| image | [画像](https://servicenow-prod.fluidtopics.net/Etr_NEw08i33zJAv3zMy0g#ImageBothAPI "画像と PDF に挿入するそのレイアウトを表す Image オブジェクトを作成します。スケール、配置、境界色などの属性を定義できます。") | セルに追加する画像オブジェクト。 |
[表 : 8. パラメーター]

{#Table-addImageCell_O__table_vv5_52h_44b} {#Table-addImageCell_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 9. 返される内容]

{#Table-addImageCell_O__table_wv5_52h_44b}  
この例では、2 つの画像セルを持つテーブルを作成し、そのドキュメントをレコードに添付する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [70,200], false);
     
    var icon = new sn_pdfgeneratorutils.Image("<sys_id>");
    var picture = new sn_pdfgeneratorutils.Image("<sys_id>");
     
    table.addImageCell(icon);
    table.addImageCell(picture);
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- addParagraphCell(パラグラフ p) {#ariaid-title7}

パラグラフを含むセルをテーブルに追加します。
{#Table-addParagraphCell_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| p | [パラグラフ](https://servicenow-prod.fluidtopics.net/DNVFPz3e14qDLgV2NvVtdg#ParagraphBothAPI "PDF 内のテキストのブロックを表す Paragraph オブジェクトを作成します。") | セルに追加する Paragraph オブジェクト。 |
[表 : 10. パラメーター]

{#Table-addParagraphCell_O__table_vv5_52h_44b} {#Table-addParagraphCell_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 11. 返される内容]

{#Table-addParagraphCell_O__table_wv5_52h_44b}  
この例では、パラグラフの内容を含む単一のセルでテーブルを作成する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    var paragraph = new sn_pdfgeneratorutils.Paragraph("Content to add to the cell");
     
    table.addParagraphCell(paragraph);
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- addTextCell(文字列 text) {#ariaid-title8}

文字列を含むセルをテーブルに追加します。
{#Table-addTextCell_S__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| text | 文字列 | セルに追加するテキスト。 |
[表 : 12. パラメーター]

{#Table-addTextCell_S__table_vv5_52h_44b} {#Table-addTextCell_S__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 13. 返される内容]

{#Table-addTextCell_S__table_wv5_52h_44b}  
この例では、文字列を含む単一のセルでテーブルを作成する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
     
    document.addTable(table);
    document.saveAsAttachment("incident", "record_sys_id", "filename.pdf");

## Table -- complete() {#ariaid-title9}

意図した内容がすべて 1 つの大きなテーブルに追加されたことを示します。
すでにドキュメントに追加されているテーブルに他の内容を追加するには、Table.flush() メソッドと一緒に使用します。 このメソッドは、コンストラクターの largeTable パラメーターが true に設定されている場合にのみ適用されます。
{#Table-complete__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 14. パラメーター]

{#Table-complete__table_vv5_52h_44b} {#Table-complete__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 15. 返される内容]

{#Table-complete__table_wv5_52h_44b}  
この例では、すでにドキュメントに追加されているテーブルへの内容の追加が完了したことを示す方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var greyColor =  sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);
     
    // Query Incident
    var gr = new GlideRecord("incident");
    gr.query();
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1,2,1,1], true);
     
    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);
     
    var numberParagraph = new sn_pdfgeneratorutils.Paragraph("Number");
    var descParagraph = new sn_pdfgeneratorutils.Paragraph("Short Description");
    var stateParagraph = new sn_pdfgeneratorutils.Paragraph("State");
    var assignedParagraph = new sn_pdfgeneratorutils.Paragraph("Assigned to");

     
    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
    var hdrCell3 = new sn_pdfgeneratorutils.Cell;
    var hdrCell4 = new sn_pdfgeneratorutils.Cell;
     
    hdrCell1.addParagraph(numberParagraph);
    hdrCell2.addParagraph(descParagraph);
    hdrCell3.addParagraph(stateParagraph);
    hdrCell4.addParagraph(assignedParagraph);
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);
    table.addHeaderCell(hdrCell3);
    table.addHeaderCell(hdrCell4);

    var row = 0;
     
    while(gr.next()) {
       var numCell = new sn_pdfgeneratorutils.Cell;
       var sdCell = new sn_pdfgeneratorutils.Cell;
       var stateCell = new sn_pdfgeneratorutils.Cell;
       var assignedCell = new sn_pdfgeneratorutils.Cell;

     
       var numberParagraph = new sn_pdfgeneratorutils.Paragraph(gr.number);
       var sdParagraph = new sn_pdfgeneratorutils.Paragraph(gr.short_description);
       var stateParagraph = new sn_pdfgeneratorutils.Paragraph(gr.state);
       var assignedParagraph = new sn_pdfgeneratorutils.Paragraph(gr.assigned_to);
      
       numCell.addParagraph(numberParagraph);
       sdCell.addParagraph(sdParagraph);
       stateCell.addParagraph(stateParagraph);
       assignedCell.addParagraph(assignedParagraph);

     
       if (row % 2 == 1) {
          table.setDefaultbackGroundColor(greyColor);
       } else {
          table.setDefaultbackGroundColor(whiteColor);
       }
     
       table.addCell(numCell);
       table.addCell(sdCell);
       table.addCell(stateCell);
       table.addCell(assignedCell);
     
       row = row + 1;
     
    }

    document.addTable(table);
    table.addTextCell("A cell added later");
    table.flush();
    table.complete();
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- donotSplitRowOnPageBreak(ブーリアン value) {#ariaid-title10}

行が 2 ページに分割されないようにします (可能な場合)。
{#Table-donotSplitRowOnPageBreak_B__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| value | ブーリアン | 行を 2 ページに分割するか、行全体を 2 ページ目に移動するかを示すフラグ。ただし、行が複数のページにまたがる場合、このプロパティは適用されません。 有効な値： * true：ページの残りの部分が行に対して十分な大きさでない場合、行全体を新しいページに追加します。 * false：ページの残りの部分が行に対して十分な大きさでない場合、行を 2 ページに分割します。 {#Table-donotSplitRowOnPageBreak_B__ul_akx_pv1_p4b} デフォルト値：false |
[表 : 16. パラメーター]

{#Table-donotSplitRowOnPageBreak_B__table_vv5_52h_44b} {#Table-donotSplitRowOnPageBreak_B__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 17. 返される内容]

{#Table-donotSplitRowOnPageBreak_B__table_wv5_52h_44b}  
この例では、行が 2 ページに分割されないようにする方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [25,25,25,75,400], false);
     
    table.addTextCell("Text to add to the cell");
    table.addTextCell("More text to add to the cell");
    table.addTextCell("Even more text to add to the cell");
    table.addTextCell("Even more text to add to the cell");
    table.addTextCell("Even more text to add to the cell");

    table.donotSplitRowOnPageBreak(true);
     
    document.addTable(table);
    document.saveAsAttachment("incident", "record_sys_id", "filename.pdf");

## Table --flush() {#ariaid-title11}

すでにドキュメントに追加されているテーブルに他の内容を追加します。
Table.complete() メソッドと一緒に使用して、他の内容がすべてテーブルに追加されたことを示します。 このメソッドは、コンストラクターの largeTable パラメーターが true に設定されている場合にのみ適用されます。
{#Table-flush__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 18. パラメーター]

{#Table-flush__table_vv5_52h_44b} {#Table-flush__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 19. 返される内容]

{#Table-flush__table_wv5_52h_44b}  
この例では、すでにドキュメントに追加されているテーブルにテキストセルを追加する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var greyColor =  sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);
     
    // Query Incident
    var gr = new GlideRecord("incident");
    gr.query();
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1,2,1,1], true);
     
    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);
     
    var numberParagraph = new sn_pdfgeneratorutils.Paragraph("Number");
    var descParagraph = new sn_pdfgeneratorutils.Paragraph("Short Description");
    var stateParagraph = new sn_pdfgeneratorutils.Paragraph("State");
    var assignedParagraph = new sn_pdfgeneratorutils.Paragraph("Assigned to");

     
    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
    var hdrCell3 = new sn_pdfgeneratorutils.Cell;
    var hdrCell4 = new sn_pdfgeneratorutils.Cell;
     
    hdrCell1.addParagraph(numberParagraph);
    hdrCell2.addParagraph(descParagraph);
    hdrCell3.addParagraph(stateParagraph);
    hdrCell4.addParagraph(assignedParagraph);
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);
    table.addHeaderCell(hdrCell3);
    table.addHeaderCell(hdrCell4);

    var row = 0;
     
    while(gr.next()) {
       var numCell = new sn_pdfgeneratorutils.Cell;
       var sdCell = new sn_pdfgeneratorutils.Cell;
       var stateCell = new sn_pdfgeneratorutils.Cell;
       var assignedCell = new sn_pdfgeneratorutils.Cell;

     
       var numberParagraph = new sn_pdfgeneratorutils.Paragraph(gr.number);
       var sdParagraph = new sn_pdfgeneratorutils.Paragraph(gr.short_description);
       var stateParagraph = new sn_pdfgeneratorutils.Paragraph(gr.state);
       var assignedParagraph = new sn_pdfgeneratorutils.Paragraph(gr.assigned_to);
      
       numCell.addParagraph(numberParagraph);
       sdCell.addParagraph(sdParagraph);
       stateCell.addParagraph(stateParagraph);
       assignedCell.addParagraph(assignedParagraph);

     
       if (row % 2 == 1) {
          table.setDefaultbackGroundColor(greyColor);
       } else {
          table.setDefaultbackGroundColor(whiteColor);
       }
     
       table.addCell(numCell);
       table.addCell(sdCell);
       table.addCell(stateCell);
       table.addCell(assignedCell);
     
       row = row + 1;
     
    }

    document.addTable(table);
    table.addTextCell("A cell added later");
    table.flush();
    table.complete();
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- getDefaultStyle() {#ariaid-title12}

デフォルトのスタイルを返します。
{#Table-getDefaultStyle_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 20. パラメーター]

{#Table-getDefaultStyle_O__table_vv5_52h_44b} {#Table-getDefaultStyle_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| Style (スタイル) | デフォルトのスタイル。 |
[表 : 21. 返される内容]

{#Table-getDefaultStyle_O__table_wv5_52h_44b}  
この例では、デフォルトのスタイルを設定して返す方法を示します。

    var table = new sn_pdfgeneratorutils.Table(true, [1], false);

    var style = new sn_pdfgeneratorutils.Style();

    style.setItalic();

    table.setDefaultStyle(style);
     
    table.addTextCell("Text to add to the cell");

    var defaultStyle = table.getDefaultStyle();

    gs.info(defaultStyle);

## Table -- getHeaderStyle() {#ariaid-title13}

テーブルのヘッダーに適用されているスタイルを返します。
{#Table-getHeaderStyle__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 22. パラメーター]

{#Table-getHeaderStyle__table_vv5_52h_44b} {#Table-getHeaderStyle__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| Style (スタイル) | テーブルのヘッダーに適用されているスタイル。 |
[表 : 23. 返される内容]

{#Table-getHeaderStyle__table_wv5_52h_44b}  
この例では、テーブルのヘッダーのスタイルを設定して返す方法を示します。

    var table = new sn_pdfgeneratorutils.Table(true, [1,1], false);

    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);

    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);

    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);

    var styleObject = table.getHeaderStyle();

    gs.info(styleObject);

## Table -- setBorder(数字 width) {#ariaid-title14}

テーブルの外縁に、指定された幅の境界線を設定します。
{#Table-setBorder_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| width | 数字 | 境界線の幅。 単位：ポイント |
[表 : 24. パラメーター]

{#Table-setBorder_N__table_vv5_52h_44b} {#Table-setBorder_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 25. 返される内容]

{#Table-setBorder_N__table_wv5_52h_44b}  
この例では、2 ピクセルの境界線を持つテーブルを作成し、そのテーブルをレコードに添付する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setBorder(2);
     
    document.addTable(table);
    "document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setDefaultbackGroundColor(色 color) {#ariaid-title15}

テーブルのデフォルトの背景色を設定します。
{#Table-setDefaultbackGroundColor_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| color | [色](https://servicenow-prod.fluidtopics.net/5ziHyJThRZ~YBMye1Ixwpw#ColorBothAPI "PDF の要素に適用できるセル、テーブル、行などの色属性を定義するために使用する Color オブジェクトを作成します。") | テーブルのデフォルトの背景色として使用される色オブジェクト。 |
[表 : 26. パラメーター]

{#Table-setDefaultbackGroundColor_O__table_vv5_52h_44b} {#Table-setDefaultbackGroundColor_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 27. 返される内容]

{#Table-setDefaultbackGroundColor_O__table_wv5_52h_44b}  
この例では、テーブルのデフォルトの背景色を設定する方法を示します。

    // declare table by providing width array with automatic table size
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);

    var color = new sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);

    table.setDefaultbackGroundColor(color);
     
    table.addTextCell("Text to add to the cell");

## Table -- setDefaultStyle(スタイル defaultStyle) {#ariaid-title16}

テーブルに適用するデフォルトのスタイルを設定します。
{#Table-setDefaultStyle_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| defaultStyle | Style (スタイル) | テーブルに適用するデフォルトのスタイル。 |
[表 : 28. パラメーター]

{#Table-setDefaultStyle_O__table_vv5_52h_44b} {#Table-setDefaultStyle_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 29. 返される内容]

{#Table-setDefaultStyle_O__table_wv5_52h_44b}  
次の例では、テーブルにデフォルトのスタイルを適用する方法を示します。

    var table = new sn_pdfgeneratorutils.Table(true, [1], false);

    var style = new sn_pdfgeneratorutils.Style();

    style.setItalic();

    table.setDefaultStyle(style);
     
    table.addTextCell("Text to add to the cell");

    var defaultStyle = table.getDefaultStyle();

    gs.info(defaultStyle);

## Table -- setFixedPosition(数字 pageNumber, 数字 left, 数字 bottom, 数字 width) {#ariaid-title17}

テーブルをページ上の固定位置に設定します。
{#Table-setFixedPosition_N_N_N_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| pageNumber | 数字 | テーブルを追加するページの番号。 |
| left | 数字 | テーブルを追加する左マージンからのピクセル数。 単位：ポイント |
| bottom | 数字 | テーブルを追加する下マージンからのピクセル数。 単位：ポイント |
| width | 数字 | テーブルの幅。 単位：ポイント |
[表 : 30. パラメーター]

{#Table-setFixedPosition_N_N_N_N__table_vv5_52h_44b} {#Table-setFixedPosition_N_N_N_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 31. 返される内容]

{#Table-setFixedPosition_N_N_N_N__table_wv5_52h_44b}  
この例では、テーブルをページの左下隅に再配置する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setFixedPosition(1,36,36,500);
     
    document.addTable(table);
    "document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setHeaderStyle(スタイル headerStyle) {#ariaid-title18}

テーブルのヘッダーに適用するスタイルオブジェクトを設定します。
{#Table-setHeaderStyle_O__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| headerStyle | [スタイル](https://servicenow-prod.fluidtopics.net/R_g4izcGbP1c0BKAWWKIug#StyleBothAPI "フォントサイズ、境界線、配置などのプロパティを定義するスタイルを作成します。同じスタイルを複数のオブジェクトに同時に適用することができます。") | テーブルのヘッダーに適用するスタイルオブジェクト。 |
[表 : 32. パラメーター]

{#Table-setHeaderStyle_O__table_vv5_52h_44b} {#Table-setHeaderStyle_O__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 33. 返される内容]

{#Table-setHeaderStyle_O__table_wv5_52h_44b}  
この例では、テーブルのヘッダーのスタイルを設定して返す方法を示します。

    var table = new sn_pdfgeneratorutils.Table(true, [1,1], false);

    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);

    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);

    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);

    var styleObject = table.getHeaderStyle();

    gs.info(styleObject);

## Table -- setHorizontalAlignment(文字列 alignment) {#ariaid-title19}

テーブルの水平配置を設定します。
{#Table-setHorizontalAlignment_S__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| alignment | 文字列 | テーブルの配置。 有効な値： * center：コンテンツを中央に配置します。 * left：コンテンツを左に配置します。 * right：コンテンツを右に配置します。 {#Table-setHorizontalAlignment_S__ul_i43_swq_p4b} |
[表 : 34. パラメーター]

{#Table-setHorizontalAlignment_S__table_vv5_52h_44b} {#Table-setHorizontalAlignment_S__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 35. 返される内容]

{#Table-setHorizontalAlignment_S__table_wv5_52h_44b}  
この例は、ページの中央に配置された小さなテーブルを作成する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setWidth(90);
    table.setHorizontalAlignment("center");
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setMargin(数字 margin) {#ariaid-title20}

テーブル周囲のすべてのマージンを同じ幅に設定します。
{#Table-setMargin_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| margin | 数値 | 上、右、下、左のマージンの値 (ポイント)。 |
[表 : 36. パラメーター]

{#Table-setMargin_N__table_vv5_52h_44b} {#Table-setMargin_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 37. 返される内容]

{#Table-setMargin_N__table_wv5_52h_44b}  
この例では、テーブル全体のマージンを設定する方法を示します。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setMargin(3);
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setMarginBottom(数字 margin) {#ariaid-title21}

ページの下マージンを設定します。
{#Table-setMarginBottom_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| margin | 数字 | 下マージンの高さ (ポイント)。 |
[表 : 38. パラメーター]

{#Table-setMarginBottom_N__table_vv5_52h_44b} {#Table-setMarginBottom_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 39. 返される内容]

{#Table-setMarginBottom_N__table_wv5_52h_44b}  
この例では、ページの下マージンを 3 ポイントに設定する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    var whiteColor =  sn_pdfgeneratorutils.Color([1,1,1]);
    var greyColor =  sn_pdfgeneratorutils.Color([0.8,0.8,0.8]);
    var headerBgColor = new sn_pdfgeneratorutils.Color([0.4,0.6,0.8]);
     
    // Query Incident
    var gr = new GlideRecord("incident");
    gr.query();
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [70,200], false);
     
    var headerStyle = new sn_pdfgeneratorutils.Style;
    headerStyle.setBackgroundColor(headerBgColor);
    headerStyle.setTextAlignment("text-center");
    headerStyle.setBold();
    headerStyle.setFontColor(whiteColor);
     
    table.setHeaderStyle(headerStyle);
     
    var nParagraph = new sn_pdfgeneratorutils.Paragraph("Number");
    var sParagraph = new sn_pdfgeneratorutils.Paragraph("Short Description");
     
    var hdrCell1 = new sn_pdfgeneratorutils.Cell;
    var hdrCell2 = new sn_pdfgeneratorutils.Cell;
     
    hdrCell1.addParagraph(nParagraph);
    hdrCell2.addParagraph(sParagraph);
     
    table.addHeaderCell(hdrCell1);
    table.addHeaderCell(hdrCell2);

    // set the bottom margin to three points
    table.setBottomMargin(3);
     
    var row = 0;
     
    while(gr.next()) {
       var numCell = new sn_pdfgeneratorutils.Cell;
       var sdCell = new sn_pdfgeneratorutils.Cell;
     
       var numberParagraph = new sn_pdfgeneratorutils.Paragraph(gr.number);
       var sdParagraph = new sn_pdfgeneratorutils.Paragraph(gr.short_description);
      
       numCell.addParagraph(numberParagraph);
       sdCell.addParagraph(sdParagraph);
     
       if (row % 2 == 1) {
          table.setDefaultbackGroundColor(greyColor);
       } else {
          table.setDefaultbackGroundColor(whiteColor);
       }
     
       table.addCell(numCell);
       table.addCell(sdCell);
     
       row = row + 1;
     
    }
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setMarginLeft(数字 margin) {#ariaid-title22}

ページの左マージンを設定します。
{#Table-setMarginLeft_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| margin | 数字 | 左マージンの幅 (ポイント)。 |
[表 : 40. パラメーター]

{#Table-setMarginLeft_N__table_vv5_52h_44b} {#Table-setMarginLeft_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 41. 返される内容]

{#Table-setMarginLeft_N__table_wv5_52h_44b}  
この例では、ページの左マージンを設定する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setMarginLeft(100);
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setMarginRight(数字 margin) {#ariaid-title23}

ページの右マージンを設定します。
{#Table-setMarginRight_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| margin | 数字 | 右マージンの幅 (ポイント)。 |
[表 : 42. パラメーター]

{#Table-setMarginRight_N__table_vv5_52h_44b} {#Table-setMarginRight_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 43. 返される内容]

{#Table-setMarginRight_N__table_wv5_52h_44b}  
この例では、ページの左マージンを設定する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setMarginRight(100);
     
    document.addTable(table);
    "document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setMarginTop(数字 margin) {#ariaid-title24}

ページの上マージンを設定します。
{#Table-setMarginTop_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| margin | 数字 | 上マージンの高さ (ポイント)。 |
[表 : 44. パラメーター]

{#Table-setMarginTop_N__table_vv5_52h_44b} {#Table-setMarginTop_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 45. 返される内容]

{#Table-setMarginTop_N__table_wv5_52h_44b}  
この例では、ページの上マージンを設定する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setMarginTop(100);
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- setWidth(数字 width) {#ariaid-title25}

テーブルの合計幅を設定します。
{#Table-setWidth_N__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| width | 数字 | テーブルの幅。 単位：ポイント |
[表 : 46. パラメーター]

{#Table-setWidth_N__table_vv5_52h_44b} {#Table-setWidth_N__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 47. 返される内容]

{#Table-setWidth_N__table_wv5_52h_44b}  
この例では、幅が 90 ポイントのテーブルを作成し、そのドキュメントをレコードに添付する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.setWidth(90);
    table.setHorizontalAlignment("center");
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");

## Table -- useAllAvailableWidth() {#ariaid-title26}

ページで使用可能な幅全体を使用するようにテーブルを拡張します。
{#Table-useAllAvailableWidth__table_vv5_52h_44b__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 48. パラメーター]

{#Table-useAllAvailableWidth__table_vv5_52h_44b} {#Table-useAllAvailableWidth__table_wv5_52h_44b__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 49. 返される内容]

{#Table-useAllAvailableWidth__table_wv5_52h_44b}  
この例は、ページの使用可能幅全体に広がるテーブルを作成する方法を示しています。

    var pageSize = new sn_pdfgeneratorutils.PdfPage("A4");
    var document = new sn_pdfgeneratorutils.Document.createDocument(pageSize);
     
    // declare table by providing width array and Boolean for large table
    var table = new sn_pdfgeneratorutils.Table(true, [1], false);
     
    table.addTextCell("Text to add to the cell");
    table.useAllAvailableWidth();
     
    document.addTable(table);
    document.saveAsAttachment("incident", "<record_sys_id>", "filename.pdf");


