How to apply an HTML Template in C# .NET Framework

Cloudmersive
1 min readJul 20, 2020

--

HTML templates are a great time saver, especially when automated with a bit of code. However, this automation can be quite tedious to set up. Given that we are dealing with code within code, this is prone to failure in a variety of ways. Instead of wrecking your afternoon with this, allow me, if you will, to show you a rapid-fire means of getting results.

First we will need our package:

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8

Now we can proceed to calling our function for applying templates:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class ConvertTemplateApplyHtmlTemplateExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new ConvertTemplateApi();var value = new HtmlTemplateApplicationRequest(); // HtmlTemplateApplicationRequest | Operations to apply to templatetry{// Apply HTML templateHtmlTemplateApplicationResponse result = apiInstance.ConvertTemplateApplyHtmlTemplate(value);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ConvertTemplateApi.ConvertTemplateApplyHtmlTemplate: " + e.Message );}}}}

Alright, we are already done!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet