You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PowerPoint: no way to select or reach a TextRange for text inside a table cell — TableCell has no textRange/setSelected, and Shape.textFrame throws for table shapes #6906
Platform [PC desktop, Mac, iOS, Office on the web]: Mac desktop (but this is an API surface gap, so it reproduces on all platforms including Office on the web)
Host: PowerPoint
Office version number: 16.112.2 (build 26082125), Microsoft 365 Subscription — typings up to PowerPointApi 1.10 / preview
Operating System: macOS 26 (Darwin 25.6.0)
Browser (if using Office on the web): N/A (also reproduces in any browser)
Expected behavior
There should be some path from a table cell to a PowerPoint.TextRange, so that a sub-range of the cell's text can be selected in the view, e.g.:
constcell=shape.getTable().getCellOrNullObject(row,col);cell.getTextRange().getSubstring(start,length).setSelected();// does not exist today
…mirroring what already works for ordinary text-bearing shapes via shape.textFrame.textRange.getSubstring(start, length).setSelected() (PowerPointApi 1.5).
Alternatively (coarser but still useful): a cell-level selection primitive such as TableCell.setSelected().
Current behavior
There is no API path that reaches a TextRange (or any selection primitive) for table content:
PowerPoint.TableCell (PowerPointApi 1.8/1.9, and current preview) exposes only whole-cell text (get/set), textRuns, formatting properties, and resize/split — no textFrame, no textRange, no getSubstring, no setSelected.
The only selection APIs are Presentation.setSelectedSlides, Slide.setSelectedShapes, and TextRange.setSelected — so the finest selection granularity for table content is the entire table shape.
The only way to visually mark sub-cell text today is to edit the document (e.g. rewrite textRuns with a highlight color and revert), which dirties the file, pollutes the undo stack, and is unsafe under co-authoring.
Steps to reproduce
Insert a table on a slide (e.g. via shapes.addTable(2, 2)) and put text in a cell.
Try shape.textFrame.textRange on the table shape → throws InvalidArgument.
Inspect shape.getTable().getCellOrNullObject(0, 0) → no member returns a TextRange or offers selection.
Compare with a plain text box, where textFrame.textRange.getSubstring(2, 5).setSelected() works as expected.
awaitPowerPoint.run(async(context)=>{constshapes=context.presentation.getSelectedSlides().getItemAt(0).shapes;// Works: sub-range selection in a plain text box (PowerPointApi 1.5)constbox=shapes.addTextBox("Hello sub-range selection");box.textFrame.textRange.getSubstring(6,9).setSelected();awaitcontext.sync();// No equivalent for a table:consttableShape=shapes.addTable(2,2);constcell=tableShape.getTable().getCellOrNullObject(0,0);cell.text="Hello table cell";awaitcontext.sync();// 1) cell has no textRange/getSubstring/setSelected member// 2) tableShape.textFrame.textRange throws InvalidArgument// Best available: select the whole table shapecontext.presentation.getSelectedSlides().getItemAt(0).setSelectedShapes([tableShape.id]);awaitcontext.sync();});
Context
We build a content-quality add-in (Markup AI) that analyzes presentation text and lets users click a reported issue in the task pane to jump to the exact text in the document. For regular shapes this works well with textFrame.textRange.getSubstring(start, length).setSelected(). For table content — extremely common in business decks — we can only select the whole table shape, so users have to hunt for the flagged text themselves. We deliberately refuse to fake it by temporarily editing highlight formatting, because that modifies the user's file (dirty state, undo pollution, co-authoring conflicts).
PowerPointApi 1.8/1.9 added a rich read/write Table/TableCell surface, so table content is now fully reachable — selection is the one missing piece. TextRange.setSelected already exists; what's missing is a way to obtain a TextRange scoped to a cell.
Your Environment
Expected behavior
There should be some path from a table cell to a
PowerPoint.TextRange, so that a sub-range of the cell's text can be selected in the view, e.g.:…mirroring what already works for ordinary text-bearing shapes via
shape.textFrame.textRange.getSubstring(start, length).setSelected()(PowerPointApi 1.5).Alternatively (coarser but still useful): a cell-level selection primitive such as
TableCell.setSelected().Current behavior
There is no API path that reaches a
TextRange(or any selection primitive) for table content:PowerPoint.TableCell(PowerPointApi 1.8/1.9, and current preview) exposes only whole-celltext(get/set),textRuns, formatting properties, andresize/split— notextFrame, notextRange, nogetSubstring, nosetSelected.GraphicFrame-backedShape, and accessingshape.textFrameon it throwsInvalidArgument(previously reported in When PowerPoint shape is a table, reference to the Shape.TextFrame property throws InvalidArgument error #4380, closed by the stale bot).Presentation.setSelectedSlides,Slide.setSelectedShapes, andTextRange.setSelected— so the finest selection granularity for table content is the entire table shape.The only way to visually mark sub-cell text today is to edit the document (e.g. rewrite
textRunswith a highlight color and revert), which dirties the file, pollutes the undo stack, and is unsafe under co-authoring.Steps to reproduce
shapes.addTable(2, 2)) and put text in a cell.shape.textFrame.textRangeon the table shape → throwsInvalidArgument.shape.getTable().getCellOrNullObject(0, 0)→ no member returns aTextRangeor offers selection.textFrame.textRange.getSubstring(2, 5).setSelected()works as expected.Link to live example(s)
Reproducible in Script Lab with this snippet:
Context
We build a content-quality add-in (Markup AI) that analyzes presentation text and lets users click a reported issue in the task pane to jump to the exact text in the document. For regular shapes this works well with
textFrame.textRange.getSubstring(start, length).setSelected(). For table content — extremely common in business decks — we can only select the whole table shape, so users have to hunt for the flagged text themselves. We deliberately refuse to fake it by temporarily editing highlight formatting, because that modifies the user's file (dirty state, undo pollution, co-authoring conflicts).PowerPointApi 1.8/1.9 added a rich read/write
Table/TableCellsurface, so table content is now fully reachable — selection is the one missing piece.TextRange.setSelectedalready exists; what's missing is a way to obtain aTextRangescoped to a cell.Useful logs
shape.textFrameon a table shape:RichApi.Error: InvalidArgument(see also When PowerPoint shape is a table, reference to the Shape.TextFrame property throws InvalidArgument error #4380)