Documentation ¶
Index ¶
- Variables
- func AppXmlGenerator(sheetNames []string) io.Reader
- func CleanNonUtfAndControlChar(s string) string
- func ContentTypeGenerator(sheetNames []string) io.Reader
- func DummyAppXml() io.Reader
- func DummyContentTypes() io.Reader
- func DummyCoreXml() io.Reader
- func DummyRelsDotRels() io.Reader
- func DummyStyleXml() io.Reader
- func DummyThemeXml() io.Reader
- func DummyWorkbookRels() io.Reader
- func DummyWorkbookXml() io.Reader
- func Export(filename string, fetcher RowFetcher)
- func ExportMultisheet(filename string, fetcher SheetFetcher)
- func ExportWorksheet(filename string, rows RowFetcher, SharedStrWriter *bufio.Writer, ...)
- func GetSheetId(file io.Reader, sheetTarget string) string
- func PartitionSharedString(filename string) error
- func Power(base, power int) int
- func RandStringRunes(n int) string
- func SeekString(filename string, index int) string
- func WorkbookRelGenerator(sheetNames []string) io.Reader
- func WorkbookXMLGenerator(sheetNames []string) io.Reader
- type Column
- type Row
- type RowFetcher
- type Sheet
- type SheetFetcher
- type SheetNamer
- type WriteWorker
- type XlsxC
- type XlsxCfRule
- type XlsxCfvo
- type XlsxCol
- type XlsxColorScale
- type XlsxCols
- type XlsxConditionalFormatting
- type XlsxRow
- type XlsxRowFetcher
- type XlsxSheet
- type XlsxSheets
Constants ¶
This section is empty.
Variables ¶
var NUM_WRITER = 2
var PARTITION_SIZE = 300 //the smaller the faster but it will produce more temporary file
var READ_TEMP_DIR = "./" //dont forget to end it with path separator
var SheetNotFoundError = errors.New("Sheet Not Found")
var TempDir = "./xl/worksheets/"
Functions ¶
func AppXmlGenerator ¶
func ContentTypeGenerator ¶
func DummyAppXml ¶
func DummyContentTypes ¶
func DummyCoreXml ¶
func DummyRelsDotRels ¶
func DummyStyleXml ¶
func DummyThemeXml ¶
func DummyWorkbookRels ¶
func DummyWorkbookXml ¶
func Export ¶
func Export(filename string, fetcher RowFetcher)
func ExportMultisheet ¶
func ExportMultisheet(filename string, fetcher SheetFetcher)
func ExportWorksheet ¶
func ExportWorksheet(filename string, rows RowFetcher, SharedStrWriter *bufio.Writer, cellsCount *int)
func PartitionSharedString ¶
func RandStringRunes ¶
func SeekString ¶
func WorkbookRelGenerator ¶
func WorkbookXMLGenerator ¶
Types ¶
type Row ¶
type Row struct { Collapsed bool `xml:"collapsed,attr,omitempty"` CustomFormat bool `xml:"customFormat,attr,omitempty"` CustomHeight bool `xml:"customHeight,attr,omitempty"` Hidden bool `xml:"hidden,attr,omitempty"` Ht float64 `xml:"ht,attr,omitempty"` OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"` Ph bool `xml:"ph,attr,omitempty"` R int `xml:"r,attr,omitempty"` S int `xml:"s,attr,omitempty"` Spans string `xml:"spans,attr,omitempty"` ThickBot bool `xml:"thickBot,attr,omitempty"` ThickTop bool `xml:"thickTop,attr,omitempty"` C []XlsxC `xml:"c"` }
type RowFetcher ¶
type RowFetcher interface {
NextRow() []string
}
Fetch next row, if no more row exists return nil
type Sheet ¶
type Sheet interface { RowFetcher SheetNamer }
type SheetFetcher ¶
Fetch next sheet, if no more row exists return nil
type SheetNamer ¶
type SheetNamer interface {
GetSheetName() string
}
type WriteWorker ¶
type WriteWorker struct { Source chan string CurPartition int Filename string TargetBuffer *bufio.Writer TargetFile io.Closer WorkerGroup *sync.WaitGroup }
func (*WriteWorker) Run ¶
func (self *WriteWorker) Run()
type XlsxC ¶
type XlsxC struct { R string `xml:"r,attr"` // Cell ID, e.g. A1 S int `xml:"s,attr,omitempty"` // Style reference. // Str string `xml:"str,attr,omitempty"` // Style reference. T string `xml:"t,attr,omitempty"` // Type. F *xlsxF `xml:"f,omitempty"` // Formula V string `xml:"v,omitempty"` // Value XMLSpace xml.Attr `xml:"space,attr,omitempty"` }
XlsxC directly maps the c element in the namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have not checked it for completeness - it does as much as I need.
type XlsxCfRule ¶
type XlsxCfRule struct { AboveAverage *bool `xml:"aboveAverage,attr"` Bottom bool `xml:"bottom,attr,omitempty"` DxfID *int `xml:"dxfId,attr"` EqualAverage bool `xml:"equalAverage,attr,omitempty"` Operator string `xml:"operator,attr,omitempty"` Percent bool `xml:"percent,attr,omitempty"` Priority int `xml:"priority,attr,omitempty"` Rank int `xml:"rank,attr,omitempty"` StdDev int `xml:"stdDev,attr,omitempty"` StopIfTrue bool `xml:"stopIfTrue,attr,omitempty"` Text string `xml:"text,attr,omitempty"` TimePeriod string `xml:"timePeriod,attr,omitempty"` Type string `xml:"type,attr,omitempty"` Formula []string `xml:"formula,omitempty"` ColorScale *XlsxColorScale `xml:"colorScale"` DataBar *xlsxDataBar `xml:"dataBar"` IconSet *xlsxIconSet `xml:"iconSet"` ExtLst *xlsxExtLst `xml:"extLst"` }
XlsxCfRule (Conditional Formatting Rule) represents a description of a conditional formatting rule.
type XlsxCfvo ¶
type XlsxCfvo struct { Gte bool `xml:"gte,attr,omitempty"` Type string `xml:"type,attr,omitempty"` Val int `xml:"val,attr"` ExtLst *xlsxExtLst `xml:"extLst"` }
cfvo (Conditional Format Value Object) describes the values of the interpolation points in a gradient scale.
type XlsxCol ¶
type XlsxCol struct { BestFit bool `xml:"bestFit,attr,omitempty"` Collapsed bool `xml:"collapsed,attr"` CustomWidth bool `xml:"customWidth,attr,omitempty"` Hidden bool `xml:"hidden,attr"` Max int `xml:"max,attr"` Min int `xml:"min,attr"` OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"` Phonetic bool `xml:"phonetic,attr,omitempty"` Style int `xml:"style,attr"` Width float64 `xml:"width,attr"` }
XlsxCol directly maps the col (Column Width & Formatting). Defines column width and column formatting for one or more columns of the worksheet.
type XlsxColorScale ¶
type XlsxColorScale struct {
Cfvo []*XlsxCfvo `xml:"cfvo"`
}
XlsxColorScale (Color Scale) describes a gradated color scale in this conditional formatting rule.
type XlsxCols ¶
type XlsxCols struct {
Col []XlsxCol `xml:"col"`
}
XlsxCols directly maps the cols element in the namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have not checked it for completeness - it does as much as I need.
type XlsxConditionalFormatting ¶
type XlsxConditionalFormatting struct { SQRef string `xml:"sqref,attr,omitempty"` CfRule []*XlsxCfRule `xml:"cfRule"` }
A Conditional Format is a format, such as cell shading or font color, that a spreadsheet application can automatically apply to cells if a specified condition is true. This collection expresses conditional formatting rules applied to a particular cell or range.
type XlsxRow ¶
type XlsxRow struct { Collapsed bool `xml:"collapsed,attr,omitempty"` CustomFormat bool `xml:"customFormat,attr,omitempty"` CustomHeight bool `xml:"customHeight,attr,omitempty"` Hidden bool `xml:"hidden,attr,omitempty"` Ht float64 `xml:"ht,attr,omitempty"` OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"` Ph bool `xml:"ph,attr,omitempty"` R int `xml:"r,attr,omitempty"` S int `xml:"s,attr,omitempty"` Spans string `xml:"spans,attr,omitempty"` ThickBot bool `xml:"thickBot,attr,omitempty"` ThickTop bool `xml:"thickTop,attr,omitempty"` C []XlsxC `xml:"c"` }
XlsxRow directly maps the row element. The element expresses information about an entire row of a worksheet, and contains all cell definitions for a particular row in the worksheet.
type XlsxRowFetcher ¶
type XlsxRowFetcher struct { Filename string ZipFile *zip.ReadCloser Decoder *xml.Decoder CurSheet io.ReadCloser IsUsingRamCache bool //set this to true if your sharedstring is relatively small // contains filtered or unexported fields }
func (*XlsxRowFetcher) Close ¶
func (s *XlsxRowFetcher) Close() error
func (*XlsxRowFetcher) NextRow ¶
func (self *XlsxRowFetcher) NextRow() []string
func (*XlsxRowFetcher) SeekString ¶
func (r *XlsxRowFetcher) SeekString(index int) string
seek string with some caching mechanism
type XlsxSheet ¶
type XlsxSheet struct { Name string `xml:"name,attr,omitempty"` SheetID string `xml:"sheetId,attr,omitempty"` ID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"` State string `xml:"state,attr,omitempty"` Fetcher RowFetcher `xml:"-"` }
XlsxSheet directly maps the sheet element from the namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have not checked it for completeness - it does as much as I need.
type XlsxSheets ¶
type XlsxSheets struct { Sheet []XlsxSheet `xml:"sheet"` Fetcher SheetFetcher `xml:"-"` }
XlsxSheets directly maps the sheets element from the namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main.