How to create identified document in Sense/Net

From Sense/Net Wiki
Revision as of 10:45, 7 July 2015 by Tamasii (Talk | contribs) (5. Build up a portlet Page)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  • 100%
  • 6.0
  • Enterprise
  • Community
  • Planned


Sense/Net provides you the possibility to add unique identification items to your documents in a couple of ways. You can either apply a watermark (available in the Enterprise Edition), or you can attach an individually developed tool as described in the following.


1. Create an MS Word form-document

Identified documents in your Sense/Net solution can be downloaded from your document library with the required unique data. For this first you need to create a docx template in MSWord. Open MS Word, and turn on the developer tab in the toolbar:

Word Options

Create a docx template: fill your new document and add „Section Content Controls” to where you want to place unique content later. Add fields you want your users to fill out through Sense/Net:

Developer Toolbar

You need to add Title and Tag-property to all content controls in design-mode. Just right-click on each control, and chose „Properties”, than fill „Title” and „Tag” fields on the popup:


Upload your finished docx template under as ExampleForm.docx in the following folder: /Root/YourContents/

2. Upload the code-base

You need to embed third-party references: add the following new dll-s to your solution in the /References/ folder in your solution:

Third Party dll files

3. Add a new cs file

Add a new cs-file to your code-base, into the WebSite/Code/ folder; that includes the third-party dll-s and the fields from your docx template:

using DocxTemplateFiller;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebSiteProject.Code
    public class ExampleForm
        public string NameField { get; set; }
        public string AddressField { get; set; }
        public string BirthField { get; set; }
        public string EmailField { get; set; }
        public string PhoneField { get; set; }

4. Add a new renderer to your solution

Create a new renderer, which will display the reqired fields with a User control Portlet. It must contain the namespaces from previous dll-s and the exact path of the docx tamplate ("/Root/YourContents/ExampleForm.docx in our case):

<%@ Control Language="C#" AutoEventWireup="true" Inherits="System.Web.UI.UserControl" %>
<%@ Import Namespace="DocxTemplateFiller" %>
<%@ Import Namespace="WebSiteProject.Code" %>
<div class="row">
    <asp:TextBox ID="tbNameField" runat="server"></asp:TextBox>
<div class="row">
    <asp:TextBox ID="tbAddressField" runat="server"></asp:TextBox>
<div class="row">
    <asp:TextBox ID="tbBirthField" runat="server"></asp:TextBox>
<div class="row">
    <asp:TextBox ID="tbEmailField" runat="server"></asp:TextBox>
<div class="row">
    <asp:TextBox ID="tbPhoneField" runat="server"></asp:TextBox>
<div class="row">
    <asp:Button Text="Download Docx Form " runat="server" ID="btnOk" OnClick="Click" /><br />
<script runat="server" type="text/C#">
    protected void Click(object sender, EventArgs e)
        ExampleForm form = new ExampleForm()
            AddressField = tbAddressField.Text,
            BirthField = tbBirthField.Text,
            EmailField = tbEmailField.Text,
            NameField = tbNameField.Text,
            PhoneField = tbPhoneField.Text
DocxTemplateFiller.DocxFiller.DownloadFilledDocxTemplate(HttpContext.Current.Response, "/Root/YourContents/ExampleForm.docx", "form.docx", form);
<style type="text/css">

5. Build up a Portlet Page

Now you only have to build up your new Portlet Page, where users can connect to the template. Add a new Portlet Page to your site, and include a new User Control Portlet, which uses the custom renderer you created above. Have a look at How to create a simple Portlet Page for more information

User Control Portlet Editor View

Check in your page, and with the use of this Portlet users can add their unique data to the form. By clicking the ’Download’ button, the completed form will be downloaded as a new docx file:

Download Template From Portlet Page

Related links