sheet

package
v0.0.0-...-c5f69fb Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: ISC Imports: 12 Imported by: 0

Documentation

Overview

Implements functions required commands on a sheet.

Index

Constants

View Source
const (
	DISPLAY_RAW_VALUE_ROW    = 0
	DISPLAY_COMMAND_HELP_ROW = 1
	DISPLAY_SHEET_START_ROW  = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address string

func NewAddress

func NewAddress(row, column int) Address

Creates and address given an integer row and column.

func (Address) Column

func (addr Address) Column() int

Returns the integer value of the given address.

Columns are zero-based, using the letters A-Z, starting with A = 0.

func (Address) ColumnHeader

func (addr Address) ColumnHeader() string

Returns the column portion of the address as a string.

func (Address) Row

func (addr Address) Row() int

Returns the row portion of the address as an integer.

func (Address) RowCol

func (addr Address) RowCol() (row, column int)

Returns the row and column of the address as integers.

func (Address) Split

func (addr Address) Split() (row, column string)

Splits an address into row and column strings.

func (Address) String

func (addr Address) String() string

type Cell

type Cell struct {
	// contains filtered or unexported fields
}

func NewCell

func NewCell(value string, alignment align.Align, stringType bool) *Cell

Creates a new cell.

func (*Cell) Copy

func (c *Cell) Copy(oldAddress, newAddress Address) *Cell

Creates a copy of the cell, altering any formula that is contained based on where the cell is being moved. It uses the relative change between the old address and new address to figure out the differences to apply to every cell referenced in the formula.

func (*Cell) StatusBarVal

func (c *Cell) StatusBarVal() string

Gets the raw value in a format the also specifies any alignment defined in cell.

type ColumnFormat

type ColumnFormat struct {
	// contains filtered or unexported fields
}

type ErrCellNotFound

type ErrCellNotFound struct {
	Addr Address
}

func (*ErrCellNotFound) Error

func (e *ErrCellNotFound) Error() string

type Sheet

type Sheet struct {
	Filename string

	SelectedCell Address
	// contains filtered or unexported fields
}

func NewSheet

func NewSheet(filename string) Sheet

Creates a new sheet and loads a sheet from filename if it exists.

func (*Sheet) ClearCell

func (s *Sheet) ClearCell(address Address)

Removes the cell at the given address from a sheet.

func (*Sheet) DecreaseColumnPrecision

func (s *Sheet) DecreaseColumnPrecision(column string)

For a given column header string, decreases column precision.

func (*Sheet) DecreaseColumnWidth

func (s *Sheet) DecreaseColumnWidth(column string)

For a given column header string, decreases column width.

func (*Sheet) DisplayFormat

func (s *Sheet) DisplayFormat(address Address) string

Returns the the display format string specifying the Width, Precition, and Type of the column.

func (*Sheet) Export

func (s *Sheet) Export(path string) error

func (*Sheet) GetCell

func (s *Sheet) GetCell(address Address) (*Cell, error)

Returns the cell at the given address.

func (*Sheet) GoTo

func (s *Sheet) GoTo(adrs Address)

Move to a given address

func (*Sheet) IncreaseColumnPrecision

func (s *Sheet) IncreaseColumnPrecision(column string)

For a given column header string, increases column precision.

func (*Sheet) IncreaseColumnWidth

func (s *Sheet) IncreaseColumnWidth(column string)

For a given column header string, increases column width.

func (*Sheet) Load

func (s *Sheet) Load()

Load a sheet.

func (*Sheet) MoveDown

func (s *Sheet) MoveDown()

Move selected cell down one row.

func (*Sheet) MoveLeft

func (s *Sheet) MoveLeft()

Move selected cell left one column.

func (*Sheet) MoveRight

func (s *Sheet) MoveRight()

Move selected cell right on column.

func (*Sheet) MoveUp

func (s *Sheet) MoveUp()

Move selected cell up on row.

func (*Sheet) PutColumn

func (s *Sheet) PutColumn()

Puts the sheet's clipboard the the selected cell's column.

func (*Sheet) PutRow

func (s *Sheet) PutRow()

Puts the sheet's clipboard to the selected cell's row.

func (*Sheet) Save

func (s *Sheet) Save() error

Save a sheet.

func (*Sheet) SetCell

func (s *Sheet) SetCell(address Address, cell *Cell)

Sets the address to the passed in cell. Previous cell data that exists is thrown away.

func (*Sheet) Size

func (s *Sheet) Size() (width int, height int)

func (*Sheet) YankColumn

func (s *Sheet) YankColumn()

Yanks the column of the selected cell.

func (*Sheet) YankRow

func (s *Sheet) YankRow()

Yanks the row of the selected cell.

Directories

Path Synopsis
align
align

Jump to

Keyboard shortcuts

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