Previous: OLE embedding, Up: Office integration [Contents]

#### 3.7.2 Alt-text embedding

Over the years OLE technology became increasingly outdated5 and is not perfectly supported by Sharepoint and other modern Office tools. In addition, of course, it was never supported on Linux or on the Mac, whereas Msc-generator now has a GUI for both.

Therefore a new way to add charts to Office documents has been developed in v8.0, called alt-text embedding. In this method the chart is inserted as a PNG image, where the alt-text (a.k.a. alternative text, usually used for accessibility or when the graphics cannot be shown) stores the chart text, language and other info. This method of embedding requires no special OS support, like OLE and also allows to apply various properties to the chart, such as cropping, outline, shadow, rotation, etc. Alt-text embedding is not compatible with OLE embedding in any which way.

Both the CLI6 and MFC7 GUIs of Msc-generator can now work with alt-text embedding the following ways.

1. Open a PPT file (with `pptx` extension) and simultaneously edit all the charts embedded in it. It is possible to copy snippets between the charts, but also to add a new one. Note that you cannot save the PPT file, if it is opened in PowerPoint, as PowerPoint locks the file for writing. Also, PPT files on Sharepoint drives may not merge well, when edited this way. (CLI GUI only.)
2. Copy the currently edited chart to the clipboard using the ‘`File|Copy to clipboard`’ menu item (CLI GUI) or the ‘`Copy Chart (alt-text)`’ ribbon button (MFC GUI). This will package the chart text, language, collapse/expand state, design and page with a PNG rendering of the chart into an Office document snippet. You can then paste it into PowerPoint or Word documents. (Both CLI and MFC GUIs.)
3. If you pasted an Msc-generator chart this way into a into PowerPoint or Word document and later copy it to the clipboard from PowerPoint or Word, you can paste it into Msc-generator for editing. This will re-use the chart text and other metadata stored with the image. Msc-generator stores the sizing and formatting of the chart (along with other graphical elements or text copied with the chart) so when you save, those will be preserved. Saving will happen to the clipboard from where you can re-insert the chart back to the PowerPoint or Word document (or to another one). If a slide contains multiple charts, you can copy all of them to the clipboard and edit all of them simultaneously in Msc-generator (potentially copying sinppets between them). (Both CLI and MFC GUIs. The MFC GUI can only edit one chart at a time.)
4. Finally, Msc-generator can copy the alt-text for the current chart to the clipboard. Adding this to any graphics in PowerPoint will upgrade the graphics to an Msc-generator chart and Msc-generator will be able to edit it (either by opening the PPT file as #1 above or via the clipboard). Similarly, if you copy an alt-text to the clipboard, Msc-generator can paste it as if the whole chart has been copied. (The MFC GUI cannot copy the alt-text, but can paste it.)

Turning the setting `Auto Paste Clipboard` on, will make Msc-generator automatically open any chart copied to the clipboard (and come to the foreground) if the currently open chart has no unsaved changes.

See Embedding Charts on how to use the command-line tool to embed and extract charts into and from PNG and PPT files.

Best common practice workflow You start editing the chart in Msc-generator. At some point select File|Copy to Clipboard (CLI GUI) or Home|Copy Chart (alt-text) from the ribbon (MFC GUI) and then simply paste into a PowerPoint or Word document. (Turn `Auto Paste Clipboard` on.) Then any time later (with Msc-generator running), 1) cut the chart (and maybe other graphics elements or multiple charts) to the cliboard; 2) Msc-generator pops up automatically; 3) edit the chart; 4) Save; and 5) Paste the chart(s) (and other elements) back to the PowerPoint or Word document.

#### Footnotes

##### (5)

For example, it still uses 16-bit Windows metafiles

##### (6)

The CLI GUI can be invoked with `msc-gen --gui`

##### (7)

The MFC GUI can be invoked wit `Msc-generator.exe` and supports alt-text embedding since version 8.5.

Previous: OLE embedding, Up: Office integration [Contents]