Skip to content

Latest commit

 

History

History
120 lines (84 loc) · 4.8 KB

ConvertTemplateApi.md

File metadata and controls

120 lines (84 loc) · 4.8 KB

cloudmersive_convert_api_client.ConvertTemplateApi

All URIs are relative to https://api.cloudmersive.com

Method HTTP request Description
convert_template_apply_docx_template POST /convert/template/docx/apply Apply Word DOCX template
convert_template_apply_html_template POST /convert/template/html/apply Apply HTML template

convert_template_apply_docx_template

str convert_template_apply_docx_template(input_file, template_definition=template_definition)

Apply Word DOCX template

Apply operations to fill in a Word DOCX template by replacing target template/placeholder strings in the DOCX with values, generating a final Word DOCX result. For example, you could create a Word Document invoice containing strings such as "{FirstName}" and "{LastName}" and then replace these values with "John" and "Smith".

Example

from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Apikey'] = 'Bearer'

# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ConvertTemplateApi(cloudmersive_convert_api_client.ApiClient(configuration))
input_file = '/path/to/file.txt' # file | Input file to perform the operation on.
template_definition = NULL # object | Template definition for the document, including what values to replace (optional)

try:
    # Apply Word DOCX template
    api_response = api_instance.convert_template_apply_docx_template(input_file, template_definition=template_definition)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ConvertTemplateApi->convert_template_apply_docx_template: %s\n" % e)

Parameters

Name Type Description Notes
input_file file Input file to perform the operation on.
template_definition object Template definition for the document, including what values to replace [optional]

Return type

str

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/octet-stream

[Back to top] [Back to API list] [Back to Model list] [Back to README]

convert_template_apply_html_template

HtmlTemplateApplicationResponse convert_template_apply_html_template(value)

Apply HTML template

Apply operations to fill in an HTML template, generating a final HTML result

Example

from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Apikey'] = 'Bearer'

# create an instance of the API class
api_instance = cloudmersive_convert_api_client.ConvertTemplateApi(cloudmersive_convert_api_client.ApiClient(configuration))
value = cloudmersive_convert_api_client.HtmlTemplateApplicationRequest() # HtmlTemplateApplicationRequest | Operations to apply to template

try:
    # Apply HTML template
    api_response = api_instance.convert_template_apply_html_template(value)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ConvertTemplateApi->convert_template_apply_html_template: %s\n" % e)

Parameters

Name Type Description Notes
value HtmlTemplateApplicationRequest Operations to apply to template

Return type

HtmlTemplateApplicationResponse

Authorization

Apikey

HTTP request headers

  • Content-Type: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]