Smart Objects
A smart object is a span of text, a table or a picture in an Impulse document or on an Expo slide whose content comes from somewhere else: a cell, range or name in a workbook beside the document, an expression in Lua, C# or Python, one of the document's Divooka graphs, or a Data Source. A report whose figures come from the budget workbook is the typical use: change the workbook, refresh the report, and every figure in it follows.
Smart objects are Functions: refreshing them computes their values and writes them into the document, and nothing else.
Making one
Insert ▸ Smart Object opens the same dialog in both applications.
- In Impulse, put the caret where the value goes, or select the text it replaces, or put the caret in a table to fill the table.
- In Expo, put the caret in a text box for a value inside its text, or make a table or picture on the slide: a smart table or picture goes into the slide's empty content placeholder when it has one.
The dialog asks:
Name: how other smart objects refer to it, such as
Revenue.Language and Source:
- Formula: a formula over a workbook beside the document, with the workbook's name in brackets:
=[Budget.xlsx]Summary!B4,=[Budget.xlsx]TotalRevenue(a defined name),=SUM([Budget.xlsx]Summary!B2:B5), or a range such as=[Budget.xlsx]Summary!A1:D6to fill a table. - Lua: an expression reading other smart objects as
smart.Name:(smart.Revenue - smart.Cost) / smart.Revenue. - C#: an expression reading them as
Smart["Name"], withNum()andText()to convert:Math.Round(Num(Smart["Revenue"]) * 0.08, 2). - Python:
smart.Revenue * 0.2, or a body that returns a value; see Python. - Divooka: one of the document's Function graphs, called by name:
LOANPAYMENT(param.Principal, param.Rate, param.Years).
Lua, C#, Python and Divooka sources also read the document's parameters (
param.Name,Param["Name"]), and changing a parameter refreshes exactly the smart objects that read it. The Source box is one line for a formula or a graph call and a text area for Lua, C# and Python, and Lua and Python sources can call the functions in the document's function scripts.- Formula: a formula over a workbook beside the document, with the workbook's name in brackets:
Object Type: text, a table, or Image, a picture filled by a Function that returns one, such as a chart drawn by a graph or
host.getImage(url). A Function graph that returns a picture always makes an image smart object.Format: a number format for the value, such as
#,##0or0.0%, in the codes Formula uses. Hover over the box for what each symbol means, with examples. An image has no format, so the box goes when you choose Image.
Choosing Lua, C#, Python or Divooka on a document whose scripts are disabled says Scripts are disabled on this document, with an Enable button beside it.
Preview shows what the smart object will show before anything is inserted. It runs nothing until you press it. Once open, a moment after each change the dialog works out the source as a refresh would and shows the value, the first rows of a table or the picture, or why there is none, so a mistyped formula or an unexpected table shape is found there rather than in the document.
The preview reads the document's other smart objects, parameters and grants, writes nothing, and runs Lua, C#, Python and graph sources only when the document's code is enabled; until then it says so.
Insert ▸ Data Source… makes a smart table from a Data Source instead.
The smart object is made and refreshed at once, as one undo step. In the document it is shaded, and hovering over it shows, beside the pointer, its name, source and last refresh. In an Expo text box a smart value moves with the words around it and cannot be typed into.
Refreshing
- Refresh All (
Ctrl+Shift+F9: References ▸ Refresh All in Impulse, Insert ▸ Refresh Smart Objects in Expo) refreshes every smart object, in the order their dependencies need:MarginafterRevenueandCost, and a chart of a smart table after the table. - References ▸ Refresh Selection in Impulse, and Insert ▸ Refresh Selected Smart Object in Expo, refresh the one at the caret or selected, as does Refresh on a smart object's right-click menu.
A refresh reads each workbook once, without running any code it carries, computes every value, and then writes them all as one undo step: text, tables and pictures together. A span keeps its formatting; a table grows or shrinks to its rows and keeps its formatting by column name. A smart object that fails keeps its last value, and the status says how many refreshed and how many failed.
The Smart Objects tab
Tools ▸ Smart Objects (in Impulse also References ▸ Smart Objects) opens a tab in the bottom tray listing every smart object, with its kind, language, source and when it was last refreshed, or why it failed, or that it was edited by hand since. Smart objects that read another file and Data Sources are listed under Data sources; the document's scripts under Scripts. Expo lists each with its slide number. The tab opens by itself when a refresh fails.

- Double-click a row to go to the smart object: the document scrolls to it and selects it; in Expo it goes to the slide and selects the shape, or opens the text box with the value selected.
- Show Definition opens the Scripts tab at the script, or the node of the graph, that computes it.
- In Impulse, the strip's buttons refresh all or the selected smart object, and Unbind turns a smart object back into ordinary text.
Right-clicking a smart object in the document offers the same: Show in Smart Objects (Impulse), Show Definition, Refresh, and for a smart table Column Number Format… and, for a Data Source, Edit Data Source….
Formatting smart tables
Format a smart table as you would any table. A refresh rewrites it, and its columns may come back in another order, or with one more or one fewer, so the formatting belongs to each column's name and is given back after every refresh: in Impulse each column's cell and text formatting and width, in Expo each column's header cell and first body cell, given to every row. Column Number Format… on the right-click menu sets how a column's numbers are written. A Data Source or a script may suggest formats for new columns, and yours win; see Formatting a table by column name.
Scripts must be enabled
Lua, C#, Python and graph smart objects are code, so they do not refresh until the document is enabled with the Enable button on the Scripts disabled bar; see Trust. Smart objects that read a workbook, and Data Sources, are data and refresh either way, once allowed what they reach.
How they are stored
Impulse: the value of each smart object is ordinary text or an ordinary table in the .docx, inside a Word content control named after it. Word, LibreOffice and a PDF show the last values; Word keeps the content controls when it saves, so the document can go to Word and back and still refresh.
Expo: a value in a text box is a field in the text (a:fld), and a smart table or picture is an ordinary PowerPoint table or picture found again by its shape name. PowerPoint and LibreOffice show the last values.
In both, the bindings are kept in the document's project part.
From a script
doc.smartObjects in an Impulse script lists them (count, [i], find(name)), adds them (add(range, source, { language, name, format }), addTable(table, source, options), insertTable(afterParagraph, source, options)), and refreshes them (refresh(), refreshOnly(names)). Each has name, kind, language, source, format, text, refreshed, error, isEdited and unbind().
Try it
Examples\Automation\Smart reportholdsReport.docxbound toBudget.xlsx. Open the report, enable its scripts, change a number in the workbook and save it, then References ▸ Refresh All in the report.- The Weather Report is a whole page of smart objects, and the Loan Letter's figures come from Divooka graphs.