xlsxw

package
v0.48.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package xlsxw implements output writers for Microsoft Excel. It uses the https://github.com/qax-os/excelize library. See docs: https://xuri.me/excelize

Index

Constants

View Source
const SheetName = "data"

Variables

View Source
var (
	// OptDatetimeFormat is Excel's custom datetime format string.
	OptDatetimeFormat = options.NewString(
		"format.excel.datetime",
		nil,
		"yyyy-mm-dd hh:mm",
		func(s string) error {
			err := validateDatetimeFormatString(s)
			return errz.Wrap(err, "config: format.excel.datetime: invalid format string")
		},
		"Timestamp format string for Excel datetime values",
		`Timestamp format for datetime values: that is, for values that have both a date
and time component. The exact format is specific to Microsoft Excel, but is
broadly similar to strftime.

Examples:

  "yyyy-mm-dd hh:mm"           1989-11-09 16:07
  "dd/mm/yy h:mm am/pm"        09/11/89 4:07 pm
  "dd-mmm-yy h:mm:ss AM/PM"    09-Nov-89 4:07:01 PM
`,
		options.TagOutput,
	)

	// OptDateFormat is Excel's custom date-only format string.
	OptDateFormat = options.NewString(
		"format.excel.date",
		nil,
		"yyyy-mm-dd",
		func(s string) error {
			err := validateDatetimeFormatString(s)
			return errz.Wrap(err, "config: format.excel.date: invalid format string")
		},
		"Date format string for Excel date-only values",
		`Date format string for Microsoft Excel date-only values. The exact format is
specific to Excel, but is broadly similar to strftime.

Examples:

  "yyyy-mm-dd"	  1989-11-09
  "dd/mm/yy"      09/11/89
  "dd-mmm-yy"     09-Nov-89`,
		options.TagOutput,
	)

	// OptTimeFormat is Excel's custom time format string.
	OptTimeFormat = options.NewString(
		"format.excel.time",
		nil,
		"hh:mm:ss",
		func(s string) error {
			err := validateDatetimeFormatString(s)
			return errz.Wrap(err, "config: format.excel.time: invalid format string")
		},
		"Time format string for Excel time-only values",
		`Time format string for Microsoft Excel time-only values. The exact format is
specific to Excel, but is broadly similar to strftime.

Examples:

  "hh:mm:ss"         16:07:10
  "h:mm am/pm"	     4:07 pm
  "h:mm:ss AM/PM"    4:07:01 PM

Note that time-only values are sometimes programmatically indistinguishable from
datetime values. In that situation, use format.excel.datetime instead.`,
		options.TagOutput,
	)
)

Functions

func NewFile added in v0.41.0

func NewFile() (*excelize.File, error)

NewFile returns a new file with a single, empty sheet named "data".

func NewRecordWriter

func NewRecordWriter(out io.Writer, pr *output.Printing) output.RecordWriter

NewRecordWriter returns an output.RecordWriter instance for XLSX.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL