Skip to main content Skip to footer

Easy to use JSON template in SpreadJS

SpreadJS has an intuitive Designer that allows you to design a new template or edit an existing template using the Microsoft Excel-like, visual, drag-and-drop user interface without writing a single line of code. Originally, you could only save the template to a ssjson extension file in the Designer, and then load the file by using ajax calling in web page, plus you also needed some special server side configuration for the specific type file. In 2014v2 edition, we offer the ability to save the template to a js file. The template will be serialized to a JSON object and set to a variable in the file, so that it can be easily used in a web page. Here are the steps: 1. Open the designer to design the template, you may use the ribbon command and dialog, or import from an Excel file 2. Click "Export Javascript File" button to export to a Javascript file 3. Open the file in Notepad, you will see the variable name is same as the file name. 4. Add the reference of the javascript file in the web page

<script src="template.js" type="text/javascript"></script>

5. Load JSON data into SpreadJS by using single line code

spread.fromJSON(template);

OK, done. Open the web page in a browser, you will see the template present in SpreadJS.

MESCIUS inc.

comments powered by Disqus