2017-09-07 06:16:43 -04:00
**gooxml** is a library for creation of Office Open XML documents (.docx, .xlsx
2017-09-15 17:44:25 -05:00
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.
2017-08-28 20:56:18 -05:00
[](https://travis-ci.org/baliance/gooxml)
2017-09-12 15:56:02 -05:00
[](https://github.com/baliance/gooxml/releases)
2017-09-07 15:28:23 -05:00
[](https://www.gnu.org/licenses/agpl-3.0)
2017-08-30 19:47:02 -05:00
[](https://godoc.org/baliance.com/gooxml)
2017-08-28 20:56:18 -05:00
2017-09-04 15:11:04 -05:00

2017-08-28 20:56:18 -05:00
## Status ##
2017-09-19 20:29:39 -04:00
- Documents (docx) [Word]
- Read/Write/Edit
- Formatting
- Images
- Tables
- Spreadsheets (xlsx) [Excel]
- Read/Write/Edit
- Cell Formatting
- Retrieving cell value as formatted by Excel (required parsing Excel format patterns)
- Formula Evaluation (100+ functions supported currently, more will be added as required)
- Images
- All chart types
- PowerPoint (pptx) [PowerPoint]
- Currently unsupprted, work still start soon.
2017-08-28 20:56:18 -05:00
2017-09-15 17:44:25 -05:00
## Performance ##
There has been a great deal of interest in performance numbers for spreadsheet
creation/reading lately, so here are gooxml numbers for this
[benchmark ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/lots-of-rows )
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.
2017-09-14 19:38:50 -05:00
## Current Work
The current work being performed is the implementation of a spreadsheet formula
parser and evaluator. Some initial progress has been made, but there is a long
way to go.
The intent is to get the vast majority of formulas working. The data in "A
Grammar for Spreadsheet Formulas Evaluated on Two Large Datasets - Efthimia
Aivaloglou, et al.", suggests that:
> (1) most Excel formulas are simple, however formulas with more than 50 functions or operations exist
> (2) almost all formulas use data from other cells, which is often not local, and
> (3) a surprising number of referring mechanisms are used by less than 1% of the formulas.
From this, it appears that we can quickly approach a point of diminishing
returns by implementing the most common formula features, saving others for
when/if users request it.
2017-08-28 20:56:18 -05:00
## Installation ##
go get baliance.com/gooxml/
2017-08-31 18:06:24 -05:00
go build -i baliance.com/gooxml/...
2017-08-28 20:56:18 -05:00
2017-09-01 15:35:20 -05:00
## Document Examples ##
- [Simple Text Formatting ](https://github.com/baliance/gooxml/tree/master/_examples/document/simple ) Text font colors, sizes, highlighting, etc.
- [Auto Generated Table of Contents ](https://github.com/baliance/gooxml/tree/master/_examples/document/toc ) Creating document headings with an auto generated TOC based off of the headingds
- [Floating Image ](https://github.com/baliance/gooxml/tree/master/_examples/document/image ) Placing an image somewhere on a page, absolutely positioned with different text wrapping.
- [Header & Footer ](https://github.com/baliance/gooxml/tree/master/_examples/document/header-footer ) Creating headers and footers including page numbering.
- [Multiple Headers & Footers ](https://github.com/baliance/gooxml/tree/master/_examples/document/header-footer-multiple ) Using different headers and footers depending on document section.
- [Inline Tables ](https://github.com/baliance/gooxml/tree/master/_examples/document/tables ) Adding an table with and without borders.
- [Using Existing Word Document as a Template ](https://github.com/baliance/gooxml/tree/master/_examples/document/use-template ) Opening a document as a template to re-use the styles created in the document.
- [Filling out Form Fields ](https://github.com/baliance/gooxml/tree/master/_examples/document/fill-out-form ) Opening a document with embedded form fields, filling out the fields and saving the result as a new filled form.
2017-09-07 15:28:23 -05:00
## Spreadsheet Examples ##
- [Simple ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/simple ) A simple sheet with a few cells
2017-09-09 10:12:13 -05:00
- [Named Cells ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/named-cells ) Different ways of referencing rows and cells
- [Cell Number/Date/Time Formats ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/number-date-time-formats ) Creating cells with various number/date/time formats
2017-09-07 15:28:23 -05:00
- [Line Chart ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/line-chart )/[Line Chart 3D ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/line-chart-3d ) Line Charts
- [Bar Chart ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/bar-chart ) Bar Charts
- [Mutiple Charts ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/multiple-charts ) Multiple charts on a single sheet
- [Named Cell Ranges ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/named-ranges ) Naming cell ranges
2017-09-09 10:12:13 -05:00
- [Merged Cells ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/merged ) Merge and unmerge cells
- [Conditional Formatting ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/conditional-formatting ) Conditionally formatting cells, styling, gradients, icons, data bar
- [Complex ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/complex ) Multiple charts, auto filtering and conditional formatting
2017-09-10 16:06:03 -05:00
- [Borders ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/borders ) Individual cell borders and rectangular borders around a range of cells.
2017-09-10 17:05:42 -05:00
- [Validation ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/validation ) Data validation including combo box dropdowns.
2017-09-10 19:16:12 -05:00
- [Frozen Rows/Cols ](https://github.com/baliance/gooxml/tree/master/_examples/spreadsheet/freeze-rows-cols ) A sheet with a frozen header column and row
2017-09-01 15:35:20 -05:00
2017-08-28 20:56:18 -05:00
## 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 ###
[](https://cla-assistant.io/baliance/gooxml)
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@baliance .com.
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.
### Consulting ###
Baliance also offers consulting services related to enhancing the gooxml library
2017-08-29 16:54:24 -05:00
on a case by case basis. Please contact consulting@baliance .com if interested.