This closes #1148, resolve limitations when adding VBA project to the workbook

Added two exported functions `SetWorkbookPrOptions` and `GetWorkbookPrOptions` to support setting and getting the code name property of the workbook
Re-order fields of the workbook properties group to improve the compatibility
Go Modules dependencies upgrade
Put workbook related operating in new `workbook.go` source code
Library introduction docs block updated
pull/2/head
xuri 3 years ago
parent ad09698515
commit f87c39c41d
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
// //
// See https://xuri.me/excelize for more information about this package. // See https://xuri.me/excelize for more information about this package.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -6,9 +6,9 @@ require (
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/richardlehane/mscfb v1.0.4 github.com/richardlehane/mscfb v1.0.4
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/xuri/efp v0.0.0-20220201101309-d64cf20d930d github.com/xuri/efp v0.0.0-20220216053911-6d8731f62184
github.com/xuri/nfp v0.0.0-20220210053112-1df76b07693e github.com/xuri/nfp v0.0.0-20220215121256-71f1502108b5
golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 golang.org/x/image v0.0.0-20211028202545-6944b10bf410
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
golang.org/x/text v0.3.7 golang.org/x/text v0.3.7

@ -11,12 +11,12 @@ github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTK
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/xuri/efp v0.0.0-20220201101309-d64cf20d930d h1:zFggKNM0CSDVuK4Gzd7RNw5hFCHOETKZ7Nb5MHw+bCE= github.com/xuri/efp v0.0.0-20220216053911-6d8731f62184 h1:9nchVQT/GVLRvOnXzx+wUvSublH/jG/ANV4MxBnGhUA=
github.com/xuri/efp v0.0.0-20220201101309-d64cf20d930d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI= github.com/xuri/efp v0.0.0-20220216053911-6d8731f62184/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
github.com/xuri/nfp v0.0.0-20220210053112-1df76b07693e h1:8Bg6HoC/EdUGR3Y9Vx12XoD/RfMta06hFamKO+NK7Bc= github.com/xuri/nfp v0.0.0-20220215121256-71f1502108b5 h1:Pg6lKJe2FUZTalbUygJxgW1ke2re9lY3YW5TKb+Pxe4=
github.com/xuri/nfp v0.0.0-20220210053112-1df76b07693e/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ= github.com/xuri/nfp v0.0.0-20220215121256-71f1502108b5/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2 h1:XdAboW3BNMv9ocSCOk/u1MFioZGzCNkiJZ19v9Oe3Ig= golang.org/x/crypto v0.0.0-20220214200702-86341886e292 h1:f+lwQ+GtmgoY+A2YaQxlSOnDjXcQ7ZRLWOHbC6HtRqE=
golang.org/x/crypto v0.0.0-20220210151621-f4118a5b28e2/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ= golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize
@ -37,8 +37,8 @@ type numberFormat struct {
ap, afterPoint, beforePoint, localCode, result, value, valueSectionType string ap, afterPoint, beforePoint, localCode, result, value, valueSectionType string
} }
// supportedTokenTypes list the supported number format token types currently.
var ( var (
// supportedTokenTypes list the supported number format token types currently.
supportedTokenTypes = []string{ supportedTokenTypes = []string{
nfp.TokenTypeCurrencyLanguage, nfp.TokenTypeCurrencyLanguage,
nfp.TokenTypeDateTimes, nfp.TokenTypeDateTimes,

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize
@ -93,35 +93,6 @@ func (f *File) contentTypesWriter() {
} }
} }
// getWorkbookPath provides a function to get the path of the workbook.xml in
// the spreadsheet.
func (f *File) getWorkbookPath() (path string) {
if rels := f.relsReader("_rels/.rels"); rels != nil {
rels.Lock()
defer rels.Unlock()
for _, rel := range rels.Relationships {
if rel.Type == SourceRelationshipOfficeDocument {
path = strings.TrimPrefix(rel.Target, "/")
return
}
}
}
return
}
// getWorkbookRelsPath provides a function to get the path of the workbook.xml.rels
// in the spreadsheet.
func (f *File) getWorkbookRelsPath() (path string) {
wbPath := f.getWorkbookPath()
wbDir := filepath.Dir(wbPath)
if wbDir == "." {
path = "_rels/" + filepath.Base(wbPath) + ".rels"
return
}
path = strings.TrimPrefix(filepath.Dir(wbPath)+"/_rels/"+filepath.Base(wbPath)+".rels", "/")
return
}
// getWorksheetPath construct a target XML as xl/worksheets/sheet%d by split // getWorksheetPath construct a target XML as xl/worksheets/sheet%d by split
// path, compatible with different types of relative paths in // path, compatible with different types of relative paths in
// workbook.xml.rels, for example: worksheets/sheet%d.xml // workbook.xml.rels, for example: worksheets/sheet%d.xml
@ -135,35 +106,6 @@ func (f *File) getWorksheetPath(relTarget string) (path string) {
return path return path
} }
// workbookReader provides a function to get the pointer to the workbook.xml
// structure after deserialization.
func (f *File) workbookReader() *xlsxWorkbook {
var err error
if f.WorkBook == nil {
wbPath := f.getWorkbookPath()
f.WorkBook = new(xlsxWorkbook)
if _, ok := f.xmlAttr[wbPath]; !ok {
d := f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(wbPath))))
f.xmlAttr[wbPath] = append(f.xmlAttr[wbPath], getRootElement(d)...)
f.addNameSpaces(wbPath, SourceRelationship)
}
if err = f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(wbPath)))).
Decode(f.WorkBook); err != nil && err != io.EOF {
log.Printf("xml decode error: %s", err)
}
}
return f.WorkBook
}
// workBookWriter provides a function to save workbook.xml after serialize
// structure.
func (f *File) workBookWriter() {
if f.WorkBook != nil {
output, _ := xml.Marshal(f.WorkBook)
f.saveFileList(f.getWorkbookPath(), replaceRelationshipsBytes(f.replaceNameSpaceBytes(f.getWorkbookPath(), output)))
}
}
// mergeExpandedCols merge expanded columns. // mergeExpandedCols merge expanded columns.
func (f *File) mergeExpandedCols(ws *xlsxWorksheet) { func (f *File) mergeExpandedCols(ws *xlsxWorksheet) {
sort.Slice(ws.Cols.Col, func(i, j int) bool { sort.Slice(ws.Cols.Col, func(i, j int) bool {
@ -276,17 +218,6 @@ func (f *File) setSheet(index int, name string) {
f.xmlAttr[path] = []xml.Attr{NameSpaceSpreadSheet} f.xmlAttr[path] = []xml.Attr{NameSpaceSpreadSheet}
} }
// setWorkbook update workbook property of the spreadsheet. Maximum 31
// characters are allowed in sheet title.
func (f *File) setWorkbook(name string, sheetID, rid int) {
content := f.workbookReader()
content.Sheets.Sheet = append(content.Sheets.Sheet, xlsxSheet{
Name: trimSheetName(name),
SheetID: sheetID,
ID: "rId" + strconv.Itoa(rid),
})
}
// relsWriter provides a function to save relationships after // relsWriter provides a function to save relationships after
// serialize structure. // serialize structure.
func (f *File) relsWriter() { func (f *File) relsWriter() {

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize
@ -25,7 +25,7 @@ type SheetPrOptionPtr interface {
} }
type ( type (
// CodeName is a SheetPrOption // CodeName is an option used for SheetPrOption and WorkbookPrOption
CodeName string CodeName string
// EnableFormatConditionsCalculation is a SheetPrOption // EnableFormatConditionsCalculation is a SheetPrOption
EnableFormatConditionsCalculation bool EnableFormatConditionsCalculation bool

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
// //
// This file contains default templates for XML files we don't yet populated // This file contains default templates for XML files we don't yet populated
// based on content. // based on content.

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -0,0 +1,147 @@
// Copyright 2016 - 2022 The excelize Authors. All rights reserved. Use of
// this source code is governed by a BSD-style license that can be found in
// the LICENSE file.
//
// Package excelize providing a set of functions that allow you to write to and
// read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// Supports complex components by high compatibility, and provided streaming
// API for generating or reading data from a worksheet with huge amounts of
// data. This library needs Go version 1.15 or later.
package excelize
import (
"bytes"
"encoding/xml"
"io"
"log"
"path/filepath"
"strconv"
"strings"
)
// WorkbookPrOption is an option of a view of a workbook. See SetWorkbookPrOptions().
type WorkbookPrOption interface {
setWorkbookPrOption(pr *xlsxWorkbookPr)
}
// WorkbookPrOptionPtr is a writable WorkbookPrOption. See GetWorkbookPrOptions().
type WorkbookPrOptionPtr interface {
WorkbookPrOption
getWorkbookPrOption(pr *xlsxWorkbookPr)
}
// setWorkbook update workbook property of the spreadsheet. Maximum 31
// characters are allowed in sheet title.
func (f *File) setWorkbook(name string, sheetID, rid int) {
content := f.workbookReader()
content.Sheets.Sheet = append(content.Sheets.Sheet, xlsxSheet{
Name: trimSheetName(name),
SheetID: sheetID,
ID: "rId" + strconv.Itoa(rid),
})
}
// getWorkbookPath provides a function to get the path of the workbook.xml in
// the spreadsheet.
func (f *File) getWorkbookPath() (path string) {
if rels := f.relsReader("_rels/.rels"); rels != nil {
rels.Lock()
defer rels.Unlock()
for _, rel := range rels.Relationships {
if rel.Type == SourceRelationshipOfficeDocument {
path = strings.TrimPrefix(rel.Target, "/")
return
}
}
}
return
}
// getWorkbookRelsPath provides a function to get the path of the workbook.xml.rels
// in the spreadsheet.
func (f *File) getWorkbookRelsPath() (path string) {
wbPath := f.getWorkbookPath()
wbDir := filepath.Dir(wbPath)
if wbDir == "." {
path = "_rels/" + filepath.Base(wbPath) + ".rels"
return
}
path = strings.TrimPrefix(filepath.Dir(wbPath)+"/_rels/"+filepath.Base(wbPath)+".rels", "/")
return
}
// workbookReader provides a function to get the pointer to the workbook.xml
// structure after deserialization.
func (f *File) workbookReader() *xlsxWorkbook {
var err error
if f.WorkBook == nil {
wbPath := f.getWorkbookPath()
f.WorkBook = new(xlsxWorkbook)
if _, ok := f.xmlAttr[wbPath]; !ok {
d := f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(wbPath))))
f.xmlAttr[wbPath] = append(f.xmlAttr[wbPath], getRootElement(d)...)
f.addNameSpaces(wbPath, SourceRelationship)
}
if err = f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(wbPath)))).
Decode(f.WorkBook); err != nil && err != io.EOF {
log.Printf("xml decode error: %s", err)
}
}
return f.WorkBook
}
// workBookWriter provides a function to save workbook.xml after serialize
// structure.
func (f *File) workBookWriter() {
if f.WorkBook != nil {
output, _ := xml.Marshal(f.WorkBook)
f.saveFileList(f.getWorkbookPath(), replaceRelationshipsBytes(f.replaceNameSpaceBytes(f.getWorkbookPath(), output)))
}
}
// SetWorkbookPrOptions provides a function to sets workbook properties.
//
// Available options:
// CodeName(string)
func (f *File) SetWorkbookPrOptions(opts ...WorkbookPrOption) error {
wb := f.workbookReader()
pr := wb.WorkbookPr
if pr == nil {
pr = new(xlsxWorkbookPr)
wb.WorkbookPr = pr
}
for _, opt := range opts {
opt.setWorkbookPrOption(pr)
}
return nil
}
// setWorkbookPrOption implements the WorkbookPrOption interface.
func (o CodeName) setWorkbookPrOption(pr *xlsxWorkbookPr) {
pr.CodeName = string(o)
}
// GetWorkbookPrOptions provides a function to gets workbook properties.
//
// Available options:
// CodeName(string)
func (f *File) GetWorkbookPrOptions(opts ...WorkbookPrOptionPtr) error {
wb := f.workbookReader()
pr := wb.WorkbookPr
for _, opt := range opts {
opt.getWorkbookPrOption(pr)
}
return nil
}
// getWorkbookPrOption implements the WorkbookPrOption interface and get the
// code name of thw workbook.
func (o *CodeName) getWorkbookPrOption(pr *xlsxWorkbookPr) {
if pr == nil {
*o = ""
return
}
*o = CodeName(pr.CodeName)
}

@ -0,0 +1,43 @@
package excelize
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func ExampleFile_SetWorkbookPrOptions() {
f := NewFile()
if err := f.SetWorkbookPrOptions(
CodeName("code"),
); err != nil {
fmt.Println(err)
}
// Output:
}
func ExampleFile_GetWorkbookPrOptions() {
f := NewFile()
var codeName CodeName
if err := f.GetWorkbookPrOptions(&codeName); err != nil {
fmt.Println(err)
}
fmt.Println("Defaults:")
fmt.Printf("- codeName: %q\n", codeName)
// Output:
// Defaults:
// - codeName: ""
}
func TestWorkbookPr(t *testing.T) {
f := NewFile()
wb := f.workbookReader()
wb.WorkbookPr = nil
var codeName CodeName
assert.NoError(t, f.GetWorkbookPrOptions(&codeName))
assert.Equal(t, "", string(codeName))
assert.NoError(t, f.SetWorkbookPrOptions(CodeName("code")))
assert.NoError(t, f.GetWorkbookPrOptions(&codeName))
assert.Equal(t, "code", string(codeName))
}

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -4,12 +4,12 @@
// //
// struct code generated by github.com/xuri/xgen // struct code generated by github.com/xuri/xgen
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize
@ -107,24 +107,24 @@ type xlsxFileVersion struct {
// http://schemas.openxmlformats.org/spreadsheetml/2006/main This element // http://schemas.openxmlformats.org/spreadsheetml/2006/main This element
// defines a collection of workbook properties. // defines a collection of workbook properties.
type xlsxWorkbookPr struct { type xlsxWorkbookPr struct {
AllowRefreshQuery bool `xml:"allowRefreshQuery,attr,omitempty"`
AutoCompressPictures bool `xml:"autoCompressPictures,attr,omitempty"`
BackupFile bool `xml:"backupFile,attr,omitempty"`
CheckCompatibility bool `xml:"checkCompatibility,attr,omitempty"`
CodeName string `xml:"codeName,attr,omitempty"`
Date1904 bool `xml:"date1904,attr,omitempty"` Date1904 bool `xml:"date1904,attr,omitempty"`
DefaultThemeVersion string `xml:"defaultThemeVersion,attr,omitempty"` ShowObjects string `xml:"showObjects,attr,omitempty"`
ShowBorderUnselectedTables *bool `xml:"showBorderUnselectedTables,attr"`
FilterPrivacy bool `xml:"filterPrivacy,attr,omitempty"` FilterPrivacy bool `xml:"filterPrivacy,attr,omitempty"`
HidePivotFieldList bool `xml:"hidePivotFieldList,attr,omitempty"`
PromptedSolutions bool `xml:"promptedSolutions,attr,omitempty"` PromptedSolutions bool `xml:"promptedSolutions,attr,omitempty"`
ShowInkAnnotation *bool `xml:"showInkAnnotation,attr"`
BackupFile bool `xml:"backupFile,attr,omitempty"`
SaveExternalLinkValues *bool `xml:"saveExternalLinkValues,attr"`
UpdateLinks string `xml:"updateLinks,attr,omitempty"`
CodeName string `xml:"codeName,attr,omitempty"`
HidePivotFieldList bool `xml:"hidePivotFieldList,attr,omitempty"`
ShowPivotChartFilter bool `xml:"showPivotChartFilter,attr,omitempty"`
AllowRefreshQuery bool `xml:"allowRefreshQuery,attr,omitempty"`
PublishItems bool `xml:"publishItems,attr,omitempty"` PublishItems bool `xml:"publishItems,attr,omitempty"`
CheckCompatibility bool `xml:"checkCompatibility,attr,omitempty"`
AutoCompressPictures *bool `xml:"autoCompressPictures,attr"`
RefreshAllConnections bool `xml:"refreshAllConnections,attr,omitempty"` RefreshAllConnections bool `xml:"refreshAllConnections,attr,omitempty"`
SaveExternalLinkValues bool `xml:"saveExternalLinkValues,attr,omitempty"` DefaultThemeVersion string `xml:"defaultThemeVersion,attr,omitempty"`
ShowBorderUnselectedTables bool `xml:"showBorderUnselectedTables,attr,omitempty"`
ShowInkAnnotation bool `xml:"showInkAnnotation,attr,omitempty"`
ShowObjects string `xml:"showObjects,attr,omitempty"`
ShowPivotChartFilter bool `xml:"showPivotChartFilter,attr,omitempty"`
UpdateLinks string `xml:"updateLinks,attr,omitempty"`
} }
// xlsxBookViews directly maps the bookViews element. This element specifies the // xlsxBookViews directly maps the bookViews element. This element specifies the

@ -2,12 +2,12 @@
// this source code is governed by a BSD-style license that can be found in // this source code is governed by a BSD-style license that can be found in
// the LICENSE file. // the LICENSE file.
// //
// Package excelize providing a set of functions that allow you to write to // Package excelize providing a set of functions that allow you to write to and
// and read from XLSX / XLSM / XLTM files. Supports reading and writing // read from XLAM / XLSM / XLSX / XLTM / XLTX files. Supports reading and
// spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports // writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// complex components by high compatibility, and provided streaming API for // Supports complex components by high compatibility, and provided streaming
// generating or reading data from a worksheet with huge amounts of data. This // API for generating or reading data from a worksheet with huge amounts of
// library needs Go version 1.15 or later. // data. This library needs Go version 1.15 or later.
package excelize package excelize

Loading…
Cancel
Save