# PageCells

These cmdlets work with the ShapeSheet of pages (page size, margins, scale, layout, print setup, and so on):

* [`New-VisioPageCells`](/visiopowershell/cmdlets/pagecells/new-visiopagecells.md): create a blank `PageCells` object to populate.
* `Get-VisioPageCells`: read cells off one or more pages as a DataTable.
* [`Set-VisioPageCells`](/visiopowershell/cmdlets/pagecells/set-visiopagecells.md): write a populated `PageCells` to one or more pages.

The pattern is the same as for shape cells: build a cells object, set the properties you care about, write it back.

### Working with page cells

```powershell
Set-StrictMode -Version 2
$ErrorActionPreference = "Stop"

Import-Module Visio

New-VisioApplication
$doc  = New-VisioDocument
$page = Get-VisioPage -ActivePage

$cells_dt = Get-VisioPageCells -Page $page

Write-Host $cells_dt

$new_cells = New-VisioPageCells
$new_cells.PageHeight = 3
$new_cells.PageWidth  = 6

Set-VisioPageCells -Cells $new_cells -Page $page
```

### Querying multiple pages

```powershell
Set-StrictMode -Version 2
$ErrorActionPreference = "Stop"

Import-Module Visio

New-VisioApplication
$doc = New-VisioDocument

# The doc already has one page, add four more empty pages
New-VisioPage | Out-Null
New-VisioPage | Out-Null
New-VisioPage | Out-Null
New-VisioPage | Out-Null

$pages = Get-VisioPage

$pages_dt = Get-VisioPageCells -Page $pages

Write-Host $pages_dt
```

## On the C# side

Page-cell-level operations on the C# side go through [`client.ShapeSheet`](https://saveenr.gitbook.io/visioautomation/visio-scripting/shape-sheet) (the same reader / writer pattern that handles ShapeSheet on shapes also applies to a page's PageSheet). See [VisioScripting.Client](https://saveenr.gitbook.io/visioautomation/visio-scripting) for the full facade index.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://saveenr.gitbook.io/visiopowershell/cmdlets/pagecells.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
