# DrawingHandle Class

> DrawingHandle class in the browser JavaScript API: A drawing handle whose lifetime follows its worksheet and object token, rather than its display name.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **Path:** TX Sheet Control > API Reference > JavaScript API > Browser Editor > DrawingHandle Class
- **1357 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/llms-full.txt

---

A drawing handle whose lifetime follows its worksheet and object token, rather than its display name.

Package: `@txtextcontrol/tx-sheet-control`. Version: **2.0.0**.

ES module import: `import { DrawingHandle } from '@txtextcontrol/tx-sheet-control';`.

### Constructor

```javascript
new DrawingHandle(sheet, id)
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `sheet` | `Worksheet` | No | Value matching sheet's declared type and the owning object's validation rules. |
| `id` | `string` | No | Stable identity in the owning document/collection. |

Returns: `Drawing`.

### Members

#### Properties

| Property | Description |
|---|---|
| [id](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/id-property/llms-full.txt) | The id value of DrawingHandle. |
| [name](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/name-property/llms-full.txt) | The name value of DrawingHandle. |
| [sheet](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/sheet-property/llms-full.txt) | The sheet value of DrawingHandle. |
| [size](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/size-property/llms-full.txt) | The size value of DrawingHandle. |
| [snapshot](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/snapshot-property/llms-full.txt) | The snapshot value of DrawingHandle. |

#### Methods

| Method | Description |
|---|---|
| [bringForward](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/bringforward-method/llms-full.txt) | Move one z-order step forward. |
| [bringToFront](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/bringtofront-method/llms-full.txt) | Move to the top of the z-order. |
| [copyTo](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/copyto-method/llms-full.txt) | Copy into another sheet/anchor; copies the entire group when grouped. |
| [moveTo](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/moveto-method/llms-full.txt) | Move to a cell anchor and optional pixel offsets. |
| [remove](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/remove-method/llms-full.txt) | Remove this drawing and its group when grouped. |
| [rename](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/rename-method/llms-full.txt) | Set the drawing name. |
| [resize](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/resize-method/llms-full.txt) | Set width and height in CSS pixels. |
| [rotate](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/rotate-method/llms-full.txt) | Set the absolute drawing angle in degrees. |
| [sendBackward](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/sendbackward-method/llms-full.txt) | Move one z-order step backward. |
| [sendToBack](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/sendtoback-method/llms-full.txt) | Move to the bottom of the z-order. |
| [update](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/update-method/llms-full.txt) | Patch drawing appearance or position. |

### Examples

Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.

```javascript
function createDrawingHandleReport(book) {
    const sheet = book.sheets.at(0);
    sheet.cell('A1').setText('October invoice');
    sheet.cell('A1').format({
        fontFamily: 'Liberation Sans',
        fontSize: 16,
        bold: true,
        textColor: '#ffffff',
        fillColor: '#163b63',
    });

    sheet.columns.at(0).setWidth({ pixels: 240 });
    sheet.range('B8:B9').setValues([[120], [80]]);
    sheet.cell('B10').setFormula('=SUM(B8:B9)');
    sheet.range('B8:B10').format({ numberFormatCode: '#,##0.00', fontSize: 11 });
    sheet.drawings.addShape({
        type: 'rectangle',
        text: 'Approved',
        anchor: { cell: 'F2' },
        size: { width: 180, height: 60 },
        fill: '#e5eef4',
    });

    return sheet;
}
```

### See Also

- [JavaScript Browser Editor API](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/llms-full.txt)
- [Pictures and Shapes](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/pictures-shapes/llms-full.txt)
- [barcode](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/barcode-property/llms-full.txt) — Reads barcode settings from a floating object, or undefined for an ordinary drawing.
- [updateBarcode](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/updatebarcode-method/llms-full.txt) — Replaces all barcode settings while retaining identity and geometry. An ordinary drawing rejects this operation.

---

## In This Section

- [DrawingHandle.barcode Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/barcode-property/llms-full.txt): DrawingHandle.barcode property in the TX Sheet Control JavaScript API for the browser, with its syntax and a JavaScript example.
- [DrawingHandle.bringForward Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/bringforward-method/llms-full.txt): DrawingHandle.bringForward method in the TX Sheet Control JavaScript API for the browser: Move one z-order step forward.
- [DrawingHandle.bringToFront Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/bringtofront-method/llms-full.txt): DrawingHandle.bringToFront method in the TX Sheet Control JavaScript API for the browser: Move to the top of the z-order.
- [DrawingHandle.copyTo Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/copyto-method/llms-full.txt): DrawingHandle.copyTo method in the TX Sheet Control JavaScript API for the browser: Copy into another sheet/anchor; copies the entire group when grouped.
- [DrawingHandle.id Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/id-property/llms-full.txt): DrawingHandle.id property in the TX Sheet Control JavaScript API for the browser, with its type string and a JavaScript example.
- [DrawingHandle.moveTo Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/moveto-method/llms-full.txt): DrawingHandle.moveTo method in the TX Sheet Control JavaScript API for the browser: Move to a cell anchor and optional pixel offsets.
- [DrawingHandle.name Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/name-property/llms-full.txt): DrawingHandle.name property in the TX Sheet Control JavaScript API for the browser, with its type string and a JavaScript example.
- [DrawingHandle.remove Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/remove-method/llms-full.txt): DrawingHandle.remove method in the TX Sheet Control JavaScript API for the browser: Remove this drawing and its group when grouped.
- [DrawingHandle.rename Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/rename-method/llms-full.txt): DrawingHandle.rename method in the TX Sheet Control JavaScript API for the browser: Set the drawing name. Includes the syntax and a JavaScript example.
- [DrawingHandle.resize Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/resize-method/llms-full.txt): DrawingHandle.resize method in the TX Sheet Control JavaScript API for the browser, with the return type Drawing and a JavaScript example.
- [DrawingHandle.rotate Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/rotate-method/llms-full.txt): DrawingHandle.rotate method in the TX Sheet Control JavaScript API for the browser: Set the absolute drawing angle in degrees.
- [DrawingHandle.sendBackward Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/sendbackward-method/llms-full.txt): DrawingHandle.sendBackward method in the TX Sheet Control JavaScript API for the browser: Move one z-order step backward.
- [DrawingHandle.sendToBack Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/sendtoback-method/llms-full.txt): DrawingHandle.sendToBack method in the TX Sheet Control JavaScript API for the browser: Move to the bottom of the z-order.
- [DrawingHandle.sheet Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/sheet-property/llms-full.txt): DrawingHandle.sheet property in the TX Sheet Control JavaScript API for the browser, with its type Worksheet and a JavaScript example.
- [DrawingHandle.size Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/size-property/llms-full.txt): DrawingHandle.size property in the TX Sheet Control JavaScript API for the browser, with its type Size and a JavaScript example.
- [DrawingHandle.snapshot Property](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/snapshot-property/llms-full.txt): DrawingHandle.snapshot property in the TX Sheet Control JavaScript API for the browser, with its type WorksheetDrawing and a JavaScript example.
- [DrawingHandle.update Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/update-method/llms-full.txt): DrawingHandle.update method in the TX Sheet Control JavaScript API for the browser: Patch drawing appearance or position.
- [DrawingHandle.updateBarcode Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/updatebarcode-method/llms-full.txt): DrawingHandle.updateBarcode method in the TX Sheet Control JavaScript API for the browser, with its syntax and a JavaScript example.

---

## Nearby

- **Previous:** [DrawingGroup.ungroup Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinggroup/ungroup-method/llms-full.txt)
- **Next:** [DrawingHandle.bringForward Method](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/drawinghandle/bringforward-method/llms-full.txt)
