Documentation
¶
Overview ¶
Package models defines data structures for Excel document representation.
Index ¶
- func GetDiffCSS() string
- type Alignment
- type ArrayFormula
- type AutoFilter
- type Border
- type BorderLine
- type Cell
- type CellChange
- type CellStyle
- type CellType
- type ChangeType
- type Chart
- type ChartAxes
- type ChartAxis
- type ChartLegend
- type ChartPosition
- type ChartSeries
- type ChartStyle
- type Comment
- type ConditionalFormat
- type DataValidation
- type DiffSummary
- type DocumentMetadata
- type DocumentProperties
- type ExcelDiff
- type ExcelDocument
- type Fill
- type FilterRule
- type Font
- type MergedCell
- type PivotDataField
- type PivotField
- type PivotTable
- type PivotTableSettings
- type RichTextRun
- type Sheet
- type SheetDiff
- type SheetProtection
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayFormula ¶
type ArrayFormula struct {
Formula string `json:"formula"`
Range string `json:"range"` // The range the array formula covers
IsCSE bool `json:"is_cse"` // Ctrl+Shift+Enter array formula
}
ArrayFormula represents an Excel array formula
type AutoFilter ¶
type AutoFilter struct {
Range string `json:"range"`
Filters map[string]FilterRule `json:"filters,omitempty"`
}
AutoFilter represents AutoFilter settings for a worksheet
type Border ¶
type Border struct {
Left *BorderLine `json:"left,omitempty"`
Right *BorderLine `json:"right,omitempty"`
Top *BorderLine `json:"top,omitempty"`
Bottom *BorderLine `json:"bottom,omitempty"`
}
type BorderLine ¶
type Cell ¶
type Cell struct {
Value interface{} `json:"value"`
Formula string `json:"formula,omitempty"`
FormulaR1C1 string `json:"formula_r1c1,omitempty"` // R1C1 reference style
ArrayFormula *ArrayFormula `json:"array_formula,omitempty"` // Array formula details
Style *CellStyle `json:"style,omitempty"`
Type CellType `json:"type"`
Comment *Comment `json:"comment,omitempty"`
Hyperlink string `json:"hyperlink,omitempty"`
DataValidation *DataValidation `json:"data_validation,omitempty"`
RichText []RichTextRun `json:"rich_text,omitempty"`
}
type CellChange ¶
type CellChange struct {
Cell string `json:"cell"`
Type ChangeType `json:"type"`
OldValue interface{} `json:"old_value,omitempty"`
NewValue interface{} `json:"new_value,omitempty"`
OldFormula string `json:"old_formula,omitempty"`
NewFormula string `json:"new_formula,omitempty"`
Description string `json:"description,omitempty"`
}
type ChangeType ¶
type ChangeType string
const ( ChangeTypeAdd ChangeType = "add" ChangeTypeModify ChangeType = "modify" ChangeTypeDelete ChangeType = "delete" )
type Chart ¶
type Chart struct {
ID string `json:"id"`
Type string `json:"type"` // bar, line, pie, scatter, etc.
Title string `json:"title,omitempty"`
Position ChartPosition `json:"position"`
Series []ChartSeries `json:"series"`
Legend *ChartLegend `json:"legend,omitempty"`
Axes *ChartAxes `json:"axes,omitempty"`
Style *ChartStyle `json:"style,omitempty"`
}
Chart represents an Excel chart object
type ChartLegend ¶
type ChartPosition ¶
type ChartSeries ¶
type ChartStyle ¶
type ConditionalFormat ¶
type ConditionalFormat struct {
Range string `json:"range"`
Type string `json:"type"`
Criteria string `json:"criteria,omitempty"`
Value interface{} `json:"value,omitempty"`
Minimum interface{} `json:"minimum,omitempty"`
Maximum interface{} `json:"maximum,omitempty"`
Format *CellStyle `json:"format,omitempty"`
}
type DataValidation ¶
type DataValidation struct {
Type string `json:"type"`
Operator string `json:"operator,omitempty"`
Formula1 string `json:"formula1,omitempty"`
Formula2 string `json:"formula2,omitempty"`
AllowBlank bool `json:"allow_blank,omitempty"`
ShowInputMessage bool `json:"show_input_message,omitempty"`
ShowErrorMessage bool `json:"show_error_message,omitempty"`
ErrorTitle string `json:"error_title,omitempty"`
Error string `json:"error,omitempty"`
PromptTitle string `json:"prompt_title,omitempty"`
Prompt string `json:"prompt,omitempty"`
}
type DiffSummary ¶
type DocumentMetadata ¶
type DocumentProperties ¶
type ExcelDiff ¶
type ExcelDiff struct {
Timestamp time.Time `json:"timestamp"`
Summary DiffSummary `json:"summary"`
SheetDiffs []SheetDiff `json:"sheet_diffs"`
}
func ComputeDiff ¶
func ComputeDiff(oldDoc, newDoc *ExcelDocument) *ExcelDiff
ComputeDiff computes the differences between two Excel documents
func (*ExcelDiff) HasChanges ¶
HasChanges returns true if the diff contains any changes
func (*ExcelDiff) ToColorizedDetailedString ¶
ToColorizedDetailedString returns a detailed colorized string representation
func (*ExcelDiff) ToColorizedString ¶
ToColorizedString returns a colorized string representation of the diff for terminal display
func (*ExcelDiff) ToDetailedString ¶
ToDetailedString returns a detailed string representation showing all changes
type ExcelDocument ¶
type ExcelDocument struct {
Version string `json:"version"`
Metadata DocumentMetadata `json:"metadata"`
Sheets []Sheet `json:"sheets"`
DefinedNames map[string]string `json:"defined_names,omitempty"`
Properties DocumentProperties `json:"properties,omitempty"`
}
ExcelDocument represents the complete Excel file structure
type FilterRule ¶
type FilterRule struct {
Column string `json:"column"`
Type string `json:"type"` // "list", "custom", "top10", etc.
Criteria []string `json:"criteria,omitempty"`
Operator string `json:"operator,omitempty"` // "and", "or"
}
FilterRule represents a filter rule for a column
type MergedCell ¶
type MergedCell struct {
Range string `json:"range"` // e.g., "A1:C3"
}
MergedCell represents a compact representation for merged cells
type PivotDataField ¶
type PivotField ¶
type PivotTable ¶
type PivotTable struct {
ID string `json:"id"`
Name string `json:"name"`
SourceRange string `json:"source_range"` // Range reference like "Sheet1!A1:D100"
TargetRange string `json:"target_range"` // Where pivot table is placed
RowFields []PivotField `json:"row_fields,omitempty"`
ColumnFields []PivotField `json:"column_fields,omitempty"`
DataFields []PivotDataField `json:"data_fields,omitempty"`
FilterFields []PivotField `json:"filter_fields,omitempty"`
Settings *PivotTableSettings `json:"settings,omitempty"`
}
PivotTable represents an Excel pivot table
type PivotTableSettings ¶
type RichTextRun ¶
RichTextRun represents a segment of rich text with its own formatting
type Sheet ¶
type Sheet struct {
Name string `json:"name"`
Index int `json:"index"`
Cells map[string]Cell `json:"cells"`
MergedCells []MergedCell `json:"merged_cells,omitempty"`
RowHeights map[int]float64 `json:"row_heights,omitempty"`
ColumnWidths map[string]float64 `json:"column_widths,omitempty"`
Hidden bool `json:"hidden"`
Protection *SheetProtection `json:"protection,omitempty"`
ConditionalFormats []ConditionalFormat `json:"conditional_formats,omitempty"`
Charts []Chart `json:"charts,omitempty"`
PivotTables []PivotTable `json:"pivot_tables,omitempty"`
Tables []Table `json:"tables,omitempty"`
AutoFilter *AutoFilter `json:"auto_filter,omitempty"`
}
type SheetDiff ¶
type SheetDiff struct {
SheetName string `json:"sheet_name"`
Action ChangeType `json:"action,omitempty"`
Changes []CellChange `json:"changes"`
}
type SheetProtection ¶
type SheetProtection struct {
Password string `json:"password,omitempty"`
EditObjects bool `json:"edit_objects,omitempty"`
EditScenarios bool `json:"edit_scenarios,omitempty"`
FormatCells bool `json:"format_cells,omitempty"`
FormatColumns bool `json:"format_columns,omitempty"`
FormatRows bool `json:"format_rows,omitempty"`
InsertColumns bool `json:"insert_columns,omitempty"`
InsertRows bool `json:"insert_rows,omitempty"`
InsertHyperlinks bool `json:"insert_hyperlinks,omitempty"`
DeleteColumns bool `json:"delete_columns,omitempty"`
DeleteRows bool `json:"delete_rows,omitempty"`
SelectLockedCells bool `json:"select_locked_cells,omitempty"`
SelectUnlockedCells bool `json:"select_unlocked_cells,omitempty"`
Sort bool `json:"sort,omitempty"`
AutoFilter bool `json:"auto_filter,omitempty"`
PivotTables bool `json:"pivot_tables,omitempty"`
}
type Table ¶
type Table struct {
Name string `json:"name"`
Range string `json:"range"`
ShowHeaders bool `json:"show_headers"`
ShowTotals bool `json:"show_totals"`
StyleName string `json:"style_name,omitempty"`
ShowFirstColumn bool `json:"show_first_column"`
ShowLastColumn bool `json:"show_last_column"`
Columns []string `json:"columns,omitempty"`
}
Table represents an Excel table (ListObject)