---
Product: Aspose.PDF
Platform: go
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/go/cell
---

# Cell

## Overview

`Cell` is a type in Aspose.PDF FOSS for Go.

Cell is a single cell within a Row.

This type declares 20 methods for Cell objects in Go programs.
Available methods include: `Background`, `Border`, `ColSpan`, `Image`, `Margin`, `Row`, `RowSpan`, `SetBackground`, `SetBorder`, `SetColSpan`, `SetHAlign`, `SetImage`, and 8 additional methods.
Public members are accessible to any Go application after installing the Aspose.PDF FOSS for Go package.

## Methods

| Signature | Description |
|-----------|-------------|
| `Row()` → `*Row` | Row returns the owning row. |
| `SetText(text: string)` → `*Cell` | Sets the text value. |
| `Text()` → `string` | Returns the text. |
| `SetTextStyle(s: TextStyle)` → `*Cell` | SetTextStyle overrides the table's DefaultCellStyle for this cell. |
| `TextStyle()` → `*TextStyle` | TextStyle returns the per-cell style override (or nil if the cell inherits the table default). |
| `SetBackground(col: *Color)` → `*Cell` | Sets the background value. |
| `Background()` → `*Color` | Returns the background. |
| `SetBorder(b: BorderInfo)` → `*Cell` | Sets the border value. |
| `Border()` → `*BorderInfo` | Returns the border. |
| `SetMargin(m: MarginInfo)` → `*Cell` | Sets the margin value. |
| `Margin()` → `*MarginInfo` | Returns the margin. |
| `SetHAlign(h: HAlign)` → `*Cell` | Sets the h align value. |
| `SetVAlign(v: VAlign)` → `*Cell` | Sets the v align value. |
| `SetColSpan(n: int)` → `*Cell` | SetColSpan sets the column span (cells the cell occupies horizontally). |
| `ColSpan()` → `int` | ColSpan returns the cell's column span (1 if unset). |
| `SetRowSpan(n: int)` → `*Cell` | SetRowSpan sets the row span (rows the cell occupies vertically). |
| `RowSpan()` → `int` | RowSpan returns the cell's row span (1 if unset). |
| `SetImage(path: string)` → `*Cell` | SetImage configures the cell to render the named image instead of text. |
| `SetImageFromStream(r: io.Reader)` → `*Cell` | SetImageFromStream is the io.Reader-based counterpart. |
| `Image()` → `(path string, hasImage bool)` | Image returns the configured image source. |

## See Also

- [Aspose.PDF — Enterprise API Reference](https://reference.aspose.com/pdf/)