Skip to content
Overview

Overview

UniOffice is a pure Go library for creating and editing Office documents. It reads and writes the Open XML formats directly, with no Microsoft Office installation, no COM automation and no external service, so it runs anywhere Go runs including a container.

Your documents stay on your machine

UniOffice is a library, not a service. Parsing, layout and writing all happen in your own process, so document content is never uploaded, never queued, and never stored anywhere outside the machine running the code. There is no rendering endpoint to send a file to, and nothing happens outside your own requests.

That matters when the documents are contracts, payroll, medical records or anything else that cannot be handed to a third party. Compared with a document-conversion API, the content simply never crosses your network boundary.

One caveat, stated plainly because a compliance review will ask. A metered API key does make an outbound call to the license server. It reports usage counts and machine identifiers, meaning hostname, local IP, MAC address, package name and version, and a timestamp. It does not send document content or filenames. Where even that call is unacceptable, an offline license verifies from its own signature and makes no outbound connection at all.

Does UniOffice send my documents anywhere? covers this in the detail a security review needs.

Get API Keys

Three packages, one library

UniOffice is really three libraries that ship together. Each models its own file format and they share almost no API, so the first thing to settle is which one you need.

PackageFormatStart here
document.docx, WordDocument guides
spreadsheet.xlsx, ExcelSpreadsheet guides
presentation.pptx, PowerPointPresentation guides

A few habits carry across all three. Every program loads a metered license key before touching the library. Documents are created with New, opened with Open, and closed with defer doc.Close(). Content is built by adding to a parent rather than assembling a tree and attaching it, and formatting is set through a Properties() accessor. Where the typed API does not cover something, X() drops you to the raw Open XML schema.

Word documents

AreaCovers
TextRuns and paragraphs, named styles, spacing and indentation, borders, lists, right-to-left text.
Page layoutPage size and orientation, headers and footers including odd/even and first-page variants, page numbers.
TablesRows and cells, widths, borders and shading, column spans and vertical merges, page-break behavior.
ImagesInline and anchored images, effects, text wrapping, watermarks.
FormsContent controls, legacy form fields and ActiveX controls, and which to use.
Find and edit contentWalking an existing document to locate, replace, remove, split and merge content.
Comments and revisionsComments with reply threads, and tracked insertions and deletions.
Templates and mail mergeMerge fields, placeholder substitution, filling content controls by tag.
Extracting contentText with or without list numbering, built-in and custom properties.
Converting to PDFNative conversion, custom fonts, and the Word-driven OLE path.

Spreadsheets

AreaCovers
CellsShared cell styles, borders, number and date formats, conditional formatting, merging, rotation, wrapping, comments.
Rows and columnsInserting rows, removing columns, freezing panes, sorting and filtering, large sheets.
FormulasWriting formulas, evaluating them in Go with a built-in function library, flattening to values, named ranges.
ChartsSixteen chart types, with a table of which constructor builds which.
ImagesPlacing pictures on a sheet and extracting the ones already there.
ValidationDrop-down lists and input rules, and the structural check to run before saving.

Presentations

AreaCovers
Slides and layoutsBuilding a deck, slide sizes, copying and reordering slides.
ContentText boxes, tables, images and charts as shapes on a slide.
TemplatesFilling a designer’s .pptx by layout and placeholder.
ExtractionReading text and pulling images back out.

What UniOffice does not do

Worth knowing before you commit to it.

Legacy Office formats are not supported. UniOffice reads and writes .docx, .xlsx and .pptx. All three readers open the file as a ZIP archive, which is what an Open XML package is, and return parsing zip: ... if it is not one. The pre-2007 .doc, .xls and .ppt files use the older OLE compound binary format rather than ZIP, so they fail at that point. Convert them to the modern format first.

Workbook protection is not file encryption. Spreadsheets can be protected: WorkbookProtection and SheetProtection lock the structure, the windows, a sheet or its objects, each with a password. That protection asks Excel to refuse edits. It does not encrypt anything, and the file’s contents stay fully readable without the password, so it guards against accidental changes rather than against a determined reader. Word documents and presentations have no equivalent API.

Encrypted files cannot be opened. There is no support for reading a document that has been password-encrypted, and no way to write one. If the file itself must be protected at rest, encrypt it in your own storage layer.

PDF conversion is UniOffice’s own rendering, not Word’s, and it needs a UniPDF license alongside the UniOffice one. Where matching Word exactly matters, the OLE path drives a real Word installation on Windows instead.

Ready to get started?

The getting started guide covers creating a UniCloud account, generating an API key, loading it, and writing your first Word, Excel and PowerPoint file. The FAQ answers the questions that come up most often, licensing included.

Start Building

Last updated on