Documentation
¶
Index ¶
- func GetFileExtension(mimeType string) string
- type ChartContent
- type Document
- type Element
- type File
- type FileType
- type ImageContent
- type NodeType
- type OLEContent
- type PDFContent
- type Relationship
- type Relationships
- type TableContent
- type TextContent
- type VBAContent
- type WordNode
- type WordNodeClassifier
- func (c *WordNodeClassifier) DumpToFiles() map[string][]types.File
- func (c *WordNodeClassifier) GetAllTables() []string
- func (c *WordNodeClassifier) GetAllText() string
- func (c *WordNodeClassifier) GetChartInfo() []map[string]string
- func (c *WordNodeClassifier) GetImageInfo() []map[string]string
- func (c *WordNodeClassifier) GetOLEInfo() []map[string]string
- func (c *WordNodeClassifier) GetPDFInfo() []map[string]string
- func (c *WordNodeClassifier) GetStatistics() map[string]int
- func (c *WordNodeClassifier) GetVBAInfo() []map[string]string
- func (c *WordNodeClassifier) PrintSummary() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFileExtension ¶
GetFileExtension 根据MIME类型获取文件扩展名
Types ¶
type ChartContent ¶
type ChartContent struct {
Type string // 图表类型
Data []byte // 图表数据
ChartData interface{} // 解析后的图表数据
}
ChartContent 图表节点内容
type Document ¶
type Document struct {
XMLName xml.Name `xml:"document"`
Body struct {
Elements []Element `xml:",any"`
} `xml:"body"`
}
Document 定义文档结构
type Element ¶
type Element struct {
XMLName xml.Name
Content string `xml:",chardata"`
Attrs []xml.Attr `xml:",any,attr"`
Children []Element `xml:",any"`
}
Element 定义文档元素
type File ¶
type File struct {
Name string // 文件名
Data []byte // 文件内容(兼容旧版本)
Content string // 文本内容
BinaryData []byte // 二进制数据
FileName string // 文件名(用于二进制文件)
Metadata map[string]string // 附加信息
}
File 定义文件对象
type FileType ¶
type FileType string
FileType 定义文件类型
const ( FileTypeText FileType = "text" FileTypeTable FileType = "table" FileTypeImage FileType = "image" FileTypeChart FileType = "chart" FileTypePDF FileType = "pdf" FileTypeOLE FileType = "ole" FileTypeVBA FileType = "vba" FileTypeVideo FileType = "video" FileTypeVideoData FileType = "videodata" // 视频二进制数据 )
type ImageContent ¶
ImageContent 图片节点内容
type OLEContent ¶
OLEContent OLE对象内容
type Relationship ¶
type Relationship struct {
ID string `xml:"Id,attr"`
Type string `xml:"Type,attr"`
Target string `xml:"Target,attr"`
TargetMode string `xml:"TargetMode,attr"`
}
Relationship 定义文档关系
type Relationships ¶
type Relationships struct {
XMLName xml.Name `xml:"Relationships"`
Relationship []Relationship `xml:"Relationship"`
}
Relationships 定义文档关系集合
type TableContent ¶
TableContent 表格节点内容
type TextContent ¶
TextContent 文本节点内容
type WordNodeClassifier ¶
type WordNodeClassifier struct {
Texts []TextContent // 文本内容
Tables []TableContent // Excel表格
Images []ImageContent // 图片
Charts []ChartContent // 图表
PDFs []PDFContent // PDF附件
OLEs []OLEContent // OLE对象(如PPT)
VBAs []VBAContent // 宏代码(VBA)
}
WordNodeClassifier 用于存储分类后的节点
func (*WordNodeClassifier) DumpToFiles ¶
func (c *WordNodeClassifier) DumpToFiles() map[string][]types.File
DumpToFiles 将 WordNodeClassifier 对象转换为文件对象
func (*WordNodeClassifier) GetAllTables ¶
func (c *WordNodeClassifier) GetAllTables() []string
GetAllTables 获取所有表格内容的字符串表示
func (*WordNodeClassifier) GetAllText ¶
func (c *WordNodeClassifier) GetAllText() string
GetAllText 获取所有文本内容
func (*WordNodeClassifier) GetChartInfo ¶
func (c *WordNodeClassifier) GetChartInfo() []map[string]string
GetChartInfo 获取所有图表信息
func (*WordNodeClassifier) GetImageInfo ¶
func (c *WordNodeClassifier) GetImageInfo() []map[string]string
GetImageInfo 获取所有图片信息
func (*WordNodeClassifier) GetOLEInfo ¶
func (c *WordNodeClassifier) GetOLEInfo() []map[string]string
GetOLEInfo 获取所有OLE对象信息
func (*WordNodeClassifier) GetPDFInfo ¶
func (c *WordNodeClassifier) GetPDFInfo() []map[string]string
GetPDFInfo 获取所有PDF附件信息
func (*WordNodeClassifier) GetStatistics ¶
func (c *WordNodeClassifier) GetStatistics() map[string]int
GetStatistics 获取分类统计信息
func (*WordNodeClassifier) GetVBAInfo ¶
func (c *WordNodeClassifier) GetVBAInfo() []map[string]string
GetVBAInfo 获取所有VBA代码信息
func (*WordNodeClassifier) PrintSummary ¶
func (c *WordNodeClassifier) PrintSummary() string
PrintSummary 打印文档内容摘要
Click to show internal directories.
Click to hide internal directories.