Creating HTML Reports and Documents in Origin 2019b


A new feature in Origin 2019b is the ability to create HTML documents and reports that include graphs, analysis results,  project and workbook information, and pretty much any other web page you wish to add.  Because it is HTML, you are free to design the document or report as you see fit.

A Notes Window serves as a container for the HTML. You can toggle between Text Mode and HTML Mode for the Notes Window by using Ctrl + M.

A Notes Window with HTML content can be included in an analysis template to support exporting reports as webpages during Batch Processing. It can even be printed or exported as a standalone webpage using the context menu for the Notes Window title bar.

This this blog post, I will cover the basics of how to create an HTML document or report including providing two easy samples to get you started. Note: Additional samples of HTML can be opened from the HTML menu (when a notes Window is active).


Field Codes- The Key to Making it Work

Creating HTML content in Origin is essentially the same as creating any other web page except Origin supports embedding Field Codes into the HTML. Field Codes are snippets of text enclosed by {{  and }}  . When Origin parses the HTML and comes across a Field Code, Origin resolves it into some sort of Origin object- either a graph, or the contents of a worksheet cell, or perhaps some sort of variable.  An example of a Field Code for a variable (I’ll explain the syntax in a minute) is {{var://$}} . When Origin comes across this, Origin knows to replace that Field Code with the value of the specified variable.

Field Code Syntax

Field codes have two syntaxes: Placeholder Field Codes and Link Field Codes. You can add both types of Field Codes to your HTML- they only caveat being if you use Placeholder Field Codes, you have to have an accompanying Placeholder worksheet (I will explain that a bit later). Note: Generally speaking, you may find it easier to use the Placeholder Field Codes and a Placeholder sheet.

Illustration 1: Example of a Placeholder sheet.

Placeholder Field Codes are simply text tokens such as:

  • {{FitPlot}}
  • {{RSquare}}
  • {{Slope.Value}}

Placeholder Field Codes  point to values and embedded graphs in a Placeholder sheet internally  linked to the Notes Window. You can generate a linked Placeholder sheet by right-clicking on the title bar of the Notes Window and selecting Edit Placeholders… Note: If you have already put some Placeholder Field Codes into your HTML, they will be added to the new sheet automatically!

When Origin parses the HTML, it uses the Placeholder Field Codes to look up the content based on a list of placeholder-link pairs in the sheet. An example of a Placeholder sheet can be seen in Illustration 1. (Note:  Edit Mode has been turned on so that you can see the links embedded in the cells.) Origin will resolve the content in the Links cell and place it into the HTML.

Link Field Codes follow the pattern used for linking items in Origin:

  • {{var://PeakCount}}
  • {{cell://[Book1]Sheet1!B[4]}}
  • {{str://mystring$}}
  • {{graph://Graph1}}

Link Field Codes point to something in the project or running Origin session and are especially useful for creating stand alone HTML-based documents. The syntax is fairly self-explanatory except str:// . This link points to a project or session-level variable, a string register, or other similar strings.

Text vs Graph Field Codes

While text-based Field Codes can be put into HTML anywhere it is okay to add text to be rendered (e.g. a  <P>  element), Field Codes for graphs should be included as part of an <IMG>  element. More specifically:

  • Leave out the src  attribute- Origin will replace it anyway.
  • Specify the width attribute but leave out the height attribute – Origin will use the width to generate the image of the graph and will ignore the height .

Here are two examples of graph Field Codes. Link: <img alt="{{graph://Graph1}}" width="400" />  or Placeholder: <img alt="{{FitPlot}}" width="400" /> .


A Simple HTML Document Example

For this example of a standalone HTML document, we are going to use two Link Field Codes, one is a string for the project file name and one is for a graph.

Start by creating a graph with the short name of “Graph1”.  Next, create a new Notes Window and paste the following HTML into it. Then, hit Ctrl + M to enter HTML View and observe the rendered HTML. To go back to Text Mode, hit Ctrl + M again. If you save the project, you will observe that the HTML will update.

Note: If you modify the graph or save the project and are in HTML view mode, you will have to hit F5 to refresh the HTML.


An Analysis Report Example

In this example, we will step it up a notch in complexity both in our HTML and in the source of our Field Codes. We will be extending an existing analysis template to include an HTML report based on some of the analysis results. In this example, there will be Placeholder Field Codes. You can download a zipped project with the analysis template. Note: There is a folder in the project entitled “Finished” that has a finished version of the following example.

Here are the Steps:

  1. After opening the project, right-click on a worksheet tab and select Add Notes as Sheet. A new Notes Window will be added to the book.
  2. Double-click to open the Notes Window.
  3. Copy the HTML presented at the end of this post and paste it into the Notes Window.
  4. Right-click on the title bar of the Notes Window and select Edit Placeholders…
  5. A new sheet named “Placeholders” will be added to the workbook. Observe that all of the placeholder Field Codes from the HTML have been added to the sheet.
  6. For each placeholder in the sheet, add links in the associated cells. The method depends on what you are adding:
    • Worksheet Cell Text Data: To add a link to text data in a cell (e.g. analysis results), select the data cell from the report sheet or worksheet and hit Ctrl + C to Copy it. Then select the relevant link cell in the Placeholders sheet and hit Ctrl + Alt + V to Paste Link. Paste Link is important- don’t simply paste!
    • Variables: For variables such as , select the relevant link cell in the Placeholders sheet, right-click, and select Insert Variables…. In the Insert Variables dialog, you can select and  insert a link to the desired variable.
    • Graphs: To add a link to a graph, you must activate or the graph (or open it if it is embedded). Then hit Ctrl + C to Copy it. Then select the relevant link cell in the Placeholders sheet and hit Ctrl + Alt + V to Paste Link. Note: you can’t copy and paste link from an embedded graph without activating it first- it won’t work correctly- the graph must be open!
  1. When you are finished, activate the Notes Window and hit Ctrl + M to put the window in HTML Mode.

That’s all there is to it!

But wait…

A couple of final things:

  • In the Placeholder sheet, you can individually format each of the “link” cells for decimal places, date format, etc, etc.
  • If you update text links in the Placeholders sheet, they should be automatically updated in the HTML. If you modify one or more graphs, they may not update immediately. In either case, hitting F5 with the Notes window active will completely refresh the contents (just like any normal web browser).



I hope I have made it clear how easy it is to create customized HTML documents and reports in Origin 2019b. You are only limited by your HTML skills ( it really is easy to learn the basics) and you own design sense.


HTML Source Code for Analysis Report Example


About Chris Drozdowski

Chris Drozdowski is a Product Support Engineer at OriginLab. He loves to talk to customers and educate them. He particularly relishes diagnosing and solving difficult, edge-case issues. As well, he contributes code to help solve problems or enhance user experience. In his down time at work, he likes to research and write about esoteric product features. Outside of work, he enjoys spending time with his family, having fun with C++, working on his aquarium, and exploring craft beers.

View all posts by Chris Drozdowski →

Leave a Reply

Your email address will not be published. Required fields are marked *