Report Generator for Go

Go library to build highly customized reports using REST API

  • GroupDocs.Assembly Cloud SDK for cURL
  • GroupDocs.Assembly Cloud SDK for .NET
  • GroupDocs.Assembly Cloud SDK for Java
  • GroupDocs.Assembly Cloud SDK for C++
  • GroupDocs.Assembly Cloud SDK for Go
  • GroupDocs.Assembly Cloud SDK for Node.js
  • GroupDocs.Assembly Cloud SDK for PHP
  • GroupDocs.Assembly Cloud SDK for Python
  • GroupDocs.Assembly Cloud SDK for Ruby
  • GroupDocs.Assembly Cloud SDK for Swift
Start Free Trial

GroupDocs.Assembly Cloud SDK for Go lets you embed powerful document‑generation capabilities into any Go application without the need for heavy third‑party libraries. The service is fully cloud‑based and communicates through a simple REST API, which means you only need an internet connection and your API credentials to start creating documents.

The typical workflow consists of three logical steps:

  1. Prepare a template – Create a Word, PDF, HTML, or any supported format that contains placeholder fields and programming constructs (loops, conditionals, calculations). The template act​s as a blueprint for the final document.
  2. Provide a data source – Supply XML or JSON data that matches the placeholders. The SDK uses LINQ‑style expression syntax to bind the data to the template, allowing you to generate tables, lists, charts, and dynamic content on the fly.
  3. Assemble the document – Using the Go SDK you upload the template to GroupDocs Cloud Storage, send an assemble request that specifies the template path, the data source, and the desired output format (DOCX, PDF, HTML, etc.), and finally download the resulting document directly from the API response.

This approach enables generation of contracts, invoices, shipping manifests, sales proposals, and any other business‑critical document in real time. It also supports Mail Merge for batch creation of personalized letters, barcode generation, HTML background styling, and email attachment creation. All operations are secured with SSL/TLS encryption and API‑key authentication, ensuring that sensitive data never leaves the cloud unprotected.

Because the heavy lifting occurs in the cloud, the SDK works on every operating system that can run Go (Windows macOS, Linux) and requires only the standard go get installation step. No additional software, no native Office installations, and no manual handling of complex file formats are needed – the cloud service abstracts all that complexity away, allowing you to focus on business logic.

Document Assembly REST API Features

Cloud‑based document assembly accessed via REST API

Template engine with placeholder fields

LINQ‑style expression binding for XML/JSON data

Embed images, charts, barcodes and external documents

Generate dynamic tables and lists from arrays

Insert hyperlinks, bookmarks and email attachments

Apply formulas and sequential data operations

Conditional content blocks (IF‑ELSE) and reusable variables

SSL/TLS encrypted communication and API key authentication

Upload templates to GroupDocs Cloud Storage via REST

Generate a document in Go

The snippet below demonstrates how to upload a template, read a data source and call the Assembly API to produce a document using Go.

Steps

  1. Load configuration from config.json.
  2. Upload the template file to cloud storage.
  3. Read the data source (XML/JSON).
  4. Set AssembleOptions with template path and desired output format.
  5. Call AssembleDocument and receive the assembled file.
import (
    "os"
    "io/ioutil"
    "github.com/groupdocs-assembly-cloud/groupdocs-assembly-cloud-go/api"
    "github.com/groupdocs-assembly-cloud/groupdocs-assembly-cloud-go/api/models"
)

// 1. Initialise configuration
config, _ := models.NewConfiguration("config.json")
assemblyApi, ctx, _ := api.NewAPIClient(config)

// 2. Upload template
fileName := "Input1.docx"
requestFileContent, _ := os.Open(fileName)
uploadReq := &models.UploadFileRequest{
    FileContent: requestFileContent,
    Path:        ToStringPointer(fileName),
}
_, _, _ = assemblyApi.UploadFile(ctx, uploadReq)

// 3. Read data source
dataFile := "Input2.docx" // can be XML or JSON
data, _ := ioutil.ReadFile(dataFile)

// 4. Prepare assemble options
templateInfo := api.TemplateFileInfo{FilePath: fileName}
assembleOptions := api.AssembleOptions{
    TemplateFileInfo: &templateInfo,
    SaveFormat:       "docx",
    ReportData:       string(data),
}

// 5. Generate document
output, err := assemblyApi.AssemblyApi.AssembleDocument(ctx, assembleOptions)
if err != nil {
    // handle error
}
// `output` contains the generated document

Support and Learning Resources

GroupDocs.Assembly Cloud also offers individual SDKs for other languages as listed below:

  English
5f5c5ef