MCPcopy
hub / github.com/unidoc/unioffice

github.com/unidoc/unioffice @v2.12.0 sqlite

repository ↗ · DeepWiki ↗ · release v2.12.0 ↗
22,077 symbols 56,926 edges 110 files 6,925 documented · 31%
README

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

Build Status GitHub (pre-)release License: UniDoc EULA ApiDocs

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

Status

  • Documents (docx) [Word]
    • Read/Write/Edit
    • Formatting
    • Images
    • Tables
    • Word to PDF (docx to pdf)
  • 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/v2

License key

This software package (unioffice) is a commercial product and requires a license code to operate.

To Get a Metered License API Key in the Free Tier, sign up on https://cloud.unidoc.io

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.

doc := 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

If you are interested in contributing, please contact us.

Development Notes

The bash script file run_test.sh could be used to run test and update the test result (if required). This script could receive the following parameter: - -s: Save a baseline, updates all the test result. - -v: Run the test in verbose mode. - t or --testname [test name]: Run a specific test name. For example -t AddImage would be running a TestAddImage test.

To run the script in dockerized environment, use the provided Makefile such as:

make docker-test

or

make docker-update-testdata

Go Version Compatibility

Officially we support three latest Go versions.

Support and consulting

Please email us at support@unidoc.io for any queries.

If you have any specific tasks that need to be done, we offer consulting in certain cases. Please contact us with a brief summary of what you need and we will get back to you with a quote, if appropriate.

License agreement

The use of this software package is governed by the end-user license agreement (EULA) available at: https://unidoc.io/eula/

Extension points exported contracts — how you extend this code

Any (Interface)
Any is the interface used for marshaling/unmarshaling xsd:any [2367 implementers]
unioffice.go
File (Interface)
File is a representation of a storage file with Read, Write, Close and Name methods identical to os.File. [10 implementers]
common/tempstorage/tempstorage.go
Axis (Interface)
Axis is the interface implemented by different axes when assigning to a chart. [4 implementers]
chart/chart.go
Any (Interface)
(no doc) [2367 implementers]
schema/schemas.microsoft.com/office/word/2018/wordml/wordml.go
Any (Interface)
(no doc) [2367 implementers]
schema/soo/dml/dml.go
Expression (Interface)
(no doc) [19 implementers]
spreadsheet/formula/formula.go
Logger (Interface)
Logger is the interface used for logging in the unipdf package. [3 implementers]
common/logger/logger.go
Anchor (Interface)
Anchor is the interface implemented by anchors. It's modeled after the most common anchor (Two cell variant with a from/ [3 …
spreadsheet/spreadsheet.go

Core symbols most depended-on inside this repo

Debug
called by 1666
common/logger/logger.go
ValidateWithPath
called by 1659
schema/soo/wml/wml.go
Skip
called by 1531
internal/mscfb/rw/rw.go
NewEG_RunLevelElts
called by 1159
schema/soo/wml/wml.go
UnmarshalXMLAttr
called by 1019
schema/urn/schemas_microsoft_com/vml/vml.go
NewEG_RangeMarkupElementsChoice
called by 802
schema/soo/wml/wml.go
ValidateWithPath
called by 798
schema/soo/dml/dml.go
NewEG_RangeMarkupElements
called by 784
schema/soo/wml/wml.go

Shape

Method 15,287
Function 3,453
Struct 2,794
TypeAlias 522
Interface 18
FuncType 3

Languages

Go100%

Modules by API surface

schema/soo/wml/wml.go3,129 symbols
schema/soo/sml/sml.go3,075 symbols
schema/soo/dml/dml.go2,281 symbols
schema/soo/pml/pml.go1,522 symbols
schema/soo/dml/chart/chart.go1,265 symbols
schema/soo/dml/diagram/diagram.go928 symbols
schema/urn/schemas_microsoft_com/vml/vml.go903 symbols
document/document.go834 symbols
schema/schemas.microsoft.com/office/drawing/2014/chartex/chartex.go768 symbols
schema/soo/ofc/math/math.go567 symbols
spreadsheet/formula/formula.go553 symbols
schema/schemas.microsoft.com/office/word/2010/wordml/wordml.go538 symbols

Dependencies from manifests, versioned

github.com/adrg/strutilv0.3.1 · 1×
github.com/adrg/sysfontv0.1.2 · 1×
github.com/adrg/xdgv0.5.3 · 1×
github.com/golang/freetypev0.0.0-2017060900350 · 1×
github.com/gorilla/i18nv0.0.0-2015082005142 · 1×
github.com/llgcode/draw2dv0.0.0-2024062706292 · 1×
github.com/pmezard/go-difflibv1.0.0 · 1×
github.com/richardlehane/msolepsv1.0.6 · 1×

For agents

$ claude mcp add unioffice \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact