<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextTable",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextTable"
  },
  "title" : "NSTextTable"
}
-->

# NSTextTable

An object that represents a text table as a whole.

```
class NSTextTable
```

## Overview

A text table is responsible for laying out and drawing the text table blocks it contains, and it maintains the basic parameters of the table.

## Topics

### Getting and setting number of columns

[`numberOfColumns`](/documentation/AppKit/NSTextTable/numberOfColumns)

The number of columns in the text table.

### Getting and setting layout algorithm

[`layoutAlgorithm`](/documentation/AppKit/NSTextTable/layoutAlgorithm-swift.property)

The text table layout algorithm.

### Collapsing borders

[`collapsesBorders`](/documentation/AppKit/NSTextTable/collapsesBorders)

A Boolean value indicating whether the text table borders are collapsible.

### Hiding empty cells

[`hidesEmptyCells`](/documentation/AppKit/NSTextTable/hidesEmptyCells)

A Boolean value indicating whether the text table hides empty cells.

### Determining layout rectangles

[`-  rectForBlock:layoutAtPoint:inRect:textContainer:characterRange:`](/documentation/AppKit/NSTextTable/rect(for:layoutAt:in:textContainer:characterRange:))

Returns the rectangle within which glyphs should be laid out for a text table block.

[`-  boundsRectForBlock:contentRect:inRect:textContainer:characterRange:`](/documentation/AppKit/NSTextTable/boundsRect(for:contentRect:in:textContainer:characterRange:))

Returns the rectangle the text table block actually occupies, including padding, borders, and margins.

### Drawing the table

[`-  drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:`](/documentation/AppKit/NSTextTable/drawBackground(for:withFrame:in:characterRange:layoutManager:))

Draws any colors and other decorations for a text table block.

### Constants

[`LayoutAlgorithm`](/documentation/AppKit/NSTextTable/LayoutAlgorithm-swift.enum)

These constants, specifying the type of text table layout algorithm, are used with [`layoutAlgorithm`](/documentation/AppKit/NSTextTable/layoutAlgorithm-swift.property).

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCopying`](/documentation/Foundation/NSCopying)

### Inherits From

[`NSTextBlock`](/documentation/AppKit/NSTextBlock)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)