Skip to content
Pure go library for creating and processing Office Word (.docx), Excel (.xlsx) and Powerpoint (.pptx) documents
Branch: master
Clone or download
nkryuchkov and gunnsth Functions to copy and remove sheets (#281)
* Add funcs to remove sheet from workbook
- RemoveSheet added to remove sheet by index
- RemoveSheetByName added to remove sheet by its name
* Add `CopyRelationship` func to `Relationships`
* Add funcs `CopySheet`, `CopySheetByName`
- `CopySheet` copies sheet at the specified index
- `CopySheetByName` copies sheet with the specified name
* Make `CopyRelationship` return copied rel and bool flag
* Add func `CopyOverride` to `ContentTypes`
* Add test for `CopyRelationship`
* Add tests for sheet removing funcs
* Add test for `CopyOverride`
* Add tests for `CopySheet`, `CopySheetByName`
Latest commit 1783b65 May 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github meta: add github issue template Sep 6, 2017
_examples Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
algo Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
chart Rename package name to unioffice (#274) May 4, 2019
cmd Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
color Rename package name to unioffice (#274) May 4, 2019
common Functions to copy and remove sheets (#281) May 12, 2019
document Add tables loop to document's `Paragraphs` func (#280) May 11, 2019
drawing Rename package name to unioffice (#274) May 4, 2019
measurement spreadsheet: add support for column formatting Sep 9, 2017
presentation Rename package name to unioffice (#274) May 4, 2019
schema Rename package name to unioffice (#274) May 4, 2019
spreadsheet Functions to copy and remove sheets (#281) May 12, 2019
testdata document: read/restore all contents of a Word 2016 file Aug 30, 2017
testhelper Rename package name to unioffice (#274) May 4, 2019
vmldrawing Rename package name to unioffice (#274) May 4, 2019
zippkg Rename package name to unioffice (#274) May 4, 2019
.gitignore Add purl.oclc.org namespace support (#265) Apr 29, 2019
.travis.yml Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
CLA.md Rename package name to unioffice (#274) May 4, 2019
LICENSE initial commit Aug 29, 2017
LICENSE.commercial meta: add commercial EULA for those interested Oct 1, 2017
README.md Update README.md (#275) May 4, 2019
build-examples.sh meta: update version info Jul 27, 2018
codecov.yml meta: rename codecov.yml Sep 2, 2017
creator.go Rename package name to unioffice (#274) May 4, 2019
creator_test.go Rename package name to unioffice (#274) May 4, 2019
doc.go Rename package name to unioffice (#274) May 4, 2019
example_test.go Rename package name to unioffice (#274) May 4, 2019
filenames.go Rename package name to unioffice (#274) May 4, 2019
filenames_test.go Rename package name to unioffice (#274) May 4, 2019
go.mod Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
license.go Rename package name to unioffice (#274) May 4, 2019
license_test.go Rename package name to unioffice (#274) May 4, 2019
licensetype_string.go Rename package name to unioffice (#274) May 4, 2019
log.go Rename package name to unioffice (#274) May 4, 2019
mingo.go Rename package name to unioffice (#274) May 4, 2019
mingo_18.go Rename package name to unioffice (#274) May 4, 2019
optional.go Rename package name to unioffice (#274) May 4, 2019
optional_test.go Rename package name to unioffice (#274) May 4, 2019
schemas.go Rename package name to unioffice (#274) May 4, 2019
test-coverage.sh Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
update-godoc.sh Move repository `https://github.com/baliance/gooxml` to `https://gith… May 4, 2019
update-version.sh Rename package name to unioffice (#274) May 4, 2019
version.go Rename package name to unioffice (#274) May 4, 2019
xml.go Rename package name to unioffice (#274) May 4, 2019
xml_test.go Rename package name to unioffice (#274) May 4, 2019
xsdany.go Rename package name to unioffice (#274) May 4, 2019
xsdany_test.go Rename package name to unioffice (#274) May 4, 2019

README.md

Announcement (2019/04/29): UniDoc aquires gooxml. UniDoc (https://unidoc.io and https://github.com/unidoc) has aquired gooxml from Baliance and we plan to add it to our suite of document format support for Go.

The repository (gooxml) will be moving to a new home: https://github.com/unidoc/unioffice and the package name will be come unioffice.

This will require updating import paths of existing code to github.com/unidoc/unioffice. This move will take place in the weekend of the 5th of May.

Update 2019/05/04: The move has been completed.



unioffice is a library for creation of Office Open XML documents (.docx, .xlsx and .pptx). It's goal is to be the most compatible and highest performance Go library for creation and editing of docx/xlsx/pptx files.

Requires go1.8+, builds are tested with 1.8, 1.9 and tip.

Build Status GitHub (pre-)release License: AGPL v3 GoDoc go 1.8+

https://github.com/unidoc/unioffice/

Status

  • Documents (docx) [Word]
    • Read/Write/Edit
    • Formatting
    • Images
    • Tables
  • Spreadsheets (xlsx) [Excel]
    • Read/Write/Edit
    • Cell formatting including conditional formatting
    • Cell validation (drop down combobox, rules, etc.)
    • Retrieve cell values as formatted by Excel (e.g. retrieve a date or number as displayed in Excel)
    • Formula Evaluation (100+ functions supported currently, more will be added as required)
    • Embedded Images
    • All chart types
  • PowerPoint (pptx) [PowerPoint]
    • Creation from templates
    • Textboxes/shapes

Performance

There has been a great deal of interest in performance numbers for spreadsheet creation/reading lately, so here are unioffice numbers for this benchmark which creates a sheet with 30k rows, each with 100 columns.

creating 30000 rows * 100 cells took 3.92506863s
saving took 89ns
reading took 9.522383048s

Creation is fairly fast, saving is very quick due to no reflection usage, and reading is a bit slower. The downside is that the binary is large (33MB) as it contains generated structs, serialization and deserialization code for all of DOCX/XLSX/PPTX.

Installation

go get github.com/unidoc/unioffice/
go build -i github.com/unidoc/unioffice/...

Document Examples

Spreadsheet Examples

Presentation Examples

Raw Types

The OOXML specification is large and creating a friendly API to cover the entire specification is a very time consuming endeavor. This library attempts to provide an easy to use API for common use cases in creating OOXML documents while allowing users to fall back to raw document manipulation should the library's API not cover a specific use case.

The raw XML based types reside in the schema/ directory. These types are accessible from the wrapper types via a X() method that returns the raw type.

For example, the library currently doesn't have an API for setting a document background color. However it's easy to do manually via editing the CT_Background element of the document.

dox := document.New()
doc.X().Background = wordprocessingml.NewCT_Background()
doc.X().Background.ColorAttr = &wordprocessingml.ST_HexColor{}
doc.X().Background.ColorAttr.ST_HexColorRGB = color.RGB(50, 50, 50).AsRGBString()

Contribution guidelines

CLA assistant

All contributors are must sign a contributor license agreement before their code will be reviewed and merged.

Licensing

This library is offered under a dual license. It is freely available for use under the terms of AGPLv3. If you would like to use this library for a closed source project, please contact sales@unidoc.io.

There are no differences in functionality between the open source and commercial versions. You are encouraged to use the open source version to evaluate the library before purchasing a commercial license.

You can’t perform that action at this time.