4.8.4 Batch Processing with Word Template for Reporting
Origin can perform batch analysis of multiple files and output cell-linked analysis results to an external Word template for reporting.
Minimum Origin Version Required: Origin 2016 SR0
What you will learn
This tutorial will show you how to:
- Add bookmarks from a Word template to a specific Analysis Template
- Link analysis results to bookmarked cells in Word template and adjust the sizes of graphs to be exported
- Sending one time results to Word template for reporting
- Perform batch analysis of multiple files and export results to Word/PDF files
In this tutorial we will use a built-in Word template Sensor Analysis Report.dotx which is located at <Origin EXE folder>\Samples\Batch Processing\ folder. To view the bookmark labels on the Word template, with the file open go to File: Options to open Word Options dialog. Then select Advanced on the left panel and scroll down to section Show document content on the right panel and check Show bookmarks checkbox there.
Add Bookmarks to Analysis Template
- Start Origin. Click File: Open and browse to <Origin EXE>\Samples\Batch Processing\ folder and select the file Sensor Analysis.ogw (NOT "Sensor Analysis.ogwu") and open it.
- Activate worksheet Data, click the button and browse to <Origin EXE folder>\Samples\Curve Fitting\ folder and select file Sensor01.dat to import data for analysis.
- Go to menu File: Add Word Bookmarks to Analysis Template... to open dialog. Click the browse button to the right of the Word template box and browse to <Origin EXE folder>\Samples\Batch Processing\ folder to select Sensor Analysis Report.dotx.
- Click to select all bookmark entries in the Bookmarks list under Select Bookmarks and click OK to add a Bookmarks sheet to the active analysis template.
Link Analysis Results to Word Template
- Click on the Bookmarks tab.
- In the Links column, right-click the cell to the right of FileName and select Insert Variables.
- In the Insert Variables dialog, click the Info tab, expand the SYSTEM.IMPORT node and highlight FILENAME. Click the Insert button to insert the file name into the worksheet cell.
- Right-click the cell beside FileDate and again choose Insert Variables, expand the SYSTEM.IMPORT node, highlight FILEDATE and click the Insert button to insert the file date into the worksheet cell. Note that the value that is inserted is a Julian Day value, the number that Origin uses internally to store date-time data. To display in a more familiar date format, right-click the cell and select Format Cells.
- From the Format drop-down list, select Date and click OK to close the dialog.
- Right-click the cell beside the FittedGraph cell and select Insert Graph. Click the browse button to the right of the Graphs box to open Graph Browser dialog. Check the Show Embedded Graph box to display a list of worksheet-embedded graphs. Click to select the FitLine graph and add it to panel on the right. Click OK twice to insert the graph into Bookmarks worksheet. In the GraphWidth column to the right, enter 250 (units = point size) to specify the size of the graph that will be exported to Word.
- Repeat the last step for the row ResidualPlot.
- For bookmarks related to parameter values, we will copy and paste link values from the report sheet FitLinear1. Click the report sheet FitLinear1 and locate the Parameters table. Click on the data cell at the intersection of Intercept and Value, right-click and select Copy. Return to the Bookmarks sheet, right-click the cell to the right of InterceptValue and select Paste Link to create a link between bookmarks in the Word template and values in report sheet.
- Repeat this "Copy and Paste Link" operation to fill in the rest of cells in the Links column (you'll find the RSquare value beside Adj. R-Square in the Statistics table). When done, click File: Save Workbook as Analysis Template... to save the analysis template as Sensor Analysis Template.ogw or .ogwu .
Sending One Time Results to Word Template to Create Word Report
Sometimes we may just want to analyze one data file and quickly create one Word report. Continue from the example above, suppose we have all results linked to Word bookmarks as shown in Bookmarks worksheet, to create an one time Word report for active sheet you can simply click Export to Word button on the top left corner to create it.
You can further specify where to output the Word report in appeared Export Path dialog.
Batch Process and Export Results to Word/PDF Files
- Start with a new project.
- Click on the Batch Processing button .
- Make sure Load Analysis Template is selected as Batch Processing Mode. In the Analysis Template drop-down, select the Sensor Analysis Template.ogw(u) file we created earlier (you may need to click the button to the right of the list and browse to the created file).
- Select PDF from Export to drop-down list to export report as PDF file.
- Click the browse button to the right of the Word template box and browse to <Origin EXE folder>\Samples\Batch Processing\ folder to select Sensor Analysis Report.dotx.
- Optionally you can click browse button on the right of Export Path to specify another path for export.
- Click on the browse button to the right of File List, browse to the <Origin EXE Folder>\Samples\Curve Fitting folder and select all sensor files Sensor0#.dat.
- Click Add File(s), then click OK.
- Select File Name as Dataset Identifier.
- Make sure the Data Sheet drop-down is set as Data.
- Make sure the Result Sheet drop-down is set as Result.
- Make sure that Delete Intermediate Workbook is cleared.
- Click OK to close the dialog and process the "Sensor" data files.
If you forget where to look for your exported PDF files, the location is output to Messages Log.
A sample of exported PDF version report is as following: