Insert Excel Sheets and Excel Named Ranges in Microsoft Word
IMPORTANT: Excel sheets and Excel Named Ranges must have 500 or fewer rows and 50 or fewer columns. If you include an argument for an Excel sheet or Excel Named Range that exceeds the maximum limit, you will receive an error message when attempting to process.
-
In the Object Lookup dialog box, select Extensible Document Settings. Expand Insert Content Using Document Variables and then expand Excel Named Range. Select the syntax line and then select the Copy To Clipboard button to copy the string.
The default value for the FormatAsString parameter is False. When FormatAsString = True, the named range displays as a string instead of a table. If the named range has multiple cells or rows, the cell values are appended together and each row displays on a new line. If FormatAsString is removed from the document variable, the named range displays as a table as if FormatAsString=False.
The default value for FitToPage parameter is False. When FitToPage=True, the named range is resized in the document to fit to page. The default value for Scaling parameter is False. When FitToPage=True, the scaling parameter can be set to True to further resize the named range. If FitToPage or Scaling are removed from the document, the value will display as False.
-
Begin with a new or existing document in Microsoft Word.
-
To insert your string, go to Insert > Quick Parts > Field.
-
The Field dialog box displays. Under Field Names, select DocVariable. In the New name field, paste the string copied from Object Lookup.
After the first string in the DocVariable field, you can optionally paste the ExcelSheet=Sheet1 or ExcelNamedRange=SampleNamedRange arguments. The arguments must be separated by a space. See Extensible Document Settings.
TIP: Under Field Options, select the Preserve formatting during updates checkbox. See Document Variable Setup.
-
Update the values to reflect the folder structure and Excel path. Select the OK button. The final string will display in the Microsoft Word document.
Example: {DOCVARIABLE "{XF}{Application}{File}{Documents/Public/Extensible Documents/Excel4.xfDoc.xlsx}"ExcelSheet=Sheet2"}
IMPORTANT: You must manually update and remove extra quotation marks and backslash symbols otherwise the document variable will not process correctly.
-
Place your cursor on the page, and press Alt + F9. This enables the selected value to be shown or hidden on the page.
NOTE: If expected content does not display after selecting the OK button in the Field dialog box, press Alt + F9 or press Alt + Fn + F9 simultaneously.
-
Select File > Save As. Select a file name and add the .xfdoc extension to the name. The file name is appended with .xfdoc.docx.
-
Select the Save button and ensure it is saved in a familiar folder.
-
Navigate back to OneStream and open File Explorer. Under the folder of your choice, select and upload the file.
-
Right-click on the file and select Process and Open. You may need to enter or select a parameter.
The Microsoft Word document displays the data being requested by the Excel Sheet or Excel Named Range.
TIP: If the document variable content is shaded after processing and opening in Microsoft Word, update your settings in File > Options > Advanced > Field shading: Never.