|
| 1 | +# Asposehtmlcloud.TemplateMergeApi |
| 2 | + |
| 3 | +All URIs are relative to *https://api.aspose.cloud/v1.1* |
| 4 | + |
| 5 | +Method | HTTP request | Description |
| 6 | +------------- | ------------- | ------------- |
| 7 | +[**GetMergeHtmlTemplate**](TemplateMergeApi.md#GetMergeHtmlTemplate) | **GET** /html/{templateName}/merge | Populate HTML document template with data located as a file in the storage. |
| 8 | +[**PutMergeHtmlTemplate**](TemplateMergeApi.md#PutMergeHtmlTemplate) | **PUT** /html/{templateName}/merge | Populate HTML document template with data from the request body. Result document will be saved to storage. |
| 9 | + |
| 10 | + |
| 11 | +<a name="GetMergeHtmlTemplate"></a> |
| 12 | +# **GetMergeHtmlTemplate** |
| 13 | +> File GetMergeHtmlTemplate(templateName, dataPath, opts) |
| 14 | +
|
| 15 | +Populate HTML document template with data located as a file in the storage. |
| 16 | + |
| 17 | +### Example |
| 18 | + |
| 19 | +#### Template file HtmlTemplate.html |
| 20 | + |
| 21 | +```html |
| 22 | +<html> |
| 23 | + <head> |
| 24 | + <title>{{Title}}</title> |
| 25 | + <meta charset="utf-8" /> |
| 26 | + </head> |
| 27 | + <body> |
| 28 | + <div> |
| 29 | + <p>Name: {{Name}} {{Surname}}</p> |
| 30 | + <p>Address: {{Address.Number}}, {{Address.Street}}, {{Address.City}}</p> |
| 31 | + </div> |
| 32 | + </body> |
| 33 | +</html> |
| 34 | +``` |
| 35 | + |
| 36 | +#### Data file XmlSourceData.xml |
| 37 | +```xml |
| 38 | +<?xml version="1.0" encoding="utf-8" ?> |
| 39 | +<Data> |
| 40 | + <Title>Test</Title> |
| 41 | + <Person> |
| 42 | + <Name>John</Name> |
| 43 | + <Surname>Smith</Surname> |
| 44 | + <Address> |
| 45 | + <Number>200</Number> |
| 46 | + <Street>Austin rd.</Street> |
| 47 | + <City>Dallas</City> |
| 48 | + </Address> |
| 49 | + </Person> |
| 50 | + <Person> |
| 51 | + <Name>Jack</Name> |
| 52 | + <Surname>Fox</Surname> |
| 53 | + <Address> |
| 54 | + <Number>25</Number> |
| 55 | + <Street>Broadway</Street> |
| 56 | + <City>New York</City> |
| 57 | + </Address> |
| 58 | + </Person> |
| 59 | + <Person> |
| 60 | + <Name>Sherlock</Name> |
| 61 | + <Surname>Holmes</Surname> |
| 62 | + <Address> |
| 63 | + <Number>65</Number> |
| 64 | + <Street>Baker str.</Street> |
| 65 | + <City>London</City> |
| 66 | + </Address> |
| 67 | + </Person> |
| 68 | +</Data> |
| 69 | +``` |
| 70 | + |
| 71 | +```javascript |
| 72 | +var Asposehtmlcloud = require('asposehtmlcloud'); |
| 73 | + |
| 74 | +var apiInstance = new Asposehtmlcloud.TemplateMergeApi(); |
| 75 | + |
| 76 | +var templateName = "templateName_example"; // String | Template document name. Template document is HTML or zipped HTML. |
| 77 | + |
| 78 | +var dataPath = "dataPath_example"; // String | Data source file path in the storage. Supported data format: XML |
| 79 | + |
| 80 | +var opts = { |
| 81 | + 'options': "options_example", // String | Template merge options: reserved for further implementation. |
| 82 | + 'folder': "folder_example", // String | The template document folder. |
| 83 | + 'storage': "storage_example" // String | The template document and data source storage. |
| 84 | +}; |
| 85 | + |
| 86 | +var callback = function(error, data, response) { |
| 87 | + if (error) { |
| 88 | + console.error(error); |
| 89 | + } else { |
| 90 | + console.log('API called successfully. Returned data: ' + data); |
| 91 | + } |
| 92 | +}; |
| 93 | +apiInstance.GetMergeHtmlTemplate(templateName, dataPath, opts, callback); |
| 94 | +``` |
| 95 | + |
| 96 | +### Parameters |
| 97 | + |
| 98 | +Name | Type | Description | Notes |
| 99 | +------------- | ------------- | ------------- | ------------- |
| 100 | + **templateName** | **String**| Template document name. Template document is HTML or zipped HTML. | |
| 101 | + **dataPath** | **String**| Data source file path in the storage. Supported data format: XML | |
| 102 | + **options** | **String**| Template merge options: reserved for further implementation. | [optional] |
| 103 | + **folder** | **String**| The template document folder. | [optional] |
| 104 | + **storage** | **String**| The template document and data source storage. | [optional] |
| 105 | + |
| 106 | +### Return type |
| 107 | + |
| 108 | +**File** |
| 109 | + |
| 110 | +### HTTP request headers |
| 111 | + |
| 112 | + - **Content-Type**: application/octet-stream |
| 113 | + - **Accept**: application/json |
| 114 | + |
| 115 | +<a name="PutMergeHtmlTemplate"></a> |
| 116 | +# **PutMergeHtmlTemplate** |
| 117 | +> File PutMergeHtmlTemplate(templateName, outPath, file, opts) |
| 118 | +
|
| 119 | +Populate HTML document template with data from the request body. Result document will be saved to storage. |
| 120 | + |
| 121 | +### Example |
| 122 | +```javascript |
| 123 | +var Asposehtmlcloud = require('asposehtmlcloud'); |
| 124 | + |
| 125 | +var apiInstance = new Asposehtmlcloud.TemplateMergeApi(); |
| 126 | + |
| 127 | +var templateName = "templateName_example"; // String | Template document name. Template document is HTML or zipped HTML. |
| 128 | + |
| 129 | +var outPath = "outPath_example"; // String | Result document path. |
| 130 | + |
| 131 | +var file = "/path/to/file.xml"; // File | A data file to populate template. |
| 132 | + |
| 133 | +var opts = { |
| 134 | + 'options': "options_example", // String | Template merge options: reserved for further implementation. |
| 135 | + 'folder': "folder_example", // String | The template document folder. |
| 136 | + 'storage': "storage_example" // String | The template document and data source storage. |
| 137 | +}; |
| 138 | + |
| 139 | +var callback = function(error, data, response) { |
| 140 | + if (error) { |
| 141 | + console.error(error); |
| 142 | + } else { |
| 143 | + console.log('API called successfully. Returned data: ' + data); |
| 144 | + } |
| 145 | +}; |
| 146 | +apiInstance.PutMergeHtmlTemplate(templateName, outPath, file, opts, callback); |
| 147 | +``` |
| 148 | + |
| 149 | +### Parameters |
| 150 | + |
| 151 | +Name | Type | Description | Notes |
| 152 | +------------- | ------------- | ------------- | ------------- |
| 153 | + **templateName** | **String**| Template document name. Template document is HTML or zipped HTML. | |
| 154 | + **outPath** | **String**| Result document path. | |
| 155 | + **file** | **File**| A data file to populate template. | |
| 156 | + **options** | **String**| Template merge options: reserved for further implementation. | [optional] |
| 157 | + **folder** | **String**| The template document folder. | [optional] |
| 158 | + **storage** | **String**| The template document and data source storage. | [optional] |
| 159 | + |
| 160 | +### Return type |
| 161 | + |
| 162 | +**File** |
| 163 | + |
| 164 | +### HTTP request headers |
| 165 | + |
| 166 | + - **Content-Type**: application/octet-stream |
| 167 | + - **Accept**: application/json |
| 168 | + |
0 commit comments