Documentation
¶
Index ¶
- func ParseExcel(filePath string) (map[string][]types.File, error)
- type CommentContent
- type CondRuleContent
- type DataConnContent
- type ExcelNode
- type ExcelNodeClassifier
- type ExcelNodeDumper
- type FileType
- type FormulaContent
- type HiddenSheetContent
- type NameDefContent
- type NodeType
- type PowerQueryContent
- type TableContent
- type TextContent
- type URLContent
- type VBAContent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CommentContent ¶
type CommentContent struct {
SheetName string // 工作表名称
Cell string // 单元格位置
Author string // 作者名称
Text string // 批注内容
}
CommentContent 表示批注内容
type CondRuleContent ¶
type CondRuleContent struct {
SheetName string // 工作表名称
Range string // 应用区域
Type string // 规则类型
Formula string // 规则公式
FormatStyle string // 格式样式
}
CondRuleContent 表示条件规则内容
type DataConnContent ¶
type DataConnContent struct {
Name string // 连接名称
Description string // 连接描述
ConnectionString string // 连接字符串
Command string // 命令内容
Type string // 连接类型
}
DataConnContent 表示外部数据连接内容
type ExcelNode ¶
type ExcelNode struct {
Type NodeType // 节点类型
Content interface{} // 节点内容
}
ExcelNode 表示 Excel 文档中的一个节点
func ParseExcelFile ¶
ParseExcelFile 解析 Excel 文件,返回所有工作表中的内容
type ExcelNodeClassifier ¶
type ExcelNodeClassifier struct {
Tables []TableContent // 表格内容
Texts []TextContent // 文本内容
URLs []URLContent // URL内容
Formulas []FormulaContent // 公式内容
Comments []CommentContent // 批注内容
DataConns []DataConnContent // 外部数据连接
PowerQueries []PowerQueryContent // Power Query脚本
VBAs []VBAContent // VBA宏
HiddenSheets []HiddenSheetContent // 隐藏工作表
NameDefs []NameDefContent // 名称管理器定义
CondRules []CondRuleContent // 条件规则
}
ExcelNodeClassifier 用于存储分类后的节点
func ClassifyNodes ¶
func ClassifyNodes(nodes []ExcelNode) *ExcelNodeClassifier
ClassifyNodes 将解析结果分类
func (*ExcelNodeClassifier) DumpToFiles ¶
func (c *ExcelNodeClassifier) DumpToFiles() map[string][]types.File
DumpToFiles 将分类后的节点转换为文件
func (*ExcelNodeClassifier) GetStatistics ¶
func (c *ExcelNodeClassifier) GetStatistics() map[string]int
GetStatistics 获取分类统计信息
func (*ExcelNodeClassifier) PrintSummary ¶
func (c *ExcelNodeClassifier) PrintSummary() string
PrintSummary 打印文档内容摘要
type ExcelNodeDumper ¶
type ExcelNodeDumper struct {
// contains filtered or unexported fields
}
ExcelNodeDumper 用于将 Excel 节点转换为文件 注意:这是一个简单实现,推荐使用classifier.go中的方法 此代码保留是为了向后兼容
func NewDumper ¶
func NewDumper(nodes []ExcelNode) *ExcelNodeDumper
NewDumper 创建一个新的 dumper 注意:推荐使用classifier.go中的方法 此代码保留是为了向后兼容
func (*ExcelNodeDumper) DumpToFiles ¶
func (d *ExcelNodeDumper) DumpToFiles() map[string][]types.File
DumpToFiles 将节点转换为文件 注意:推荐使用classifier.go中的方法 此代码保留是为了向后兼容
type FileType ¶
type FileType string
FileType 定义文件类型
const ( FileTypeText FileType = "text" // 文本内容 FileTypeTable FileType = "table" // 表格内容 FileTypeURL FileType = "url" // URL内容 FileTypeFormula FileType = "formula" // 公式内容 FileTypeComment FileType = "comment" // 批注内容 FileTypeDataConn FileType = "dataconn" // 外部数据连接 FileTypePowerQuery FileType = "powerquery" // Power Query脚本 FileTypeVBA FileType = "vba" // VBA宏 FileTypeHiddenSheet FileType = "hiddensheet" // 隐藏工作表 FileTypeNameDef FileType = "namedef" // 名称管理器定义 FileTypeCondRule FileType = "condrule" // 条件规则 )
type FormulaContent ¶
type FormulaContent struct {
SheetName string // 工作表名称
Cell string // 单元格位置
Formula string // 公式内容
Result string // 公式结果
}
FormulaContent 表示公式内容
type HiddenSheetContent ¶
type HiddenSheetContent struct {
SheetName string // 工作表名称
Headers []string // 表头
Rows [][]string // 数据行
HideType string // 隐藏类型(普通隐藏、超隐藏)
}
HiddenSheetContent 表示隐藏工作表内容
type NameDefContent ¶
type NameDefContent struct {
Name string // 名称
RefersTo string // 引用内容
Comment string // 注释
Scope string // 作用域
}
NameDefContent 表示名称管理器定义内容
type NodeType ¶
type NodeType string
NodeType 定义节点类型
const ( TableNode NodeType = "table" // 表格节点 TextNode NodeType = "text" // 文本节点 URLNode NodeType = "url" // URL节点 FormulaNode NodeType = "formula" // 公式节点 CommentNode NodeType = "comment" // 批注节点 DataConnNode NodeType = "dataconn" // 外部数据连接节点 PowerQueryNode NodeType = "powerquery" // Power Query脚本节点 VBANode NodeType = "vba" // VBA宏节点 HiddenSheetNode NodeType = "hiddensheet" // 隐藏工作表节点 NameDefNode NodeType = "namedef" // 名称管理器定义节点 CondRuleNode NodeType = "condrule" // 条件规则节点 )
type PowerQueryContent ¶
PowerQueryContent 表示Power Query脚本内容
type TableContent ¶
type TableContent struct {
SheetName string // 工作表名称
Headers []string // 表头
Rows [][]string // 数据行
Metadata map[string]string // 元数据
}
TableContent 表示表格内容
type TextContent ¶
TextContent 表示文本内容
type URLContent ¶
URLContent 表示URL内容
type VBAContent ¶
VBAContent 表示VBA宏内容