Set Strict Mode

This guide will show you how to choose between Transitional and Strict conformity modes in DOCX documents.

Before you begin

You should get your API key from your UniCloud account.

If this is your first time using UniOffice SDK, follow this guide to set up a local development environment.

Clone the project repository

In your terminal, clone the examples repository. It contains the Go code we will be using for this guide.

git clone https://github.com/unidoc/unioffice-examples

To get the example navigate to the path document/set-strict folder in the unioffice-examples directory.

cd unioffice-examples/document/set-strict/

How it works

Lines 5-10 import the UniOffice packages and other required dependencies.

The init function in lines 12-19 authenticates your request with your UNIDOC_LICENSE_API_KEY.

The main function, spanning from lines 21 to 31, starts by opening the document.docx document at line 22. Then, at line 27, it disables the strict mode using the SetStrict function and saves the file with the name conformance_transitional.docx. Afterward, at line 29, it enables the strict mode again and saves the file with the name conformance_strict.docx on line 30.

Run the code

Run the provided code to generate the two files.

go run main.go

Got any Questions?

We're here to help you.