2019-07-25 19:43:46 +03:00
|
|
|
// Copyright 2017 FoxyUtils ehf. All rights reserved.
|
2017-09-03 08:17:57 -05:00
|
|
|
//
|
|
|
|
// Use of this source code is governed by the terms of the Affero GNU General
|
|
|
|
// Public License version 3.0 as published by the Free Software Foundation and
|
|
|
|
// appearing in the file LICENSE included in the packaging of this file. A
|
|
|
|
// commercial license can be purchased by contacting sales@baliance.com.
|
|
|
|
|
|
|
|
package spreadsheet
|
|
|
|
|
|
|
|
import (
|
2017-10-02 18:15:59 -05:00
|
|
|
"runtime"
|
|
|
|
|
2019-05-04 11:18:06 +03:00
|
|
|
"github.com/unidoc/unioffice"
|
|
|
|
"github.com/unidoc/unioffice/common"
|
|
|
|
"github.com/unidoc/unioffice/schema/soo/sml"
|
2017-09-03 08:17:57 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// New constructs a new workbook.
|
|
|
|
func New() *Workbook {
|
|
|
|
wb := &Workbook{}
|
|
|
|
wb.x = sml.NewWorkbook()
|
|
|
|
|
2017-10-02 18:15:59 -05:00
|
|
|
runtime.SetFinalizer(wb, workbookFinalizer)
|
|
|
|
|
2017-09-03 08:17:57 -05:00
|
|
|
wb.AppProperties = common.NewAppProperties()
|
|
|
|
wb.CoreProperties = common.NewCoreProperties()
|
2017-09-05 18:42:39 -04:00
|
|
|
wb.StyleSheet = NewStyleSheet(wb)
|
2017-09-03 08:17:57 -05:00
|
|
|
|
|
|
|
wb.Rels = common.NewRelationships()
|
|
|
|
wb.wbRels = common.NewRelationships()
|
2017-09-28 17:05:38 -05:00
|
|
|
|
2019-05-04 13:54:29 +00:00
|
|
|
wb.Rels.AddRelationship(unioffice.RelativeFilename(unioffice.DocTypeSpreadsheet, "", unioffice.ExtendedPropertiesType, 0), unioffice.ExtendedPropertiesType)
|
|
|
|
wb.Rels.AddRelationship(unioffice.RelativeFilename(unioffice.DocTypeSpreadsheet, "", unioffice.CorePropertiesType, 0), unioffice.CorePropertiesType)
|
|
|
|
wb.Rels.AddRelationship(unioffice.RelativeFilename(unioffice.DocTypeSpreadsheet, "", unioffice.OfficeDocumentType, 0), unioffice.OfficeDocumentType)
|
|
|
|
wb.wbRels.AddRelationship(unioffice.RelativeFilename(unioffice.DocTypeSpreadsheet, unioffice.OfficeDocumentType, unioffice.StylesType, 0), unioffice.StylesType)
|
2017-09-03 08:17:57 -05:00
|
|
|
|
|
|
|
wb.ContentTypes = common.NewContentTypes()
|
2019-05-04 13:54:29 +00:00
|
|
|
wb.ContentTypes.AddDefault("vml", unioffice.VMLDrawingContentType)
|
|
|
|
wb.ContentTypes.AddOverride(unioffice.AbsoluteFilename(unioffice.DocTypeSpreadsheet, unioffice.OfficeDocumentType, 0), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml")
|
|
|
|
wb.ContentTypes.AddOverride(unioffice.AbsoluteFilename(unioffice.DocTypeSpreadsheet, unioffice.StylesType, 0), unioffice.SMLStyleSheetContentType)
|
2017-09-03 08:17:57 -05:00
|
|
|
|
|
|
|
wb.SharedStrings = NewSharedStrings()
|
2019-05-04 13:54:29 +00:00
|
|
|
wb.ContentTypes.AddOverride(unioffice.AbsoluteFilename(unioffice.DocTypeSpreadsheet, unioffice.SharedStingsType, 0), unioffice.SharedStringsContentType)
|
|
|
|
wb.wbRels.AddRelationship(unioffice.RelativeFilename(unioffice.DocTypeSpreadsheet, unioffice.OfficeDocumentType, unioffice.SharedStingsType, 0), unioffice.SharedStingsType)
|
2017-09-03 08:17:57 -05:00
|
|
|
|
|
|
|
return wb
|
|
|
|
}
|