parts

package
v0.0.0-...-a0d884f Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NamespaceExtendedProperties 扩展属性命名空间
	NamespaceExtendedProperties = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
	// NamespaceDocPropsVTypes 文档属性类型命名空间
	NamespaceDocPropsVTypes = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"
)
View Source
const (
	PlaceholderChartTitle    = "{{CHART_TITLE}}"
	PlaceholderCategories    = "{{CATEGORIES}}"
	PlaceholderSeriesName    = "{{SERIES_NAME}}"
	PlaceholderSeriesValues  = "{{SERIES_VALUES}}"
	PlaceholderCatCount      = "{{CAT_COUNT}}"
	PlaceholderCatCountPlus1 = "{{CAT_COUNT_PLUS_1}}"
	PlaceholderXValues       = "{{X_VALUES}}"
	PlaceholderYValues       = "{{Y_VALUES}}"
)
View Source
const (
	// 命名空间常量
	NamespaceCoreProperties  = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
	NamespaceDublinCore      = "http://purl.org/dc/elements/1.1/"
	NamespaceDublinCoreTerms = "http://purl.org/dc/terms/"
	NamespaceXMLSchema       = "http://www.w3.org/2001/XMLSchema-instance"

	// W3CDTF 类型标识
	W3CDTFType = "dcterms:W3CDTF"
)
View Source
const (
	// 关系命名空间
	NamespaceRelationships = "http://schemas.openxmlformats.org/package/2006/relationships"

	// 目标模式
	TargetModeInternal = "Internal"
	TargetModeExternal = "External"

	// 常用关系类型
	RelTypeImage       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
	RelTypeHyperlink   = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
	RelTypeSlide       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
	RelTypeSlideLayout = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"
	RelTypeSlideMaster = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"
	RelTypeTheme       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
	RelTypeNotesSlide  = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"
	RelTypeComments    = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
	RelTypeChart       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
	RelTypeTable       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
	RelTypeMedia       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"
	RelTypeAudio       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"
)
View Source
const (
	RelationshipTypeImage       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
	RelationshipTypeMedia       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"
	RelationshipTypeChart       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
	RelationshipTypeSlideLayout = "http://schemas.openxmlformats.org/presentationml/2006/relationships/slideLayout"
	RelationshipTypeSlideMaster = "http://schemas.openxmlformats.org/presentationml/2006/relationships/slideMaster"
	RelationshipTypeTable       = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table"
)

SlideLayoutType 关系类型常量

View Source
const ChartTemplateArea = `` /* 1946-byte string literal not displayed */

ChartTemplateArea 面积图模板

View Source
const ChartTemplateBar = `` /* 1975-byte string literal not displayed */

ChartTemplateBar 柱状图模板

View Source
const ChartTemplateDoughnut = `` /* 1549-byte string literal not displayed */

ChartTemplateDoughnut 环形图模板

View Source
const ChartTemplateLine = `` /* 2030-byte string literal not displayed */

ChartTemplateLine 折线图模板

View Source
const ChartTemplatePie = `` /* 1508-byte string literal not displayed */

ChartTemplatePie 饼图模板

View Source
const ChartTemplateScatter = `` /* 2077-byte string literal not displayed */

ChartTemplateScatter 散点图模板

View Source
const DefaultThemeXML = `` /* 11896-byte string literal not displayed */

DefaultThemeXML 默认 Office 主题 XML(完整版) 直接复制自标准 Office 主题,确保内容不缺漏

View Source
const SlideIDStart = 256

SlideIDStart 是 Slide ID 的起始值

View Source
const XMLDeclaration = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`

XMLDeclaration OPC 包中所有 XML 文件的标准声明头

Variables

View Source
var DefaultAppProps = &XMLAppProps{
	Application: "Microsoft Office PowerPoint",
	AppVersion:  "15.0000",
	Company:     "",
	Manager:     "",
}

DefaultAppProps 默认应用属性模板

View Source
var EMUToCentimeters = utils.EMUToCentimeters

EMUToCentimeters 将 EMU 转换为厘米

View Source
var EMUToInches = utils.EMUToInches

EMUToInches 将 EMU 转换为英寸

View Source
var EMUToPixels = utils.EMUToPixels

EMUToPixels 将 EMU 转换为像素(96 DPI)

View Source
var EMUToPoints = utils.EMUToPoints

EMUToPoints 将 EMU 转换为磅

View Source
var StandardSlideSizes = struct {
	// 16:9 宽屏 (12192000 x 6858000 EMU)
	Wide16x9 SlideSize
	// 4:3 标准 (9144000 x 6858000 EMU)
	Standard4x3 SlideSize
}{
	Wide16x9:    SlideSize{Cx: 12192000, Cy: 6858000},
	Standard4x3: SlideSize{Cx: 9144000, Cy: 6858000},
}

StandardSlideSizes 标准幻灯片尺寸

Functions

func EMUFromInches

func EMUFromInches(inches float64) int

EMUFromInches 将英寸转换为 EMU

func EMUFromMM

func EMUFromMM(mm float64) int

EMUFromMM 将毫米转换为 EMU

func EMUFromPoints

func EMUFromPoints(points float64) int

EMUFromPoints 将磅值转换为 EMU

func GetChartTemplate

func GetChartTemplate(chartType ChartType) string

GetChartTemplate 获取图表模板

func InchesFromEMU

func InchesFromEMU(emu int) float64

InchesFromEMU 将 EMU 转换为英寸

func MMFromEMU

func MMFromEMU(emu int) float64

MMFromEMU 将 EMU 转换为毫米

func PointsFromEMU

func PointsFromEMU(emu int) float64

PointsFromEMU 将 EMU 转换为磅值

func StripNamespacePrefixes

func StripNamespacePrefixes(data []byte) ([]byte, error)

StripNamespacePrefixes 处理 XML 数据,去除命名空间前缀使其兼容 Go 的 xml.Unmarshal Go 的 xml.Unmarshal 无法处理带前缀的 XML 命名空间(如 <p:presentation>) 此函数将 <p:xxx> 转换为 <xxx>,同时将带前缀的属性转换为无冒号形式(如 r:id -> rid)

Types

type AppPropsPart

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

AppPropsPart 应用程序属性部件

func NewAppPropsPart

func NewAppPropsPart() *AppPropsPart

NewAppPropsPart 创建新的应用程序属性部件

func (*AppPropsPart) AppProps

func (a *AppPropsPart) AppProps() *XMLAppProps

AppProps 返回应用属性数据

func (*AppPropsPart) FromXML

func (a *AppPropsPart) FromXML(data []byte) error

FromXML 从 XML 反序列化应用属性

func (*AppPropsPart) GetAppApplication

func (a *AppPropsPart) GetAppApplication() string

GetAppApplication 获取应用程序名称

func (*AppPropsPart) GetAppCompany

func (a *AppPropsPart) GetAppCompany() string

GetAppCompany 获取公司名称

func (*AppPropsPart) GetAppManager

func (a *AppPropsPart) GetAppManager() string

GetAppManager 获取管理者

func (*AppPropsPart) GetAppSlideCount

func (a *AppPropsPart) GetAppSlideCount() int

GetAppSlideCount 获取幻灯片数量

func (*AppPropsPart) GetAppTotalTime

func (a *AppPropsPart) GetAppTotalTime() int

GetAppTotalTime 获取总编辑时间(分钟)

func (*AppPropsPart) GetAppVersion

func (a *AppPropsPart) GetAppVersion() string

GetAppVersion 获取应用程序版本

func (*AppPropsPart) GetAppWordCount

func (a *AppPropsPart) GetAppWordCount() int

GetAppWordCount 获取字数

func (*AppPropsPart) PartURI

func (a *AppPropsPart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*AppPropsPart) SetAppApplication

func (a *AppPropsPart) SetAppApplication(app string)

SetAppApplication 设置应用程序名称

func (*AppPropsPart) SetAppCharacterCount

func (a *AppPropsPart) SetAppCharacterCount(count int)

SetAppCharacterCount 设置字符数量

func (*AppPropsPart) SetAppCompany

func (a *AppPropsPart) SetAppCompany(company string)

SetAppCompany 设置公司名称

func (*AppPropsPart) SetAppHeadingPairs

func (a *AppPropsPart) SetAppHeadingPairs(headingPairs *XMLHeadingPairs)

SetAppHeadingPairs 设置标题对

func (*AppPropsPart) SetAppHiddenSlideCount

func (a *AppPropsPart) SetAppHiddenSlideCount(count int)

SetAppHiddenSlideCount 设置隐藏幻灯片数量

func (*AppPropsPart) SetAppHyperlinkBase

func (a *AppPropsPart) SetAppHyperlinkBase(base string)

SetAppHyperlinkBase 设置超链接基础

func (*AppPropsPart) SetAppLinksUpToDate

func (a *AppPropsPart) SetAppLinksUpToDate(upToDate bool)

SetAppLinksUpToDate 设置链接是否最新

func (*AppPropsPart) SetAppMMClipCount

func (a *AppPropsPart) SetAppMMClipCount(count int)

SetAppMMClipCount 设置多媒体剪辑数量

func (*AppPropsPart) SetAppManager

func (a *AppPropsPart) SetAppManager(manager string)

SetAppManager 设置管理者

func (*AppPropsPart) SetAppNoteCount

func (a *AppPropsPart) SetAppNoteCount(count int)

SetAppNoteCount 设置备注数量

func (*AppPropsPart) SetAppParagraphCount

func (a *AppPropsPart) SetAppParagraphCount(count int)

SetAppParagraphCount 设置段落数量

func (*AppPropsPart) SetAppSharedDoc

func (a *AppPropsPart) SetAppSharedDoc(shared bool)

SetAppSharedDoc 设置是否共享文档

func (*AppPropsPart) SetAppSlideCount

func (a *AppPropsPart) SetAppSlideCount(count int)

SetAppSlideCount 设置幻灯片数量

func (*AppPropsPart) SetAppTitlesOfParts

func (a *AppPropsPart) SetAppTitlesOfParts(titlesOfParts *XMLTitlesOfParts)

SetAppTitlesOfParts 设置部件标题

func (*AppPropsPart) SetAppTotalTime

func (a *AppPropsPart) SetAppTotalTime(minutes int)

SetAppTotalTime 设置总编辑时间(分钟)

func (*AppPropsPart) SetAppVersion

func (a *AppPropsPart) SetAppVersion(version string)

SetAppVersion 设置应用程序版本

func (*AppPropsPart) SetAppWordCount

func (a *AppPropsPart) SetAppWordCount(count int)

SetAppWordCount 设置字数

func (*AppPropsPart) ToXML

func (a *AppPropsPart) ToXML() ([]byte, error)

ToXML 将应用属性序列化为 XML

type Background

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

Background 背景定义(只读) 对应 XML: <p:bg> 或 <p:cSld><p:bg> 设计说明:使用独立字段存储不同类型的值,避免接口带来的动态分配

func (*Background) GradientAngle

func (b *Background) GradientAngle() int32

GradientAngle 返回渐变角度(仅当 Type == BackgroundTypeGradient 时有效)

func (*Background) GradientColors

func (b *Background) GradientColors() []GradientStop

GradientColors 返回渐变色标列表(仅当 Type == BackgroundTypeGradient 时有效)

func (*Background) Opacity

func (b *Background) Opacity() float32

Opacity 返回不透明度 (0.0 - 1.0)

func (*Background) PictureRId

func (b *Background) PictureRId() string

PictureRId 返回图片关系 ID(仅当 Type == BackgroundTypePicture 时有效)

func (*Background) PictureURI

func (b *Background) PictureURI() string

PictureURI 返回图片内部 URI(仅当 Type == BackgroundTypePicture 时有效)

func (*Background) SolidColorRGB

func (b *Background) SolidColorRGB() string

SolidColorRGB 返回纯色背景的 RGB 值(仅当 Type == BackgroundTypeSolidColor 时有效)

func (*Background) Type

func (b *Background) Type() BackgroundType

Type 返回背景类型

type BackgroundType

type BackgroundType int8

BackgroundType 背景类型枚举 对应 XML: <p:bg> 下的不同子元素

const (
	BackgroundTypeNone       BackgroundType = iota // 无背景
	BackgroundTypeSolidColor                       // 纯色背景
	BackgroundTypeGradient                         // 渐变背景
	BackgroundTypePattern                          // 图案填充
	BackgroundTypePicture                          // 图片背景
	BackgroundTypeThemeColor                       // 主题色背景(如 bg1, tx1)
)

type ChartCategoryData

type ChartCategoryData struct {
	Categories []string          // 分类标签
	Series     []ChartSeriesData // 系列数据
}

ChartCategoryData 图表分类数据

type ChartPart

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

ChartPart 图表部件

func NewChartPart

func NewChartPart(id int) *ChartPart

NewChartPart 创建新的图表部件

func NewChartPartWithType

func NewChartPartWithType(id int, chartType ChartType) *ChartPart

NewChartPartWithType 创建指定类型的图表部件

func NewChartPartWithURI

func NewChartPartWithURI(uri *opc.PackURI) *ChartPart

NewChartPartWithURI 使用指定 URI 创建图表部件

func (*ChartPart) FromXML

func (c *ChartPart) FromXML(data []byte) error

FromXML 从 XML 加载图表(直接作为模板存储)

func (*ChartPart) GetExternalDataRID

func (c *ChartPart) GetExternalDataRID() string

GetExternalDataRID 获取外部数据关系 ID

func (*ChartPart) HasExternalData

func (c *ChartPart) HasExternalData() bool

HasExternalData 检查是否有外部数据

func (*ChartPart) PartURI

func (c *ChartPart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*ChartPart) ReplacePlaceholder

func (c *ChartPart) ReplacePlaceholder(placeholder, value string)

ReplacePlaceholder 替换单个占位符 placeholder: 占位符名称(不含 {{}}) value: 替换值

func (*ChartPart) ReplacePlaceholders

func (c *ChartPart) ReplacePlaceholders(replacements map[string]string)

ReplacePlaceholders 批量替换占位符

func (*ChartPart) SetExternalDataRID

func (c *ChartPart) SetExternalDataRID(rid string)

SetExternalDataRID 设置外部数据关系 ID

func (*ChartPart) SetRawXML

func (c *ChartPart) SetRawXML(xml []byte)

SetRawXML 设置原始 XML(等同于 SetTemplate,语义更清晰)

func (*ChartPart) SetTemplate

func (c *ChartPart) SetTemplate(tmpl string)

SetTemplate 设置图表模板

func (*ChartPart) Template

func (c *ChartPart) Template() string

Template 返回当前模板

func (*ChartPart) ToXML

func (c *ChartPart) ToXML() ([]byte, error)

ToXML 将图表序列化为 XML

type ChartSeriesData

type ChartSeriesData struct {
	Name   string   // 系列名称
	Values []string // 数值列表
}

ChartSeriesData 图表系列数据

type ChartType

type ChartType int

ChartType 图表类型

const (
	ChartTypeBar      ChartType = iota // 柱状图
	ChartTypePie                       // 饼图
	ChartTypeLine                      // 折线图
	ChartTypeArea                      // 面积图
	ChartTypeScatter                   // 散点图
	ChartTypeDoughnut                  // 环形图
)

type ColorRole

type ColorRole int

ColorRole 颜色角色枚举 用于标识颜色方案中的各个颜色

const (
	ColorRoleDark1             ColorRole = iota // 深色 1(通常是黑色)
	ColorRoleLight1                             // 浅色 1(通常是白色)
	ColorRoleDark2                              // 深色 2
	ColorRoleLight2                             // 浅色 2
	ColorRoleAccent1                            // 强调色 1
	ColorRoleAccent2                            // 强调色 2
	ColorRoleAccent3                            // 强调色 3
	ColorRoleAccent4                            // 强调色 4
	ColorRoleAccent5                            // 强调色 5
	ColorRoleAccent6                            // 强调色 6
	ColorRoleHyperlink                          // 超链接
	ColorRoleFollowedHyperlink                  // 访问过的超链接
)

func (ColorRole) String

func (r ColorRole) String() string

String 返回颜色角色的名称

type ColorType

type ColorType int

ColorType 颜色类型枚举

const (
	ColorTypeUnknown ColorType = iota
	ColorTypeRGB               // RGB 颜色
	ColorTypeSystem            // 系统颜色
)

type EmbeddingPart

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

EmbeddingPart 嵌入部件

func NewEmbeddingPart

func NewEmbeddingPart(id int, embedType EmbeddingType) *EmbeddingPart

NewEmbeddingPart 创建新的嵌入部件

func NewEmbeddingPartWithURI

func NewEmbeddingPartWithURI(uri *opc.PackURI, embedType EmbeddingType) *EmbeddingPart

NewEmbeddingPartWithURI 使用指定 URI 创建嵌入部件

func (*EmbeddingPart) Data

func (e *EmbeddingPart) Data() []byte

Data 返回嵌入数据

func (*EmbeddingPart) EmbedType

func (e *EmbeddingPart) EmbedType() EmbeddingType

EmbedType 返回嵌入类型

func (*EmbeddingPart) IsExcel

func (e *EmbeddingPart) IsExcel() bool

IsExcel 是否为 Excel 嵌入

func (*EmbeddingPart) IsWord

func (e *EmbeddingPart) IsWord() bool

IsWord 是否为 Word 嵌入

func (*EmbeddingPart) PartURI

func (e *EmbeddingPart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*EmbeddingPart) Reader

func (e *EmbeddingPart) Reader() io.Reader

Reader 返回数据 Reader

func (*EmbeddingPart) SetData

func (e *EmbeddingPart) SetData(data []byte)

SetData 设置嵌入数据

func (*EmbeddingPart) SetDataReader

func (e *EmbeddingPart) SetDataReader(r io.Reader) error

SetDataReader 从 Reader 设置数据

func (*EmbeddingPart) Size

func (e *EmbeddingPart) Size() int

Size 返回数据大小

func (*EmbeddingPart) WriteTo

func (e *EmbeddingPart) WriteTo(w io.Writer) (int64, error)

WriteTo 将数据写入 Writer

type EmbeddingType

type EmbeddingType int

EmbeddingType 嵌入类型

const (
	EmbeddingTypeUnknown EmbeddingType = iota
	EmbeddingTypeExcel                 // Excel 工作表
	EmbeddingTypeWord                  // Word 文档
	EmbeddingTypeOther                 // 其他
)

func DetectEmbeddingType

func DetectEmbeddingType(filename string) EmbeddingType

DetectEmbeddingType 从文件名检测嵌入类型

type GradientStop

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

GradientStop 渐变色标(只读) 对应 XML: <a:gs>

func (*GradientStop) ColorRGB

func (g *GradientStop) ColorRGB() string

ColorRGB 返回色标颜色(RGB 十六进制)

func (*GradientStop) Position

func (g *GradientStop) Position() float32

Position 返回色标位置 (0.0 - 1.0)

type MediaResource

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

MediaResource 媒体资源结构体(只读) 统一处理 PPTX 中的图片、音频、视频等媒体文件

func NewMediaResourceFromBytes

func NewMediaResourceFromBytes(fileName, contentType, target string, data []byte) *MediaResource

NewMediaResourceFromBytes 从字节数据创建媒体资源 适用于小文件(如小图片)

func NewMediaResourceFromReader

func NewMediaResourceFromReader(fileName, contentType, target string, reader io.Reader, size int64) *MediaResource

NewMediaResourceFromReader 从 Reader 创建媒体资源 适用于大文件(如视频、大图片)

func (*MediaResource) ContentType

func (m *MediaResource) ContentType() string

ContentType 返回 MIME 类型(如 image/png)

func (*MediaResource) Data

func (m *MediaResource) Data() []byte

Data 返回字节数据(如果存在) 对于大文件(使用 Reader 创建),返回 nil

func (*MediaResource) DataSize

func (m *MediaResource) DataSize() int64

DataSize 返回数据大小(字节)

func (*MediaResource) Extension

func (m *MediaResource) Extension() string

Extension 返回文件扩展名(如 .png)

func (*MediaResource) FileName

func (m *MediaResource) FileName() string

FileName 返回文件名(如 image1.png)

func (*MediaResource) HasData

func (m *MediaResource) HasData() bool

HasData 检查是否有字节数据

func (*MediaResource) HasReader

func (m *MediaResource) HasReader() bool

HasReader 检查是否有 Reader

func (*MediaResource) Hash

func (m *MediaResource) Hash() string

Hash 返回内容 Hash

func (*MediaResource) IsAudio

func (m *MediaResource) IsAudio() bool

IsAudio 检查是否为音频类型

func (*MediaResource) IsImage

func (m *MediaResource) IsImage() bool

IsImage 检查是否为图片类型

func (*MediaResource) IsVideo

func (m *MediaResource) IsVideo() bool

IsVideo 检查是否为视频类型

func (*MediaResource) MediaType

func (m *MediaResource) MediaType() MediaType

MediaType 返回媒体类型枚举

func (*MediaResource) RID

func (m *MediaResource) RID() string

RID 返回关系 ID

func (*MediaResource) Reader

func (m *MediaResource) Reader() io.Reader

Reader 返回数据 Reader 对于小文件(使用 Bytes 创建),返回 nil

func (*MediaResource) SetHash

func (m *MediaResource) SetHash(hash string)

SetHash 设置内容 Hash

func (*MediaResource) SetRID

func (m *MediaResource) SetRID(rId string)

SetRID 设置关系 ID

func (*MediaResource) Target

func (m *MediaResource) Target() string

Target 返回在 ZIP 中的完整路径(如 ppt/media/image1.png)

type MediaType

type MediaType int8

MediaType 媒体类型枚举

const (
	MediaTypeUnknown MediaType = iota
	MediaTypeImage             // 图片
	MediaTypeAudio             // 音频
	MediaTypeVideo             // 视频
)

func (MediaType) String

func (mt MediaType) String() string

String 返回媒体类型的字符串表示

type Placeholder

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

Placeholder 占位符 - 母版/版式中定义的可填充区域(只读) 对应 XML: <p:sp> with <p:nvSpPr><p:nvPr><p:ph ...>

func (*Placeholder) Bounds

func (p *Placeholder) Bounds() (x, y, cx, cy int64)

Bounds 返回边界矩形 (x, y, cx, cy)

func (*Placeholder) Cx

func (p *Placeholder) Cx() int64

Cx 返回宽度(EMU 单位)

func (*Placeholder) Cy

func (p *Placeholder) Cy() int64

Cy 返回高度(EMU 单位)

func (*Placeholder) DefaultStyle

func (p *Placeholder) DefaultStyle() *TextStyle

DefaultStyle 返回默认文本样式(可能为 nil)

func (*Placeholder) ID

func (p *Placeholder) ID() string

ID 返回占位符唯一标识符

func (*Placeholder) Rotation

func (p *Placeholder) Rotation() int32

Rotation 返回旋转角度(1/60000 度)

func (*Placeholder) Type

func (p *Placeholder) Type() PlaceholderType

Type 返回占位符类型

func (*Placeholder) X

func (p *Placeholder) X() int64

X 返回 X 坐标(EMU 单位)

func (*Placeholder) Y

func (p *Placeholder) Y() int64

Y 返回 Y 坐标(EMU 单位)

type PlaceholderType

type PlaceholderType int8

PlaceholderType 占位符类型枚举 对应 XML: <p:ph type="...">

const (
	PlaceholderTypeNone        PlaceholderType = iota // 未指定
	PlaceholderTypeTitle                              // 标题
	PlaceholderTypeBody                               // 正文/内容
	PlaceholderTypeCenterTitle                        // 居中标题
	PlaceholderTypeSubTitle                           // 副标题
	PlaceholderTypeDateTime                           // 日期时间
	PlaceholderTypeSlideNumber                        // 幻灯片编号
	PlaceholderTypeFooter                             // 页脚
	PlaceholderTypeHeader                             // 页眉
	PlaceholderTypeObject                             // 对象
	PlaceholderTypeChart                              // 图表
	PlaceholderTypeTable                              // 表格
	PlaceholderTypeClipArt                            // 剪贴画
	PlaceholderTypeOrgChart                           // 组织结构图
	PlaceholderTypeMedia                              // 媒体
	PlaceholderTypeSlideImage                         // 幻灯片图像
	PlaceholderTypePicture                            // 图片
)

func (PlaceholderType) String

func (t PlaceholderType) String() string

String 返回占位符类型的字符串表示

type PresentationPart

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

PresentationPart 对应 /ppt/presentation.xml 是整个 PPTX 逻辑上的根节点

func NewPresentationPart

func NewPresentationPart() *PresentationPart

NewPresentationPart 创建新的演示文稿部件

func NewPresentationPartWithSize

func NewPresentationPartWithSize(size SlideSize) *PresentationPart

NewPresentationPartWithSize 创建演示文稿并设置尺寸

func (*PresentationPart) AddSlide

func (p *PresentationPart) AddSlide(layoutRId string, slidePart *SlidePart) error

AddSlide 添加幻灯片 layout 是关联的布局 rId,slidePart 是实际的幻灯片部件

func (*PresentationPart) AddSlideMaster

func (p *PresentationPart) AddSlideMaster(rId string)

AddSlideMaster 添加母版 返回分配的 rId

func (*PresentationPart) FromXML

func (p *PresentationPart) FromXML(data []byte) error

FromXML 从 XML 反序列化为 PresentationPart

func (*PresentationPart) PartURI

func (p *PresentationPart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*PresentationPart) RemoveSlide

func (p *PresentationPart) RemoveSlide(index int) error

RemoveSlide 移除幻灯片(按索引)

func (*PresentationPart) SetSlideSize

func (p *PresentationPart) SetSlideSize(size SlideSize)

SetSlideSize 设置幻灯片尺寸

func (*PresentationPart) SlideCount

func (p *PresentationPart) SlideCount() int32

SlideCount 返回幻灯片数量

func (*PresentationPart) SlideIDAt

func (p *PresentationPart) SlideIDAt(index int) (uint32, error)

SlideIDAt 返回指定索引的 slide ID

func (*PresentationPart) SlideIDs

func (p *PresentationPart) SlideIDs() []uint32

SlideIDs 返回所有 slide ID

func (*PresentationPart) SlideMasterIDs

func (p *PresentationPart) SlideMasterIDs() []string

SlideMasterIDs 返回所有母版 rId

func (*PresentationPart) SlideSize

func (p *PresentationPart) SlideSize() SlideSize

SlideSize 返回幻灯片尺寸

func (*PresentationPart) ToXML

func (p *PresentationPart) ToXML() ([]byte, error)

ToXML 将 PresentationPart 序列化为 XML

type ShapeIDAllocator

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

ShapeIDAllocator 形状 ID 分配器(单线程使用) 用于管理单个 Slide 或 ShapeTree 内的 ID 分配

func NewShapeIDAllocator

func NewShapeIDAllocator(reservedID uint32) *ShapeIDAllocator

NewShapeIDAllocator 创建新的 ID 分配器 reservedID: 保留的起始 ID,nextID 将从 reservedID + 1 开始

func NewShapeIDAllocatorWithMax

func NewShapeIDAllocatorWithMax(reservedID, maxID uint32) *ShapeIDAllocator

NewShapeIDAllocatorWithMax 创建带最大 ID 限制的分配器

func (*ShapeIDAllocator) Current

func (a *ShapeIDAllocator) Current() uint32

Current 返回当前 ID(最后分配的 ID)

func (*ShapeIDAllocator) IsExhausted

func (a *ShapeIDAllocator) IsExhausted() bool

IsExhausted 检查 ID 是否已耗尽

func (*ShapeIDAllocator) Next

func (a *ShapeIDAllocator) Next() uint32

Next 分配下一个 ID 返回新分配的 ID 值

func (*ShapeIDAllocator) NextBatch

func (a *ShapeIDAllocator) NextBatch(count int) []uint32

NextBatch 批量分配多个 ID count: 需要分配的 ID 数量 返回分配的 ID 数组(不包含 reservedID)

func (*ShapeIDAllocator) Peek

func (a *ShapeIDAllocator) Peek() uint32

Peek 返回下一个将被分配的 ID(不实际分配)

func (*ShapeIDAllocator) Remaining

func (a *ShapeIDAllocator) Remaining() uint32

Remaining 返回剩余可分配的 ID 数量

func (*ShapeIDAllocator) Reset

func (a *ShapeIDAllocator) Reset()

Reset 重置分配器,从 reservedID + 1 重新开始

func (*ShapeIDAllocator) ResetFrom

func (a *ShapeIDAllocator) ResetFrom(startID uint32)

ResetFrom 从指定 ID 开始重新分配

func (*ShapeIDAllocator) SetReserved

func (a *ShapeIDAllocator) SetReserved(reservedID uint32)

SetReserved 设置保留的起始 ID 并重置

func (*ShapeIDAllocator) UsedCount

func (a *ShapeIDAllocator) UsedCount() uint32

UsedCount 返回已使用的 ID 数量

type ShapeIDAllocatorSync

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

ShapeIDAllocatorSync 线程安全的形状 ID 分配器 用于多 goroutine 环境下的 ID 分配

func NewShapeIDAllocatorSync

func NewShapeIDAllocatorSync(reservedID uint32) *ShapeIDAllocatorSync

============================================================================ NewShapeIDAllocatorSync 创建线程安全的 ID 分配器

func NewShapeIDAllocatorSyncWithMax

func NewShapeIDAllocatorSyncWithMax(reservedID, maxID uint32) *ShapeIDAllocatorSync

NewShapeIDAllocatorSyncWithMax 创建带最大 ID 限制的线程安全分配器

func (*ShapeIDAllocatorSync) Next

func (a *ShapeIDAllocatorSync) Next() uint32

Next 线程安全地分配下一个 ID

func (*ShapeIDAllocatorSync) NextBatch

func (a *ShapeIDAllocatorSync) NextBatch(count int) []uint32

NextBatch 线程安全地批量分配多个 ID

func (*ShapeIDAllocatorSync) Peek

func (a *ShapeIDAllocatorSync) Peek() uint32

Peek 线程安全地返回下一个将被分配的 ID

func (*ShapeIDAllocatorSync) Reset

func (a *ShapeIDAllocatorSync) Reset()

Reset 线程安全地重置分配器

func (*ShapeIDAllocatorSync) ResetFrom

func (a *ShapeIDAllocatorSync) ResetFrom(startID uint32)

ResetFrom 线程安全地从指定 ID 开始重置

func (*ShapeIDAllocatorSync) TryNext

func (a *ShapeIDAllocatorSync) TryNext() (uint32, bool)

TryNext 尝试分配 ID,失败时返回 false

type SlideLayoutData

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

SlideLayoutData 版式只读数据(用于模板系统) 对应 XML: /ppt/slideLayouts/slideLayoutN.xml 与 SlideLayoutPart 不同,这是纯数据结构,无 XML 读写能力

func ParseLayout

func ParseLayout(xmlData []byte) (*SlideLayoutData, error)

ParseLayout 解析幻灯片版式 XML 传入 xml 字节,解析并提取出该版式中所有的占位符坐标和类型

func (*SlideLayoutData) Background

func (l *SlideLayoutData) Background() *Background

Background 返回背景(可能为 nil)

func (*SlideLayoutData) BodyPlaceholder

func (l *SlideLayoutData) BodyPlaceholder() *Placeholder

BodyPlaceholder 获取正文占位符(便捷方法)

func (*SlideLayoutData) ID

func (l *SlideLayoutData) ID() string

ID 返回版式唯一标识符

func (*SlideLayoutData) LayoutType

func (l *SlideLayoutData) LayoutType() SlideLayoutType

LayoutType 返回版式类型

func (*SlideLayoutData) MasterID

func (l *SlideLayoutData) MasterID() string

MasterID 返回所属母版的 ID

func (*SlideLayoutData) Name

func (l *SlideLayoutData) Name() string

Name 返回版式名称

func (*SlideLayoutData) PlaceholderByID

func (l *SlideLayoutData) PlaceholderByID(id string) *Placeholder

PlaceholderByID 根据 ID 获取占位符(可能为 nil)

func (*SlideLayoutData) PlaceholderByType

func (l *SlideLayoutData) PlaceholderByType(phType PlaceholderType) *Placeholder

PlaceholderByType 根据类型获取第一个匹配的占位符

func (*SlideLayoutData) PlaceholderCount

func (l *SlideLayoutData) PlaceholderCount() int

PlaceholderCount 返回占位符数量

func (*SlideLayoutData) Placeholders

func (l *SlideLayoutData) Placeholders() map[string]*Placeholder

Placeholders 返回占位符集合

func (*SlideLayoutData) TitlePlaceholder

func (l *SlideLayoutData) TitlePlaceholder() *Placeholder

TitlePlaceholder 获取标题占位符(便捷方法)

type SlideLayoutPart

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

SlideLayoutPart 对应 /ppt/slideLayouts/slideLayoutN.xml

func NewSlideLayoutPart

func NewSlideLayoutPart(id int) *SlideLayoutPart

NewSlideLayoutPart 创建新的幻灯片布局部件

func (*SlideLayoutPart) LayoutType

func (s *SlideLayoutPart) LayoutType() SlideLayoutType

LayoutType 返回布局类型

func (*SlideLayoutPart) MasterRId

func (s *SlideLayoutPart) MasterRId() string

MasterRId 返回关联的母版 rId

func (*SlideLayoutPart) PartURI

func (s *SlideLayoutPart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*SlideLayoutPart) SetLayoutType

func (s *SlideLayoutPart) SetLayoutType(t SlideLayoutType)

SetLayoutType 设置布局类型

func (*SlideLayoutPart) SetMasterRId

func (s *SlideLayoutPart) SetMasterRId(rId string)

SetMasterRId 设置关联的母版 rId

type SlideLayoutType

type SlideLayoutType int

SlideLayoutType 幻灯片布局类型

const (
	SlideLayoutBlank             SlideLayoutType = iota // 空白布局
	SlideLayoutTitle                                    // 标题布局
	SlideLayoutTitleAndContent                          // 标题和内容布局
	SlideLayoutTwoContent                               // 两栏内容布局
	SlideLayoutComparison                               // 比较布局
	SlideLayoutTitleOnly                                // 仅标题布局
	SlideLayoutBlankVertical                            // 空白垂直布局
	SlideLayoutObject                                   // 对象布局
	SlideLayoutPictureAndCaption                        // 图片和标题布局
)

type SlideMasterData

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

SlideMasterData 母版只读数据(用于模板系统) 对应 XML: /ppt/slideMasters/slideMasterN.xml 母版是幻灯片模板的顶层容器,包含一个或多个版式

func ParseMaster

func ParseMaster(xmlData []byte) (*SlideMasterData, error)

ParseMaster 解析幻灯片母版 XML 传入 xml 字节,解析并提取出母版中的占位符定义

func (*SlideMasterData) Background

func (m *SlideMasterData) Background() *Background

Background 返回背景(可能为 nil)

func (*SlideMasterData) ID

func (m *SlideMasterData) ID() string

ID 返回母版唯一标识符

func (*SlideMasterData) LayoutByID

func (m *SlideMasterData) LayoutByID(id string) *SlideLayoutData

LayoutByID 根据 ID 获取版式(可能为 nil)

func (*SlideMasterData) LayoutCount

func (m *SlideMasterData) LayoutCount() int

LayoutCount 返回版式数量

func (*SlideMasterData) Layouts

func (m *SlideMasterData) Layouts() []*SlideLayoutData

Layouts 返回版式列表

func (*SlideMasterData) Name

func (m *SlideMasterData) Name() string

Name 返回母版名称

func (*SlideMasterData) PlaceholderByID

func (m *SlideMasterData) PlaceholderByID(id string) *Placeholder

PlaceholderByID 根据 ID 获取占位符(可能为 nil)

func (*SlideMasterData) PlaceholderCount

func (m *SlideMasterData) PlaceholderCount() int

PlaceholderCount 返回占位符数量

func (*SlideMasterData) Placeholders

func (m *SlideMasterData) Placeholders() map[string]*Placeholder

Placeholders 返回母版级占位符集合

type SlidePart

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

func NewSlidePart

func NewSlidePart(id int) *SlidePart

NewSlidePart 创建新的幻灯片部件

func NewSlidePartWithURI

func NewSlidePartWithURI(uri *opc.PackURI) *SlidePart

NewSlidePartWithURI 使用指定 URI 创建幻灯片部件

func (*SlidePart) AddChartRel

func (s *SlidePart) AddChartRel(targetURI string) string

AddChartRel 添加图表关系(带去重) 返回分配的 rId

func (*SlidePart) AddImageRel

func (s *SlidePart) AddImageRel(targetURI string) string

AddImageRel 添加图片关系(带去重) 返回分配的 rId

func (*SlidePart) AddMediaRel

func (s *SlidePart) AddMediaRel(targetURI string) string

AddMediaRel 添加媒体关系(带去重) 返回分配的 rId

func (*SlidePart) AddTableRel

func (s *SlidePart) AddTableRel(targetURI string) string

AddTableRel 添加表格关系(带去重) 返回分配的 rId

func (*SlidePart) AllocateShapeID

func (s *SlidePart) AllocateShapeID() uint32

AllocateShapeID 分配一个新的 shape ID 返回新分配的 ID 值

func (*SlidePart) AllocateShapeIDBatch

func (s *SlidePart) AllocateShapeIDBatch(count int) []uint32

AllocateShapeIDBatch 批量分配多个 shape ID

func (*SlidePart) AllocateShapeIDWithOffset

func (s *SlidePart) AllocateShapeIDWithOffset(offset uint32) uint32

AllocateShapeIDWithOffset 分配一个带偏移量的 shape ID offset: 在当前基础上增加的偏移量

func (*SlidePart) Allocator

func (s *SlidePart) Allocator() *ShapeIDAllocator

Allocator 返回当前的 Shape ID 分配器(用于自定义管理) 注意:单个 Slide 由单 goroutine 负责生成,非并发安全

func (*SlidePart) AppendShapeChild

func (s *SlidePart) AppendShapeChild(child any)

AppendShapeChild 向形状树添加子元素(用于高层构建器操作)

func (*SlidePart) CurrentShapeID

func (s *SlidePart) CurrentShapeID() uint32

CurrentShapeID 返回当前最后分配的 Shape ID

func (*SlidePart) FromXML

func (s *SlidePart) FromXML(data []byte) error

FromXML 从 XML 反序列化为 SlidePart

func (*SlidePart) LayoutRId

func (s *SlidePart) LayoutRId() string

LayoutRId 返回关联的布局 rId

func (*SlidePart) MasterRId

func (s *SlidePart) MasterRId() string

MasterRId 返回关联的母版 rId

func (*SlidePart) NextShapeID

func (s *SlidePart) NextShapeID() uint32

NextShapeID 返回下一个可用的 Shape ID(不递增)

func (*SlidePart) PartURI

func (s *SlidePart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*SlidePart) PeekNextShapeID

func (s *SlidePart) PeekNextShapeID() uint32

PeekNextShapeID 查看下一个可用的 Shape ID(不递增)

func (*SlidePart) Relationships

func (s *SlidePart) Relationships() *opc.Relationships

Relationships 返回幻灯片关系管理器(使用 opc.Relationships)

func (*SlidePart) ResetShapeID

func (s *SlidePart) ResetShapeID()

ResetShapeID 重置 Shape ID 分配器

func (*SlidePart) SetLayoutRId

func (s *SlidePart) SetLayoutRId(rId string)

SetLayoutRId 设置关联的布局 rId

func (*SlidePart) SetMasterRId

func (s *SlidePart) SetMasterRId(rId string)

SetMasterRId 设置关联的母版 rId

func (*SlidePart) SetShapeIDStart

func (s *SlidePart) SetShapeIDStart(startID uint32)

SetShapeIDStart 设置 Shape ID 的起始值

func (*SlidePart) SetURI

func (s *SlidePart) SetURI(uri *opc.PackURI)

SetURI 设置部件 URI

func (*SlidePart) ShapeIDCount

func (s *SlidePart) ShapeIDCount() uint32

ShapeIDCount 返回已分配的 Shape ID 数量

func (*SlidePart) SpTree

func (s *SlidePart) SpTree() *XSpTree

SpTree 返回形状树(用于高层构建器操作)

func (*SlidePart) ToXML

func (s *SlidePart) ToXML() ([]byte, error)

ToXML 将 SlidePart 序列化为 XML 使用 XMLWriterPool 统一序列化底座

type SlideSize

type SlideSize struct {
	Cx int // 宽度,单位 EMU (English Metric Units)
	Cy int // 高度,单位 EMU
}

SlideSize 幻灯片尺寸

func NewSlideSizeFromStandard

func NewSlideSizeFromStandard(name string) SlideSize

NewSlideSizeFromStandard 根据标准尺寸名称创建 SlideSize

type TextStyle

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

TextStyle 文本样式(只读) 用于定义占位符中文本的默认字体、大小、颜色等

func (*TextStyle) Bold

func (s *TextStyle) Bold() bool

Bold 返回是否粗体

func (*TextStyle) ColorRGB

func (s *TextStyle) ColorRGB() string

ColorRGB 返回文本颜色(RGB 十六进制)

func (*TextStyle) FontName

func (s *TextStyle) FontName() string

FontName 返回字体名称

func (*TextStyle) FontSize

func (s *TextStyle) FontSize() int32

FontSize 返回字体大小(百分之一磅,100 = 1pt)

func (*TextStyle) Italic

func (s *TextStyle) Italic() bool

Italic 返回是否斜体

func (*TextStyle) Underline

func (s *TextStyle) Underline() bool

Underline 返回是否下划线

type ThemePart

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

ThemePart 主题部件

func NewThemePart

func NewThemePart(id int) *ThemePart

NewThemePart 创建新的主题部件

func NewThemePartWithURI

func NewThemePartWithURI(uri *opc.PackURI) *ThemePart

NewThemePartWithURI 使用指定 URI 创建主题部件

func (*ThemePart) ColorScheme

func (t *ThemePart) ColorScheme() *XColorScheme

ColorScheme 返回颜色方案

func (*ThemePart) FontScheme

func (t *ThemePart) FontScheme() *XFontScheme

FontScheme 返回字体方案

func (*ThemePart) FromXML

func (t *ThemePart) FromXML(data []byte) error

FromXML 从 XML 反序列化主题

func (*ThemePart) GetThemeColor

func (t *ThemePart) GetThemeColor(role ColorRole) *XColorVariant

GetThemeColor 获取指定角色的颜色

func (*ThemePart) GetThemeColorRGB

func (t *ThemePart) GetThemeColorRGB(role ColorRole) string

GetThemeColorRGB 获取指定角色的 RGB 颜色值 返回 6 位十六进制字符串(如 "FF0000"),如果无法获取则返回空字符串

func (*ThemePart) GetThemeColorType

func (t *ThemePart) GetThemeColorType(role ColorRole) ColorType

GetThemeColorType 获取指定角色的颜色类型

func (*ThemePart) PartURI

func (t *ThemePart) PartURI() *opc.PackURI

PartURI 返回部件 URI

func (*ThemePart) SetThemeColorRGB

func (t *ThemePart) SetThemeColorRGB(role ColorRole, rgb string)

SetThemeColorRGB 设置指定角色的 RGB 颜色值 rgb 为 6 位十六进制字符串(如 "FF0000")

func (*ThemePart) SetThemeColorSystem

func (t *ThemePart) SetThemeColorSystem(role ColorRole, sysColorName, lastClr string)

SetThemeColorSystem 设置指定角色的系统颜色 sysColorName 为系统颜色名称(如 "windowText", "window") lastClr 为回退 RGB 颜色值(6 位十六进制)

func (*ThemePart) SetThemeData

func (t *ThemePart) SetThemeData(theme *XTheme)

SetThemeData 设置主题数据(用于设置克隆后的主题)

func (*ThemePart) SetThemeMajorFont

func (t *ThemePart) SetThemeMajorFont(latin, eastAsia, complex string)

SetThemeMajorFont 设置标题字体

func (*ThemePart) SetThemeMinorFont

func (t *ThemePart) SetThemeMinorFont(latin, eastAsia, complex string)

SetThemeMinorFont 设置正文字体

func (*ThemePart) SetThemeScriptFont

func (t *ThemePart) SetThemeScriptFont(isMajor bool, script, typeface string)

SetThemeScriptFont 设置脚本特定字体 isMajor: true 为标题字体,false 为正文字体

func (*ThemePart) Theme

func (t *ThemePart) Theme() *XTheme

Theme 返回主题数据

func (*ThemePart) ToXML

func (t *ThemePart) ToXML() ([]byte, error)

ToXML 将主题序列化为 XML

type XBlip

type XBlip struct {
	Embed string `xml:"rembed,attr,omitempty"`
}

XBlip 图片

type XBlipFillProperties

type XBlipFillProperties struct {
	XMLName struct{}            `xml:"blipFill"`
	Blip    *XBlip              `xml:"blip,omitempty"`
	Stretch *XStretchProperties `xml:"stretch,omitempty"`
}

XBlipFillProperties 图片填充属性

func (*XBlipFillProperties) WriteXML

func (xbfp *XBlipFillProperties) WriteXML(xw *XMLWriter) error

WriteXML 将 XBlipFillProperties 序列化为 XML

type XBodyPr

type XBodyPr struct {
	Wrap      string `xml:"wrap,attr,omitempty"`
	Rotation  int    `xml:"rot,attr,omitempty"`
	Vertical  string `xml:"vert,attr,omitempty"`
	Anchor    string `xml:"anchor,attr,omitempty"`
	AnchorCtr bool   `xml:"anchorCtr,attr,omitempty"`
}

XBodyPr 主体属性

type XCSld

type XCSld struct {
	SpTree *XSpTree `xml:"spTree"`
}

XCSld 公共幻灯片数据

type XClrMap

type XClrMap struct {
	BG1     string `xml:"bg1,attr,omitempty"`
	T1      string `xml:"t1,attr,omitempty"`
	BG2     string `xml:"bg2,attr,omitempty"`
	T2      string `xml:"t2,attr,omitempty"`
	Accent1 string `xml:"accent1,attr,omitempty"`
	Accent2 string `xml:"accent2,attr,omitempty"`
	Accent3 string `xml:"accent3,attr,omitempty"`
	Accent4 string `xml:"accent4,attr,omitempty"`
	Accent5 string `xml:"accent5,attr,omitempty"`
	Accent6 string `xml:"accent6,attr,omitempty"`
	HLink   string `xml:"hlink,attr,omitempty"`
	HLink1  string `xml:"hlink1,attr,omitempty"`
	HLink2  string `xml:"hlink2,attr,omitempty"`
	FollClr string `xml:"follClr,attr,omitempty"`
	LastClr string `xml:"lastClr,attr,omitempty"`
}

XClrMap 颜色映射

type XClrMapOvr

type XClrMapOvr struct {
	Accent1 string `xml:"accent1,attr,omitempty"`
}

XClrMapOvr 颜色映射覆盖

type XColorScheme

type XColorScheme struct {
	XMLName           struct{}       `xml:"clrScheme"`
	XmlnsA            string         `xml:"xmlns:a,attr,omitempty"`
	Name              string         `xml:"name,attr,omitempty"`
	Dark1             *XColorVariant `xml:"dk1"`      // 深色 1
	Light1            *XColorVariant `xml:"lt1"`      // 浅色 1
	Dark2             *XColorVariant `xml:"dk2"`      // 深色 2
	Light2            *XColorVariant `xml:"lt2"`      // 浅色 2
	Accent1           *XColorVariant `xml:"accent1"`  // 强调色 1
	Accent2           *XColorVariant `xml:"accent2"`  // 强调色 2
	Accent3           *XColorVariant `xml:"accent3"`  // 强调色 3
	Accent4           *XColorVariant `xml:"accent4"`  // 强调色 4
	Accent5           *XColorVariant `xml:"accent5"`  // 强调色 5
	Accent6           *XColorVariant `xml:"accent6"`  // 强调色 6
	Hyperlink         *XColorVariant `xml:"hlink"`    // 超链接
	FollowedHyperlink *XColorVariant `xml:"folHlink"` // 访问过的超链接
}

XColorScheme 颜色方案 定义演示文稿中使用的 12 种标准颜色

type XColorVariant

type XColorVariant struct {
	SRGBColor *XSRGBColor `xml:"srgbClr,omitempty"`
	SysColor  *XSysColor  `xml:"sysClr,omitempty"`
}

XColorVariant 颜色变体(可以是 RGB 或系统颜色)

func (*XColorVariant) IsRGB

func (c *XColorVariant) IsRGB() bool

IsRGB 判断是否为 RGB 颜色

func (*XColorVariant) IsSystem

func (c *XColorVariant) IsSystem() bool

IsSystem 判断是否为系统颜色

func (*XColorVariant) RGB

func (c *XColorVariant) RGB() string

RGB 返回 RGB 颜色值 对于 RGB 颜色,直接返回值 对于系统颜色,返回 LastClr(回退颜色)

func (*XColorVariant) SystemColorName

func (c *XColorVariant) SystemColorName() string

SystemColorName 返回系统颜色名称

func (*XColorVariant) Type

func (c *XColorVariant) Type() ColorType

Type 返回颜色类型

type XCompatibility

type XCompatibility struct {
	CompatMode string `xml:"compatMode,attr,omitempty"`
}

XCompatibility 兼容设置

type XEffectStyleList

type XEffectStyleList struct {
	InnerXML string `xml:",innerxml"` // 保留原始 XML 内容
}

XEffectStyleList 效果样式列表

type XFillProperties

type XFillProperties struct {
	XMLName struct{} `xml:"fillRect"`
}

XFillProperties 填充属性

type XFillRectProperties

type XFillRectProperties struct {
}

XFillRectProperties 填充矩形属性

type XFillStyleList

type XFillStyleList struct {
	InnerXML string `xml:",innerxml"` // 保留原始 XML 内容,避免丢失数据
}

XFillStyleList 填充样式列表

type XFmtScheme

type XFmtScheme struct {
	XMLName        struct{}          `xml:"fmtScheme"`
	XmlnsA         string            `xml:"xmlns:a,attr,omitempty"`
	Name           string            `xml:"name,attr,omitempty"`
	FillStyleLst   *XFillStyleList   `xml:"fillStyleLst,omitempty"`
	LnStyleLst     *XLineStyleList   `xml:"lnStyleLst,omitempty"`
	EffectStyleLst *XEffectStyleList `xml:"effectStyleLst,omitempty"`
	BgFillStyleLst *XFillStyleList   `xml:"bgFillStyleLst,omitempty"`
}

XFmtScheme 格式方案 包含填充、线条、效果和背景填充的样式列表

type XFontCollection

type XFontCollection struct {
	Latin    string        `xml:"latin typeface,attr,omitempty"` // 拉丁字体
	EastAsia string        `xml:"ea typeface,attr,omitempty"`    // 东亚字体
	Complex  string        `xml:"cs typeface,attr,omitempty"`    // 复杂脚本字体
	Fonts    []XScriptFont `xml:"font"`                          // 脚本特定字体
}

XFontCollection 字体集合

type XFontScheme

type XFontScheme struct {
	XMLName   struct{}         `xml:"fontScheme"`
	XmlnsA    string           `xml:"xmlns:a,attr,omitempty"`
	Name      string           `xml:"name,attr,omitempty"`
	MajorFont *XFontCollection `xml:"majorFont,omitempty"` // 标题字体
	MinorFont *XFontCollection `xml:"minorFont,omitempty"` // 正文字体
}

XFontScheme 字体方案

type XGraphic

type XGraphic struct {
	Table *XTable `xml:"graphicData>a:tbl,omitempty"`
}

XGraphic 图形

type XGraphicFrame

type XGraphicFrame struct {
	XMLName struct{} `xml:"graphicFrame"`

	NonVisual   XNonVisualGraphicFrame `xml:"nvGraphicFramePr"`
	Graphic     *XGraphic              `xml:"graphic,omitempty"`
	Transform2D *XTransform2D          `xml:"xfrm,omitempty"`
}

XGraphicFrame 图形框架

func (*XGraphicFrame) WriteXML

func (xgf *XGraphicFrame) WriteXML(xw *XMLWriter) error

WriteXML 将 XGraphicFrame 序列化为 XML

type XGroupShapeProperties

type XGroupShapeProperties struct {
	Xfrm *XTransform2D `xml:"xfrm,omitempty"`
}

XGroupShapeProperties 组形状属性

type XLineProperties

type XLineProperties struct {
	Width     int          `xml:"w,attr,omitempty"`
	SolidFill *XPresetFill `xml:"solidFill,omitempty"`
}

XLineProperties 线条属性

type XLineStyleList

type XLineStyleList struct {
	InnerXML string `xml:",innerxml"` // 保留原始 XML 内容
}

XLineStyleList 线条样式列表

type XMLAppProps

type XMLAppProps struct {
	XMLName xml.Name `xml:"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties Properties"`

	// 命名空间声明(用于序列化)
	XmlnsProp string `xml:"xmlns,attr,omitempty"`
	XmlnsVt   string `xml:"xmlns:vt,attr,omitempty"`

	// 应用程序信息
	Application string `xml:"Application,omitempty"` // 应用程序名称
	AppVersion  string `xml:"AppVersion,omitempty"`  // 应用程序版本

	Security string `xml:"DocSecurity,omitempty"` // 文档安全级别

	// 文档统计信息
	TotalTime    *int  `xml:"TotalTime,omitempty"`    // 总编辑时间(分钟)
	Words        *int  `xml:"Words,omitempty"`        // 字数
	Characters   *int  `xml:"Characters,omitempty"`   // 字符数
	Pages        *int  `xml:"Pages,omitempty"`        // 页数
	Paragraphs   *int  `xml:"Paragraphs,omitempty"`   // 段落数
	Slides       *int  `xml:"Slides,omitempty"`       // 幻灯片数
	Notes        *int  `xml:"Notes,omitempty"`        // 备注数
	HiddenSlides *int  `xml:"HiddenSlides,omitempty"` // 隐藏幻灯片数
	MMClips      *int  `xml:"MMClips,omitempty"`      // 多媒体剪辑数
	ScaleCrop    *bool `xml:"ScaleCrop,omitempty"`    // 是否按比例裁剪

	// 组织信息
	Company string `xml:"Company,omitempty"` // 公司名称
	Manager string `xml:"Manager,omitempty"` // 管理者

	// 链接信息
	HyperlinkBase     string `xml:"HyperlinkBase,omitempty"`     // 超链接基础
	LinksUpToDate     *bool  `xml:"LinksUpToDate,omitempty"`     // 链接是否最新
	HyperlinksChanged *bool  `xml:"HyperlinksChanged,omitempty"` // 超链接是否更改
	SharedDoc         *bool  `xml:"SharedDoc,omitempty"`         // 是否共享文档

	// 标题对和部件标题(使用 InnerXML 保留原始结构)
	HeadingPairs  *XMLHeadingPairs  `xml:"HeadingPairs,omitempty"`
	TitlesOfParts *XMLTitlesOfParts `xml:"TitlesOfParts,omitempty"`

	// 模板信息
	Template string `xml:"Template,omitempty"` // 模板

	// 其他属性
	PresentationFormat string `xml:"PresentationFormat,omitempty"` // 演示文稿格式
	LineSketches       *bool  `xml:"LineSketches,omitempty"`       // 线条草图
}

XMLAppProps 应用程序属性 XML 结构体

func ParseAppProps

func ParseAppProps(data []byte) (*XMLAppProps, error)

ParseAppProps 从 XML 字节解析应用属性

type XMLBackground

type XMLBackground struct {
	BgPr  *XMLBackgroundPr  `xml:"bgPr,omitempty"`
	BgRef *XMLBackgroundRef `xml:"bgRef,omitempty"`
}

XMLBackground 背景结构体 对应 XML: <p:bg>...</p:bg> 简单结构,包含背景属性

type XMLBackgroundPr

type XMLBackgroundPr struct {
	Fill *XMLFillProperties `xml:",any,omitempty"`
}

XMLBackgroundPr 背景属性 对应 XML: <p:bgPr>...</p:bgPr>

type XMLBackgroundRef

type XMLBackgroundRef struct {
	Idx string          `xml:"idx,attr,omitempty"`
	Clr *XMLSchemeColor `xml:"schemeClr,omitempty"`
}

XMLBackgroundRef 背景引用 对应 XML: <p:bgRef idx="..."><a:schemeClr val="..."/></p:bgRef>

type XMLBlip

type XMLBlip struct {
	Embed string `xml:"r:embed,attr,omitempty"`
}

XMLBlip 图片引用 对应 XML: <a:blip r:embed="..."/>

type XMLBlipFill

type XMLBlipFill struct {
	Blip *XMLBlip `xml:"a:blip,omitempty"`
}

XMLBlipFill 图片填充 对应 XML: <a:blipFill>...</a:blipFill>

type XMLCNvGrpSpPr

type XMLCNvGrpSpPr struct {
}

XMLCNvGrpSpPr 组形状非视觉属性 对应 XML: <p:cNvGrpSpPr>...</p:cNvGrpSpPr>

type XMLCNvPr

type XMLCNvPr struct {
	ID   int    `xml:"id,attr"`
	Name string `xml:"name,attr,omitempty"`
}

XMLCNvPr 通用非视觉属性 对应 XML: <p:cNvPr id="..." name="..."/>

type XMLCommonSlideData

type XMLCommonSlideData struct {
	Bg     *XMLBackground `xml:"bg,omitempty"`
	SpTree *XMLShapeTree  `xml:"spTree"`
}

XMLCommonSlideData 通用幻灯片数据 对应 XML: <p:cSld>...</p:cSld> 包含背景和形状树

type XMLCoreProperties

type XMLCoreProperties struct {
	XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties coreProperties"`

	// 命名空间声明(用于序列化)
	XmlnsCp      string `xml:"xmlns:cp,attr,omitempty"`
	XmlnsDc      string `xml:"xmlns:dc,attr,omitempty"`
	XmlnsDcterms string `xml:"xmlns:dcterms,attr,omitempty"`
	XmlnsXsi     string `xml:"xmlns:xsi,attr,omitempty"`

	// Dublin Core 元素 (dc: 命名空间 -> http://purl.org/dc/elements/1.1/)
	Title       string `xml:"http://purl.org/dc/elements/1.1/ title,omitempty"`
	Creator     string `xml:"http://purl.org/dc/elements/1.1/ creator,omitempty"`
	Subject     string `xml:"http://purl.org/dc/elements/1.1/ subject,omitempty"`
	Description string `xml:"http://purl.org/dc/elements/1.1/ description,omitempty"`

	// Dublin Core Terms 元素 (dcterms: 命名空间 -> http://purl.org/dc/terms/)
	Created  *XMLW3CDTFDate `xml:"http://purl.org/dc/terms/ created,omitempty"`
	Modified *XMLW3CDTFDate `xml:"http://purl.org/dc/terms/ modified,omitempty"`

	// 核心属性扩展 (cp: 命名空间 -> http://schemas.openxmlformats.org/package/2006/metadata/core-properties)
	Keywords       string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties keywords,omitempty"`
	LastModifiedBy string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties lastModifiedBy,omitempty"`
	Revision       string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties revision,omitempty"`
	Category       string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties category,omitempty"`
	ContentType    string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties contentType,omitempty"`
	Version        string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties version,omitempty"`
	Identifier     string `xml:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties identifier,omitempty"`
	Language       string `xml:"http://purl.org/dc/elements/1.1/ language,omitempty"`
}

XMLCoreProperties 核心属性 XML 结构体 对应 XML: /docProps/core.xml 包含文档的元数据信息(标题、作者、创建/修改时间等)

func NewXMLCoreProperties

func NewXMLCoreProperties() *XMLCoreProperties

NewXMLCoreProperties 创建带默认命名空间的核心属性结构体

func ParseCoreProperties

func ParseCoreProperties(data []byte) (*XMLCoreProperties, error)

ParseCoreProperties 从 XML 字节解析核心属性 这是创建新实例的便捷方法

func ParseCoreProps

func ParseCoreProps(data []byte) (*XMLCoreProperties, error)

ParseCoreProps 是 ParseCoreProperties 的简写别名 提供更简洁的调用方式 Deprecated: 建议使用 ParseCoreProperties 或 FromXML

func (*XMLCoreProperties) FromXML

func (cp *XMLCoreProperties) FromXML(data []byte) error

FromXML 从 XML 字节反序列化核心属性 统一命名规范,与其他 Part 保持一致

func (*XMLCoreProperties) GetCreated

func (cp *XMLCoreProperties) GetCreated() string

GetCreated 获取创建时间值

func (*XMLCoreProperties) GetModified

func (cp *XMLCoreProperties) GetModified() string

GetModified 获取修改时间值

func (*XMLCoreProperties) SetCreated

func (cp *XMLCoreProperties) SetCreated(value string)

SetCreated 设置创建时间

func (*XMLCoreProperties) SetModified

func (cp *XMLCoreProperties) SetModified(value string)

SetModified 设置修改时间

func (*XMLCoreProperties) ToXML

func (cp *XMLCoreProperties) ToXML() ([]byte, error)

ToXML 将核心属性序列化为 XML 字节

type XMLExtents

type XMLExtents struct {
	Cx int64 `xml:"cx,attr"`
	Cy int64 `xml:"cy,attr"`
}

XMLExtents 尺寸结构体 对应 XML: <a:ext cx="..." cy="..."/> 用于表示形状或对象的宽度/高度(EMU 单位)

func (*XMLExtents) IsValid

func (e *XMLExtents) IsValid() bool

IsValid 检查是否有效(OpenXML 规范要求 cx 和 cy 必须为正数) 零值或负值尺寸通常表示无效的形状

func (*XMLExtents) IsZero

func (e *XMLExtents) IsZero() bool

IsZero 检查是否为零值(未设置或缺失属性)

type XMLFillProperties

type XMLFillProperties struct {
	SolidFill *XMLSolidFill `xml:"a:solidFill,omitempty"`
	GradFill  *XMLGradFill  `xml:"a:gradFill,omitempty"`
	BlipFill  *XMLBlipFill  `xml:"a:blipFill,omitempty"`
	NoFill    *struct{}     `xml:"a:noFill,omitempty"`
}

XMLFillProperties 填充属性(联合类型) 对应 XML: <a:solidFill> / <a:gradFill> / <a:blipFill> 等

type XMLGradFill

type XMLGradFill struct {
	GsLst *XMLGradientStopList `xml:"a:gsLst,omitempty"`
	Lin   *XMLLinearGradient   `xml:"a:lin,omitempty"`
}

XMLGradFill 渐变填充 对应 XML: <a:gradFill>...</a:gradFill>

type XMLGradientStop

type XMLGradientStop struct {
	Pos       int64         `xml:"pos,attr,omitempty"`
	SolidFill *XMLSolidFill `xml:"a:solidFill,omitempty"`
}

XMLGradientStop 渐变色标 对应 XML: <a:gs pos="...">...</a:gs>

type XMLGradientStopList

type XMLGradientStopList struct {
	Stops []XMLGradientStop `xml:"a:gs,omitempty"`
}

XMLGradientStopList 渐变色标列表 对应 XML: <a:gsLst>...</a:gsLst>

type XMLGroupShape

type XMLGroupShape struct {
	NvGrpSpPr *XMLNvGrpSpPr `xml:"nvGrpSpPr"`
	GrpSpPr   *XMLGrpSpPr   `xml:"grpSpPr"`
	Shapes    []XMLShape    `xml:"sp"`
}

XMLGroupShape 组形状 对应 XML: <p:grpSp>...</p:grpSp>

type XMLGrpSpPr

type XMLGrpSpPr struct {
	Xfrm *XMLTransform `xml:"xfrm,omitempty"`
}

XMLGrpSpPr 组形状属性 对应 XML: <p:grpSpPr>...</p:grpSpPr>

type XMLHeadingPairs

type XMLHeadingPairs struct {
	XMLName  xml.Name `xml:"HeadingPairs"`
	InnerXML string   `xml:",innerxml"` // 保留原始 XML 内容
}

XMLHeadingPairs 标题对 注意:此结构较为复杂,通常使用 InnerXML 保留原始数据 命名空间:与父元素 Properties 相同(extended-properties)

type XMLLinearGradient

type XMLLinearGradient struct {
	Ang    int64 `xml:"ang,attr,omitempty"`
	Scaled bool  `xml:"scaled,attr,omitempty"`
}

XMLLinearGradient 线性渐变 对应 XML: <a:lin ang="..." scaled="..."/>

type XMLNvGrpSpPr

type XMLNvGrpSpPr struct {
	CNvPr      *XMLCNvPr      `xml:"cNvPr,omitempty"`
	CNvGrpSpPr *XMLCNvGrpSpPr `xml:"cNvGrpSpPr,omitempty"`
}

XMLNvGrpSpPr 非视觉组属性 对应 XML: <p:nvGrpSpPr>...</p:nvGrpSpPr>

type XMLNvPr

type XMLNvPr struct {
	Ph *XMLPlaceholder `xml:"ph,omitempty"`
}

XMLNvPr 非视觉属性 对应 XML: <p:nvPr>...</p:nvPr> 包含占位符定义(若存在)

type XMLNvSpPr

type XMLNvSpPr struct {
	CNvPr *XMLCNvPr `xml:"cNvPr,omitempty"`
	NvPr  *XMLNvPr  `xml:"nvPr,omitempty"`
}

XMLNvSpPr 非视觉形状属性 对应 XML: <p:nvSpPr>...</p:nvSpPr> 包含通用属性和非视觉属性

type XMLOffset

type XMLOffset struct {
	X int64 `xml:"x,attr"`
	Y int64 `xml:"y,attr"`
}

XMLOffset 偏移量结构体 对应 XML: <a:off x="..." y="..."/> 用于表示形状或对象的 X/Y 坐标位置(EMU 单位)

func (*XMLOffset) IsValid

func (o *XMLOffset) IsValid() bool

IsValid 检查是否有效(OpenXML 规范要求 x 和 y 属性必须存在) 注意:零值坐标 (0, 0) 在技术上是有效的位置

func (*XMLOffset) IsZero

func (o *XMLOffset) IsZero() bool

IsZero 检查是否为零值(未设置或缺失属性)

type XMLPlaceholder

type XMLPlaceholder struct {
	Type string `xml:"type,attr,omitempty"`
	Idx  string `xml:"idx,attr,omitempty"`
}

XMLPlaceholder 占位符结构体 对应 XML: <p:ph type="..." idx="..."/> 用于标记母版/版式中的可填充区域类型

type XMLRelationship

type XMLRelationship struct {
	ID         string `xml:"Id,attr"`                   // 关系 ID(如 rId1, rId2)
	Type       string `xml:"Type,attr"`                 // 关系类型 URI
	Target     string `xml:"Target,attr"`               // 目标路径(相对或绝对)
	TargetMode string `xml:"TargetMode,attr,omitempty"` // Internal(默认)或 External
}

XMLRelationship 单个关系 对应 XML: <Relationship Id="rId1" Type="..." Target="..."/>

func NewXMLRelationship

func NewXMLRelationship(id, relType, target string) XMLRelationship

NewXMLRelationship 创建单个关系

func NewXMLRelationshipExternal

func NewXMLRelationshipExternal(id, relType, target string) XMLRelationship

NewXMLRelationshipExternal 创建外部关系

func (*XMLRelationship) IsExternal

func (r *XMLRelationship) IsExternal() bool

IsExternal 检查是否为外部关系

type XMLRelationships

type XMLRelationships struct {
	XMLName       xml.Name          `xml:"Relationships"`
	Xmlns         string            `xml:"xmlns,attr,omitempty"`
	Relationships []XMLRelationship `xml:"Relationship"`
}

XMLRelationships 关系集合根节点 对应 XML: <Relationships xmlns="...">...</Relationships>

func NewXMLRelationships

func NewXMLRelationships() *XMLRelationships

NewXMLRelationships 创建带默认命名空间的关系集合

func ParseRelationships

func ParseRelationships(data []byte) (*XMLRelationships, error)

ParseRelationships 从 XML 字节解析关系集合 这是创建新实例的便捷方法

func (*XMLRelationships) Add

func (rs *XMLRelationships) Add(rel XMLRelationship)

Add 添加关系到集合

func (*XMLRelationships) AddNew

func (rs *XMLRelationships) AddNew(id, relType, target string)

AddNew 创建并添加新关系

func (*XMLRelationships) Count

func (rs *XMLRelationships) Count() int

Count 返回关系数量

func (*XMLRelationships) FromXML

func (rs *XMLRelationships) FromXML(data []byte) error

FromXML 从 XML 字节反序列化关系集合 统一命名规范,与其他 Part 保持一致

func (*XMLRelationships) GetByID

func (rs *XMLRelationships) GetByID(id string) *XMLRelationship

GetByID 根据 ID 获取关系

func (*XMLRelationships) GetByTarget

func (rs *XMLRelationships) GetByTarget(target string) *XMLRelationship

GetByTarget 根据目标路径获取关系

func (*XMLRelationships) GetByType

func (rs *XMLRelationships) GetByType(relType string) []XMLRelationship

GetByType 根据类型获取所有关系

func (*XMLRelationships) ToXML

func (rs *XMLRelationships) ToXML() ([]byte, error)

ToXML 将关系集合序列化为 XML 字节

type XMLSRgbColor

type XMLSRgbColor struct {
	Val string `xml:"val,attr,omitempty"`
}

XMLSRgbColor RGB 颜色 对应 XML: <a:srgbClr val="..."/>

type XMLSchemeColor

type XMLSchemeColor struct {
	Val string `xml:"val,attr,omitempty"`
}

XMLSchemeColor 主题颜色 对应 XML: <a:schemeClr val="..."/>

type XMLShape

type XMLShape struct {
	NvSpPr *XMLNvSpPr `xml:"nvSpPr"`
	SpPr   *XMLSpPr   `xml:"spPr"`
}

XMLShape 形状结构体 对应 XML: <p:sp>...</p:sp> 表示幻灯片中的单个形状元素

type XMLShapeTree

type XMLShapeTree struct {
	NvGrpSpPr   *XMLNvGrpSpPr   `xml:"nvGrpSpPr,omitempty"`
	GrpSpPr     *XMLGrpSpPr     `xml:"grpSpPr,omitempty"`
	Shapes      []XMLShape      `xml:"sp"`
	GroupShapes []XMLGroupShape `xml:"grpSp,omitempty"`
}

XMLShapeTree 形状树结构体 对应 XML: <p:spTree>...</p:spTree> 包含多个形状元素的集合

type XMLSlideLayout

type XMLSlideLayout struct {
	XMLName xml.Name `xml:"http://schemas.openxmlformats.org/presentationml/2006/main sldLayout"`

	// 命名空间声明
	XmlnsA string `xml:"xmlns:a,attr,omitempty"`
	XmlnsR string `xml:"xmlns:r,attr,omitempty"`
	XmlnsP string `xml:"xmlns:p,attr,omitempty"`

	CSld *XMLCommonSlideData `xml:"cSld"`
}

XMLSlideLayout 幻灯片版式 对应 XML: <p:sldLayout>...</p:sldLayout> 根节点结构,定义单个版式

type XMLSlideMaster

type XMLSlideMaster struct {
	XMLName xml.Name `xml:"http://schemas.openxmlformats.org/presentationml/2006/main sldMaster"`

	// 命名空间声明
	XmlnsA string `xml:"xmlns:a,attr,omitempty"`
	XmlnsR string `xml:"xmlns:r,attr,omitempty"`
	XmlnsP string `xml:"xmlns:p,attr,omitempty"`

	CSld *XMLCommonSlideData `xml:"cSld"`
}

XMLSlideMaster 幻灯片母版 对应 XML: <p:sldMaster>...</p:sldMaster> 根节点结构,定义母版

type XMLSolidFill

type XMLSolidFill struct {
	SrgbClr   *XMLSRgbColor   `xml:"a:srgbClr,omitempty"`
	SchemeClr *XMLSchemeColor `xml:"a:schemeClr,omitempty"`
}

XMLSolidFill 纯色填充 对应 XML: <a:solidFill>...</a:solidFill>

type XMLSpPr

type XMLSpPr struct {
	Xfrm *XMLTransform `xml:"xfrm,omitempty"`
}

XMLSpPr 视觉形状属性 对应 XML: <p:spPr>...</p:spPr> 包含变换信息(位置和尺寸)

type XMLTitlesOfParts

type XMLTitlesOfParts struct {
	XMLName  xml.Name `xml:"TitlesOfParts"`
	InnerXML string   `xml:",innerxml"` // 保留原始 XML 内容
}

XMLTitlesOfParts 部件标题 命名空间:与父元素 Properties 相同(extended-properties)

type XMLTransform

type XMLTransform struct {
	Off *XMLOffset  `xml:"off,omitempty"`
	Ext *XMLExtents `xml:"ext,omitempty"`
}

XMLTransform 二维变换结构体 对应 XML: <a:xfrm>...</a:xfrm> 包含位置偏移和尺寸信息 注意:Go 的 xml 包会自动处理命名空间,所以使用本地名称即可

type XMLW3CDTFDate

type XMLW3CDTFDate struct {
	Type  string `xml:"xsi:type,attr,omitempty"`
	Value string `xml:",chardata"`
}

XMLW3CDTFDate W3CDTF 格式日期元素 对应 XML: <dcterms:created xsi:type="dcterms:W3CDTF">...</dcterms:created> W3CDTF 格式: YYYY-MM-DDThh:mm:ssZ

type XMLWriter

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

XMLWriter XML 写入辅助结构,提供高效的流式 XML 生成 支持命名空间前缀缓存、属性缓冲和缩进控制

func NewXMLWriter

func NewXMLWriter(w io.Writer) *XMLWriter

NewXMLWriter 创建新的 XMLWriter

func NewXMLWriterBuffered

func NewXMLWriterBuffered(cap int) *XMLWriter

NewXMLWriterBuffered 创建使用缓冲区的 XMLWriter

func NewXMLWriterWithIndent

func NewXMLWriterWithIndent(w io.Writer, indentStr string) *XMLWriter

NewXMLWriterWithIndent 创建带缩进的 XMLWriter

func (*XMLWriter) Bytes

func (xw *XMLWriter) Bytes() []byte

Bytes 返回缓冲区内容的副本(并发安全) 注意:必须返回副本,因为 XMLWriter 会被池化复用 如果返回引用,当 writer 被放回池并重新使用时会导致数据竞争

func (*XMLWriter) CData

func (xw *XMLWriter) CData(content string) error

CData 写入 CDATA 节

func (*XMLWriter) Capacity

func (xw *XMLWriter) Capacity() int

Capacity 返回缓冲区容量

func (*XMLWriter) CharData

func (xw *XMLWriter) CharData(data []byte) error

CharData 写入字符数据

func (*XMLWriter) Comment

func (xw *XMLWriter) Comment(content string) error

Comment 写入注释

func (*XMLWriter) Declaration

func (xw *XMLWriter) Declaration() error

Declaration 写入 XML 声明

func (*XMLWriter) DeclarationWithEncoding

func (xw *XMLWriter) DeclarationWithEncoding(encoding string) error

DeclarationWithEncoding 写入带编码的 XML 声明

func (*XMLWriter) Dedent

func (xw *XMLWriter) Dedent()

Dedent 减少缩进级别

func (*XMLWriter) EmptyElement

func (xw *XMLWriter) EmptyElement(prefix, localName string) error

EmptyElement 写入空元素标签

func (*XMLWriter) EmptyElementWithAttrs

func (xw *XMLWriter) EmptyElementWithAttrs(prefix, localName string, attrs ...string) error

EmptyElementWithAttrs 写入带属性的空元素

func (*XMLWriter) EndElement

func (xw *XMLWriter) EndElement(prefix, localName string) error

EndElement 写入结束元素标签

func (*XMLWriter) Flush

func (xw *XMLWriter) Flush() error

Flush 将缓冲区内容刷新到 writer

func (*XMLWriter) Indent

func (xw *XMLWriter) Indent()

Indent 增加缩进级别

func (*XMLWriter) Newline

func (xw *XMLWriter) Newline() error

Newline 写入换行符

func (*XMLWriter) ProcessingInstruction

func (xw *XMLWriter) ProcessingInstruction(target, data string) error

ProcessingInstruction 写入处理指令

func (*XMLWriter) Raw

func (xw *XMLWriter) Raw(content string) error

Raw 写入原始内容

func (*XMLWriter) Reset

func (xw *XMLWriter) Reset(w io.Writer)

Reset 重置 writer

func (*XMLWriter) ResetBuffer

func (xw *XMLWriter) ResetBuffer()

ResetBuffer 重置缓冲区

func (*XMLWriter) SetAutoFlush

func (xw *XMLWriter) SetAutoFlush(enable bool)

SetAutoFlush 设置是否自动刷新到 writer

func (*XMLWriter) SetIndent

func (xw *XMLWriter) SetIndent(indentStr string)

SetIndent 设置缩进字符串

func (*XMLWriter) SetUseIndent

func (xw *XMLWriter) SetUseIndent(use bool)

SetUseIndent 设置是否使用缩进

func (*XMLWriter) Size

func (xw *XMLWriter) Size() int

Size 返回缓冲区当前大小

func (*XMLWriter) StartElement

func (xw *XMLWriter) StartElement(prefix, localName string) error

StartElement 写入起始元素标签

func (*XMLWriter) StartElementNS

func (xw *XMLWriter) StartElementNS(prefix, localName, ns string) error

StartElementNS 写入带命名空间的起始元素

func (*XMLWriter) StartElementNSWithAttrs

func (xw *XMLWriter) StartElementNSWithAttrs(prefix, localName, ns string, attrs ...string) error

StartElementNSWithAttrs 写入带命名空间和属性的起始元素

func (*XMLWriter) StartElementRaw

func (xw *XMLWriter) StartElementRaw(prefix, localName string, attrs ...string) error

StartElementRaw 写入起始元素(不转义属性值)

func (*XMLWriter) StartElementWithAttrs

func (xw *XMLWriter) StartElementWithAttrs(prefix, localName string, attrs ...string) error

StartElementWithAttrs 写入带属性的起始元素

func (*XMLWriter) String

func (xw *XMLWriter) String() string

String 返回缓冲区内容的字符串形式

func (*XMLWriter) Text

func (xw *XMLWriter) Text(content string) error

Text 写入文本内容

func (*XMLWriter) TextRaw

func (xw *XMLWriter) TextRaw(content string) error

TextRaw 写入原始文本(不转义)

func (*XMLWriter) WithIndent

func (xw *XMLWriter) WithIndent(fn func())

WithIndent 临时增加缩进,执行后恢复

func (*XMLWriter) WriteBool

func (xw *XMLWriter) WriteBool(val bool) error

WriteBool 写入布尔值

func (*XMLWriter) WriteBoolStr

func (xw *XMLWriter) WriteBoolStr(val bool) error

WriteBoolStr 写入布尔值字符串(true/false)

func (*XMLWriter) WriteCentimetersAsEMU

func (xw *XMLWriter) WriteCentimetersAsEMU(cm float64) error

WriteCentimetersAsEMU 将厘米转换为 EMU 并写入

func (*XMLWriter) WriteEMUs

func (xw *XMLWriter) WriteEMUs(val int64) error

WriteEMUs 写入 EMU 单位值(用于 PowerPoint 尺寸)

func (*XMLWriter) WriteEMUsF

func (xw *XMLWriter) WriteEMUsF(val float64) error

WriteEMUsF 写入浮点 EMU 值(基于常用单位转换)

func (*XMLWriter) WriteEMUsWithUnit

func (xw *XMLWriter) WriteEMUsWithUnit(val int64) error

WriteEMUsWithUnit 写入带单位的 EMU 值

func (*XMLWriter) WriteFloat64

func (xw *XMLWriter) WriteFloat64(val float64, prec int) error

WriteFloat64 写入浮点数值

func (*XMLWriter) WriteInchesAsEMU

func (xw *XMLWriter) WriteInchesAsEMU(inches float64) error

WriteInchesAsEMU 将英寸转换为 EMU 并写入

func (*XMLWriter) WriteInt

func (xw *XMLWriter) WriteInt(val int) error

WriteInt 写入整数值

func (*XMLWriter) WriteInt64

func (xw *XMLWriter) WriteInt64(val int64) error

WriteInt64 写入 64 位整数值

func (*XMLWriter) WriteMillimetersAsEMU

func (xw *XMLWriter) WriteMillimetersAsEMU(mm float64) error

WriteMillimetersAsEMU 将毫米转换为 EMU 并写入

func (*XMLWriter) WritePercentage

func (xw *XMLWriter) WritePercentage(val int) error

WritePercentage 写入百分比值

func (*XMLWriter) WritePixelsAsEMU

func (xw *XMLWriter) WritePixelsAsEMU(pixels float64) error

WritePixelsAsEMU 将像素转换为 EMU 并写入

func (*XMLWriter) WritePointsAsEMU

func (xw *XMLWriter) WritePointsAsEMU(points float64) error

WritePointsAsEMU 将磅转换为 EMU 并写入

func (*XMLWriter) WriteUint64

func (xw *XMLWriter) WriteUint64(val uint64) error

WriteUint64 写入无符号 64 位整数值

type XMLWriterPool

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

XMLWriterPool XMLWriter 对象池,用于减少内存分配

func NewXMLWriterPool

func NewXMLWriterPool() *XMLWriterPool

NewXMLWriterPool 创建新的 XMLWriterPool

func (*XMLWriterPool) Get

func (p *XMLWriterPool) Get() *XMLWriter

Get 获取或创建一个 XMLWriter

func (*XMLWriterPool) GetBuffered

func (p *XMLWriterPool) GetBuffered() *XMLWriter

GetBuffered 获取使用缓冲区的 XMLWriter

func (*XMLWriterPool) GetWithWriter

func (p *XMLWriterPool) GetWithWriter(w io.Writer) *XMLWriter

GetWithWriter 获取配置了 writer 的 XMLWriter

func (*XMLWriterPool) Put

func (p *XMLWriterPool) Put(xw *XMLWriter)

Put 回收 XMLWriter 到池中

type XNonVisualDrawingPic

type XNonVisualDrawingPic struct {
	CNvPr    *XNvCxnSpPr `xml:"cNvPr"`
	CNvPicPr *XNvPicPr   `xml:"cNvPicPr"`
}

XNonVisualDrawingPic 图片非视觉绘图属性

type XNonVisualDrawingShape

type XNonVisualDrawingShape struct {
	CNvPr   *XNvCxnSpPr `xml:"cNvPr"`
	CNvSpPr *XNvSpPr    `xml:"cNvSpPr"`
}

XNonVisualDrawingShape 形状非视觉绘图属性

type XNonVisualGraphicFrame

type XNonVisualGraphicFrame struct {
	CNvPr             *XNvCxnSpPr        `xml:"cNvPr"`
	CNvGraphicFramePr *XNvGraphicFramePr `xml:"cNvGraphicFramePr"`
}

XNonVisualGraphicFrame 图形框架非视觉属性

type XNvCxnSpPr

type XNvCxnSpPr struct {
	ID   int    `xml:"id,attr"`
	Name string `xml:"name,attr,omitempty"`
}

XNvCxnSpPr 连接形状非视觉属性

type XNvGraphicFramePr

type XNvGraphicFramePr struct {
	CNvPr *XNvPr `xml:"cNvPr,omitempty"`
}

XNvGraphicFramePr 图形框架非视觉属性

type XNvGrpSpPr

type XNvGrpSpPr struct {
	CNvPr *XNvPr `xml:"cNvPr,omitempty"`
}

XNvGrpSpPr 组形状非视觉属性

type XNvPicPr

type XNvPicPr struct {
	CNvPr *XNvPr `xml:"cNvPr,omitempty"`
}

XNvPicPr 图片非视觉属性

type XNvPr

type XNvPr struct {
	ID   int    `xml:"id,attr,omitempty"`
	Name string `xml:"name,attr,omitempty"`
}

XNvPr 非视觉属性

type XNvSpPr

type XNvSpPr struct {
	CNvPr *XNvPr `xml:"cNvPr,omitempty"`
}

XNvSpPr 形状非视觉属性

type XOutputOptions

type XOutputOptions struct {
	UsePrintFml     *bool `xml:"usePrintFml,attr,omitempty"`
	CloneLinkedObjs *bool `xml:"cloneLinkedObjs,attr,omitempty"`
}

XOutputOptions 输出选项

type XOv2DrExtent

type XOv2DrExtent struct {
	Cx int `xml:"cx,attr"`
	Cy int `xml:"cy,attr"`
}

XOv2DrExtent 扩展尺寸

type XOv2DrOffset

type XOv2DrOffset struct {
	X int `xml:"x,attr"`
	Y int `xml:"y,attr"`
}

XOv2DrOffset 偏移量

type XPicture

type XPicture struct {
	XMLName struct{} `xml:"pic"`

	NonVisual       XNonVisualDrawingPic `xml:"nvPicPr"`
	BlipFill        *XBlipFillProperties `xml:"blipFill,omitempty"`
	ShapeProperties *XShapeProperties    `xml:"spPr,omitempty"`
}

XPicture 图片

func (*XPicture) WriteXML

func (xp *XPicture) WriteXML(xw *XMLWriter) error

WriteXML 将 XPicture 序列化为 XML

type XPresentation

type XPresentation struct {
	XMLName xml.Name `xml:"presentation"`

	// 兼容设置
	Compatibility *XCompatibility `xml:"compatSpt,omitempty"`

	// 幻灯片尺寸(必须)
	SldSz *XSldSz `xml:"sldSz"`

	// 备注尺寸
	NotesSz *XSldSz `xml:"notesSz,omitempty"`

	// 幻灯片 ID 列表(必须)
	SldIdLst *XSldIdLst `xml:"sldIdLst"`

	// 母版 ID 列表
	SldMasterIdLst *XSldMasterIdLst `xml:"sldMasterIdLst,omitempty"`

	// 备注母版 ID 列表
	NotesMasterIdLst *XSldMasterIdLst `xml:"notesMasterIdLst,omitempty"`

	// 打印设置
	PrintSettings *XPrintSettings `xml:"printSettings,omitempty"`
}

XPresentation 对应 presentation.xml 的完整 XML 结构 注意:XML 标签使用不带前缀的名称,因为解析前会去除命名空间前缀

type XPresetFill

type XPresetFill struct {
	SrgbClr   *XSrgbClr   `xml:"srgbClr,omitempty"`
	SchemeClr *XSchemeClr `xml:"schemeClr,omitempty"`
}

XPresetFill 预设填充

type XPrintSettings

type XPrintSettings struct {
	OutputOptions *XOutputOptions `xml:"outputOptions,omitempty"`
}

XPrintSettings 打印设置

type XSRGBColor

type XSRGBColor struct {
	Val string `xml:"val,attr"` // 6 位十六进制 RGB 值(如 "FF0000")
}

XSRGBColor RGB 颜色

type XSchemeClr

type XSchemeClr struct {
	Val string `xml:"val,attr"`
}

XSchemeClr 主题颜色

type XScriptFont

type XScriptFont struct {
	Script   string `xml:"script,attr"`   // 脚本代码(如 "Jpan", "Hans")
	Typeface string `xml:"typeface,attr"` // 字体名称
}

XScriptFont 脚本特定字体

type XShapeProperties

type XShapeProperties struct {
	XMLName     struct{}         `xml:"spPr"`
	Transform2D *XTransform2D    `xml:"xfrm,omitempty"`
	PresetFill  *XPresetFill     `xml:"noFill|a:solidFill|a:gradFill|a:blipFill|a:pattFill|a:grpFill,omitempty"`
	Line        *XLineProperties `xml:"ln,omitempty"`
}

XShapeProperties 形状属性

func (*XShapeProperties) WriteXML

func (xsp *XShapeProperties) WriteXML(xw *XMLWriter) error

WriteXML 将 XShapeProperties 序列化为 XML

type XSldId

type XSldId struct {
	Id  uint32 `xml:"id,attr"`
	RId string `xml:"rid,attr"`
}

XSldId 单个幻灯片 ID

type XSldIdLst

type XSldIdLst struct {
	SldIds []XSldId `xml:"sldId"`
}

XSldIdLst 幻灯片 ID 列表

type XSldMasterId

type XSldMasterId struct {
	Id  uint32 `xml:"id,attr"`
	RId string `xml:"rid,attr"`
}

XSldMasterId 单个母版 ID

type XSldMasterIdLst

type XSldMasterIdLst struct {
	SldMasterIds []XSldMasterId `xml:"sldMasterId"`
}

XSldMasterIdLst 母版 ID 列表

type XSldSz

type XSldSz struct {
	Cx int `xml:"cx,attr"`
	Cy int `xml:"cy,attr"`
}

XSldSz 幻灯片尺寸

type XSlide

type XSlide struct {
	XMLName struct{} `xml:"sld"`

	XmlnsA string `xml:"xmlns:a,attr"`
	XmlnsR string `xml:"xmlns:r,attr"`
	XmlnsP string `xml:"xmlns:p,attr"`

	CSld      *XCSld      `xml:"cSld"`
	ClrMapOvr *XClrMapOvr `xml:"clrMapOvr"`
}

XSlide 幻灯片 XML 结构

func (*XSlide) WriteXML

func (xs *XSlide) WriteXML(xw *XMLWriter) error

WriteXML 将 XSlide 序列化为 XML

type XSp

type XSp struct {
	XMLName struct{} `xml:"sp"`

	NonVisual       XNonVisualDrawingShape `xml:"nvSpPr"`
	ShapeProperties *XShapeProperties      `xml:"spPr,omitempty"`
	ShapePreset     string                 `xml:"-"`
	TextBody        *XTextBody             `xml:"txBody,omitempty"`
}

XSp 形状

func (*XSp) WriteXML

func (xs *XSp) WriteXML(xw *XMLWriter) error

WriteXML 将 XSp 序列化为 XML

type XSpTree

type XSpTree struct {
	XMLName struct{} `xml:"spTree"`

	NonVisual            nvGrpSpPr              `xml:"nvGrpSpPr"`
	GroupShapeProperties *XGroupShapeProperties `xml:"grpSpPr,omitempty"`
	Children             []any                  `xml:"-"`
}

XSpTree 形状树

func NewXSpTree

func NewXSpTree() *XSpTree

NewXSpTree 创建新的形状树

func (*XSpTree) WriteXML

func (xst *XSpTree) WriteXML(xw *XMLWriter) error

WriteXML 将 XSpTree 序列化为 XML

type XSrgbClr

type XSrgbClr struct {
	Val string `xml:"val,attr"`
}

XSrgbClr RGB 颜色

type XStretchProperties

type XStretchProperties struct {
	XMLName  struct{}             `xml:"stretch"`
	FillRect *XFillRectProperties `xml:"fillRect"`
}

XStretchProperties 拉伸填充属性

type XSysColor

type XSysColor struct {
	Val     string `xml:"val,attr"`               // 系统颜色名称
	LastClr string `xml:"lastClr,attr,omitempty"` // 最后使用的 RGB 值(回退颜色)
}

XSysColor 系统颜色

type XTable

type XTable struct {
	XMLName struct{}    `xml:"tbl"`
	Grid    *XTableGrid `xml:"tblGrid,omitempty"`
	Rows    []XTableRow `xml:"tr"`
}

XTable 表格

func (*XTable) WriteXML

func (xt *XTable) WriteXML(xw *XMLWriter) error

WriteXML 将 XTable 序列化为 XML

type XTableCell

type XTableCell struct {
	XMLName  struct{}   `xml:"tc"`
	GridSpan int        `xml:"gridSpan,attr,omitempty"`
	RowSpan  int        `xml:"rowSpan,attr,omitempty"`
	Vertical string     `xml:"anchor,attr,omitempty"`
	TextBody *XTextBody `xml:"txBody,omitempty"`
}

XTableCell 表格单元格

func (*XTableCell) WriteXML

func (xtc *XTableCell) WriteXML(xw *XMLWriter) error

WriteXML 将 XTableCell 序列化为 XML

type XTableColumn

type XTableColumn struct {
	W int `xml:"w,attr"`
}

XTableColumn 表格列

type XTableGrid

type XTableGrid struct {
	XMLName  struct{}       `xml:"tblGrid"`
	GridCols []XTableColumn `xml:"gridCol"`
}

XTableGrid 表格网格

type XTableRow

type XTableRow struct {
	GridSpan int          `xml:"gridSpan,attr,omitempty"`
	Cells    []XTableCell `xml:"tc"`
}

XTableRow 表格行

func (*XTableRow) WriteXML

func (xtr *XTableRow) WriteXML(xw *XMLWriter) error

WriteXML 将 XTableRow 序列化为 XML

type XTextBody

type XTextBody struct {
	XMLName    struct{}            `xml:"txBody"`
	BodyPr     *XBodyPr            `xml:"bodyPr,omitempty"`
	LstStyle   *XTextParagraphList `xml:"lstStyle,omitempty"`
	Paragraphs []XTextParagraph    `xml:"p"`
}

XTextBody 文本主体

func (*XTextBody) WriteXML

func (xtb *XTextBody) WriteXML(xw *XMLWriter) error

WriteXML 将 XTextBody 序列化为 XML

type XTextParagraph

type XTextParagraph struct {
	Level     int        `xml:"lvl,attr,omitempty"`
	Indent    int        `xml:"indent,attr,omitempty"`
	Alignment string     `xml:"algn,attr,omitempty"`
	TextRuns  []XTextRun `xml:"r"`
}

XTextParagraph 文本段落

func (*XTextParagraph) WriteXML

func (xtp *XTextParagraph) WriteXML(xw *XMLWriter) error

WriteXML 将 XTextParagraph 序列化为 XML

type XTextParagraphList

type XTextParagraphList struct {
}

XTextParagraphList 文本段落列表

type XTextProperties

type XTextProperties struct {
	FontSize  int    `xml:"sz,attr,omitempty"`
	Bold      bool   `xml:"b,attr,omitempty"`
	Italic    bool   `xml:"i,attr,omitempty"`
	Underline string `xml:"u,attr,omitempty"`
	FontFace  string `xml:"typeface,attr,omitempty"`
	Color     string `xml:"solidFill,omitempty"`
}

XTextProperties 文本属性

type XTextRun

type XTextRun struct {
	Text           string           `xml:"t,omitempty"`
	TextProperties *XTextProperties `xml:"rPr,omitempty"`
}

XTextRun 文本片段

func (*XTextRun) WriteXML

func (xtr *XTextRun) WriteXML(xw *XMLWriter) error

WriteXML 将 XTextRun 序列化为 XML

type XTheme

type XTheme struct {
	XMLName       struct{}        `xml:"theme"`
	XmlnsA        string          `xml:"xmlns:a,attr"`
	Name          string          `xml:"name,attr,omitempty"`
	ThemeElements *XThemeElements `xml:"themeElements"`
}

XTheme 主题 XML 根元素

func CloneTheme

func CloneTheme() *XTheme

CloneTheme 克隆主题(深拷贝)

func DefaultTheme

func DefaultTheme() *XTheme

DefaultTheme 返回默认主题(懒加载解析)

func ParseTheme

func ParseTheme(data []byte) (*XTheme, error)

ParseTheme 从 XML 字节解析主题

type XThemeElements

type XThemeElements struct {
	ColorScheme *XColorScheme `xml:"clrScheme"`
	FontScheme  *XFontScheme  `xml:"fontScheme,omitempty"`
	FmtScheme   *XFmtScheme   `xml:"fmtScheme,omitempty"`
}

XThemeElements 主题元素集合

type XTransform2D

type XTransform2D struct {
	Offset   *XOv2DrOffset `xml:"off,omitempty"`
	Extent   *XOv2DrExtent `xml:"ext,omitempty"`
	Rotation int           `xml:"rot,attr,omitempty"`
	FlipH    bool          `xml:"flipH,attr,omitempty"`
	FlipV    bool          `xml:"flipV,attr,omitempty"`
}

XTransform2D 二维变换

func (*XTransform2D) WriteXML

func (xt *XTransform2D) WriteXML(xw *XMLWriter) error

WriteXML 将 XTransform2D 序列化为 XML

Jump to

Keyboard shortcuts

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