Embed a spreadsheet into an assembled document
Using the InsertSpreadsheet command, you can embed a spreadsheet into the assembled document. This uses Microsoft’s OLE technology, which means that when you view the assembled document and double click on the spreadsheet, that spreadsheet will open in Excel. It can then be edited in Excel and the edited result is placed back into the document.
Should I use InsertSpreadsheet or IncludeSpreadsheet?
Use the Include rather than Insert version of this command if you know the name of the spreadsheet at the time of authoring the template.
InsertSpreadsheet can be used to construct the name of the spreadsheet file from data entered in the interview or from a data source. An example would be:
«InsertSpreadsheet(concat('HourlyRatesFor',DirectorCode,'.xlsx'),8,6,1)»
The values of the parameters are the following:
- The name of the spreadsheet file i.e. the value of the data element DirectorCode. Suppose that code in this example is “AB”, then the spreadsheet file that will be embedded will be the file ‘HourlyRatesForAB.xlsx’.
- The width (in inches) which the spreadsheet image must occupy in the document.
- The height (in inches) of the spreadsheet image in the document.
- This is a “Size Adjuster”. This applies when the spreadsheet is opened for editing.
The 2nd, 3rd and 4th parameters are optional and the examples above are the default values. They will differ from one spreadsheet to another and normally require some trial-and-error to get right.