Documentation
¶
Index ¶
- Constants
- Variables
- func EMUFromInches(inches float64) int
- func EMUFromMM(mm float64) int
- func EMUFromPoints(points float64) int
- func GetChartTemplate(chartType ChartType) string
- func InchesFromEMU(emu int) float64
- func MMFromEMU(emu int) float64
- func PointsFromEMU(emu int) float64
- func StripNamespacePrefixes(data []byte) ([]byte, error)
- type AppPropsPart
- func (a *AppPropsPart) AppProps() *XMLAppProps
- func (a *AppPropsPart) FromXML(data []byte) error
- func (a *AppPropsPart) GetAppApplication() string
- func (a *AppPropsPart) GetAppCompany() string
- func (a *AppPropsPart) GetAppManager() string
- func (a *AppPropsPart) GetAppSlideCount() int
- func (a *AppPropsPart) GetAppTotalTime() int
- func (a *AppPropsPart) GetAppVersion() string
- func (a *AppPropsPart) GetAppWordCount() int
- func (a *AppPropsPart) PartURI() *opc.PackURI
- func (a *AppPropsPart) SetAppApplication(app string)
- func (a *AppPropsPart) SetAppCharacterCount(count int)
- func (a *AppPropsPart) SetAppCompany(company string)
- func (a *AppPropsPart) SetAppHeadingPairs(headingPairs *XMLHeadingPairs)
- func (a *AppPropsPart) SetAppHiddenSlideCount(count int)
- func (a *AppPropsPart) SetAppHyperlinkBase(base string)
- func (a *AppPropsPart) SetAppLinksUpToDate(upToDate bool)
- func (a *AppPropsPart) SetAppMMClipCount(count int)
- func (a *AppPropsPart) SetAppManager(manager string)
- func (a *AppPropsPart) SetAppNoteCount(count int)
- func (a *AppPropsPart) SetAppParagraphCount(count int)
- func (a *AppPropsPart) SetAppSharedDoc(shared bool)
- func (a *AppPropsPart) SetAppSlideCount(count int)
- func (a *AppPropsPart) SetAppTitlesOfParts(titlesOfParts *XMLTitlesOfParts)
- func (a *AppPropsPart) SetAppTotalTime(minutes int)
- func (a *AppPropsPart) SetAppVersion(version string)
- func (a *AppPropsPart) SetAppWordCount(count int)
- func (a *AppPropsPart) ToXML() ([]byte, error)
- type Background
- func (b *Background) GradientAngle() int32
- func (b *Background) GradientColors() []GradientStop
- func (b *Background) Opacity() float32
- func (b *Background) PictureRId() string
- func (b *Background) PictureURI() string
- func (b *Background) SolidColorRGB() string
- func (b *Background) Type() BackgroundType
- type BackgroundType
- type ChartCategoryData
- type ChartPart
- func (c *ChartPart) FromXML(data []byte) error
- func (c *ChartPart) GetExternalDataRID() string
- func (c *ChartPart) HasExternalData() bool
- func (c *ChartPart) PartURI() *opc.PackURI
- func (c *ChartPart) ReplacePlaceholder(placeholder, value string)
- func (c *ChartPart) ReplacePlaceholders(replacements map[string]string)
- func (c *ChartPart) SetExternalDataRID(rid string)
- func (c *ChartPart) SetRawXML(xml []byte)
- func (c *ChartPart) SetTemplate(tmpl string)
- func (c *ChartPart) Template() string
- func (c *ChartPart) ToXML() ([]byte, error)
- type ChartSeriesData
- type ChartType
- type ColorRole
- type ColorType
- type EmbeddingPart
- func (e *EmbeddingPart) Data() []byte
- func (e *EmbeddingPart) EmbedType() EmbeddingType
- func (e *EmbeddingPart) IsExcel() bool
- func (e *EmbeddingPart) IsWord() bool
- func (e *EmbeddingPart) PartURI() *opc.PackURI
- func (e *EmbeddingPart) Reader() io.Reader
- func (e *EmbeddingPart) SetData(data []byte)
- func (e *EmbeddingPart) SetDataReader(r io.Reader) error
- func (e *EmbeddingPart) Size() int
- func (e *EmbeddingPart) WriteTo(w io.Writer) (int64, error)
- type EmbeddingType
- type GradientStop
- type MediaResource
- func (m *MediaResource) ContentType() string
- func (m *MediaResource) Data() []byte
- func (m *MediaResource) DataSize() int64
- func (m *MediaResource) Extension() string
- func (m *MediaResource) FileName() string
- func (m *MediaResource) HasData() bool
- func (m *MediaResource) HasReader() bool
- func (m *MediaResource) Hash() string
- func (m *MediaResource) IsAudio() bool
- func (m *MediaResource) IsImage() bool
- func (m *MediaResource) IsVideo() bool
- func (m *MediaResource) MediaType() MediaType
- func (m *MediaResource) RID() string
- func (m *MediaResource) Reader() io.Reader
- func (m *MediaResource) SetHash(hash string)
- func (m *MediaResource) SetRID(rId string)
- func (m *MediaResource) Target() string
- type MediaType
- type Placeholder
- func (p *Placeholder) Bounds() (x, y, cx, cy int64)
- func (p *Placeholder) Cx() int64
- func (p *Placeholder) Cy() int64
- func (p *Placeholder) DefaultStyle() *TextStyle
- func (p *Placeholder) ID() string
- func (p *Placeholder) Rotation() int32
- func (p *Placeholder) Type() PlaceholderType
- func (p *Placeholder) X() int64
- func (p *Placeholder) Y() int64
- type PlaceholderType
- type PresentationPart
- func (p *PresentationPart) AddSlide(layoutRId string, slidePart *SlidePart) error
- func (p *PresentationPart) AddSlideMaster(rId string)
- func (p *PresentationPart) FromXML(data []byte) error
- func (p *PresentationPart) PartURI() *opc.PackURI
- func (p *PresentationPart) RemoveSlide(index int) error
- func (p *PresentationPart) SetSlideSize(size SlideSize)
- func (p *PresentationPart) SlideCount() int32
- func (p *PresentationPart) SlideIDAt(index int) (uint32, error)
- func (p *PresentationPart) SlideIDs() []uint32
- func (p *PresentationPart) SlideMasterIDs() []string
- func (p *PresentationPart) SlideSize() SlideSize
- func (p *PresentationPart) ToXML() ([]byte, error)
- type ShapeIDAllocator
- func (a *ShapeIDAllocator) Current() uint32
- func (a *ShapeIDAllocator) IsExhausted() bool
- func (a *ShapeIDAllocator) Next() uint32
- func (a *ShapeIDAllocator) NextBatch(count int) []uint32
- func (a *ShapeIDAllocator) Peek() uint32
- func (a *ShapeIDAllocator) Remaining() uint32
- func (a *ShapeIDAllocator) Reset()
- func (a *ShapeIDAllocator) ResetFrom(startID uint32)
- func (a *ShapeIDAllocator) SetReserved(reservedID uint32)
- func (a *ShapeIDAllocator) UsedCount() uint32
- type ShapeIDAllocatorSync
- func (a *ShapeIDAllocatorSync) Next() uint32
- func (a *ShapeIDAllocatorSync) NextBatch(count int) []uint32
- func (a *ShapeIDAllocatorSync) Peek() uint32
- func (a *ShapeIDAllocatorSync) Reset()
- func (a *ShapeIDAllocatorSync) ResetFrom(startID uint32)
- func (a *ShapeIDAllocatorSync) TryNext() (uint32, bool)
- type SlideLayoutData
- func (l *SlideLayoutData) Background() *Background
- func (l *SlideLayoutData) BodyPlaceholder() *Placeholder
- func (l *SlideLayoutData) ID() string
- func (l *SlideLayoutData) LayoutType() SlideLayoutType
- func (l *SlideLayoutData) MasterID() string
- func (l *SlideLayoutData) Name() string
- func (l *SlideLayoutData) PlaceholderByID(id string) *Placeholder
- func (l *SlideLayoutData) PlaceholderByType(phType PlaceholderType) *Placeholder
- func (l *SlideLayoutData) PlaceholderCount() int
- func (l *SlideLayoutData) Placeholders() map[string]*Placeholder
- func (l *SlideLayoutData) TitlePlaceholder() *Placeholder
- type SlideLayoutPart
- type SlideLayoutType
- type SlideMasterData
- func (m *SlideMasterData) Background() *Background
- func (m *SlideMasterData) ID() string
- func (m *SlideMasterData) LayoutByID(id string) *SlideLayoutData
- func (m *SlideMasterData) LayoutCount() int
- func (m *SlideMasterData) Layouts() []*SlideLayoutData
- func (m *SlideMasterData) Name() string
- func (m *SlideMasterData) PlaceholderByID(id string) *Placeholder
- func (m *SlideMasterData) PlaceholderCount() int
- func (m *SlideMasterData) Placeholders() map[string]*Placeholder
- type SlidePart
- func (s *SlidePart) AddChartRel(targetURI string) string
- func (s *SlidePart) AddImageRel(targetURI string) string
- func (s *SlidePart) AddMediaRel(targetURI string) string
- func (s *SlidePart) AddTableRel(targetURI string) string
- func (s *SlidePart) AllocateShapeID() uint32
- func (s *SlidePart) AllocateShapeIDBatch(count int) []uint32
- func (s *SlidePart) AllocateShapeIDWithOffset(offset uint32) uint32
- func (s *SlidePart) Allocator() *ShapeIDAllocator
- func (s *SlidePart) AppendShapeChild(child any)
- func (s *SlidePart) CurrentShapeID() uint32
- func (s *SlidePart) FromXML(data []byte) error
- func (s *SlidePart) LayoutRId() string
- func (s *SlidePart) MasterRId() string
- func (s *SlidePart) NextShapeID() uint32
- func (s *SlidePart) PartURI() *opc.PackURI
- func (s *SlidePart) PeekNextShapeID() uint32
- func (s *SlidePart) Relationships() *opc.Relationships
- func (s *SlidePart) ResetShapeID()
- func (s *SlidePart) SetLayoutRId(rId string)
- func (s *SlidePart) SetMasterRId(rId string)
- func (s *SlidePart) SetShapeIDStart(startID uint32)
- func (s *SlidePart) SetURI(uri *opc.PackURI)
- func (s *SlidePart) ShapeIDCount() uint32
- func (s *SlidePart) SpTree() *XSpTree
- func (s *SlidePart) ToXML() ([]byte, error)
- type SlideSize
- type TextStyle
- type ThemePart
- func (t *ThemePart) ColorScheme() *XColorScheme
- func (t *ThemePart) FontScheme() *XFontScheme
- func (t *ThemePart) FromXML(data []byte) error
- func (t *ThemePart) GetThemeColor(role ColorRole) *XColorVariant
- func (t *ThemePart) GetThemeColorRGB(role ColorRole) string
- func (t *ThemePart) GetThemeColorType(role ColorRole) ColorType
- func (t *ThemePart) PartURI() *opc.PackURI
- func (t *ThemePart) SetThemeColorRGB(role ColorRole, rgb string)
- func (t *ThemePart) SetThemeColorSystem(role ColorRole, sysColorName, lastClr string)
- func (t *ThemePart) SetThemeData(theme *XTheme)
- func (t *ThemePart) SetThemeMajorFont(latin, eastAsia, complex string)
- func (t *ThemePart) SetThemeMinorFont(latin, eastAsia, complex string)
- func (t *ThemePart) SetThemeScriptFont(isMajor bool, script, typeface string)
- func (t *ThemePart) Theme() *XTheme
- func (t *ThemePart) ToXML() ([]byte, error)
- type XBlip
- type XBlipFillProperties
- type XBodyPr
- type XCSld
- type XClrMap
- type XClrMapOvr
- type XColorScheme
- type XColorVariant
- type XCompatibility
- type XEffectStyleList
- type XFillProperties
- type XFillRectProperties
- type XFillStyleList
- type XFmtScheme
- type XFontCollection
- type XFontScheme
- type XGraphic
- type XGraphicFrame
- type XGroupShapeProperties
- type XLineProperties
- type XLineStyleList
- type XMLAppProps
- type XMLBackground
- type XMLBackgroundPr
- type XMLBackgroundRef
- type XMLBlip
- type XMLBlipFill
- type XMLCNvGrpSpPr
- type XMLCNvPr
- type XMLCommonSlideData
- type XMLCoreProperties
- func (cp *XMLCoreProperties) FromXML(data []byte) error
- func (cp *XMLCoreProperties) GetCreated() string
- func (cp *XMLCoreProperties) GetModified() string
- func (cp *XMLCoreProperties) SetCreated(value string)
- func (cp *XMLCoreProperties) SetModified(value string)
- func (cp *XMLCoreProperties) ToXML() ([]byte, error)
- type XMLExtents
- type XMLFillProperties
- type XMLGradFill
- type XMLGradientStop
- type XMLGradientStopList
- type XMLGroupShape
- type XMLGrpSpPr
- type XMLHeadingPairs
- type XMLLinearGradient
- type XMLNvGrpSpPr
- type XMLNvPr
- type XMLNvSpPr
- type XMLOffset
- type XMLPlaceholder
- type XMLRelationship
- type XMLRelationships
- func (rs *XMLRelationships) Add(rel XMLRelationship)
- func (rs *XMLRelationships) AddNew(id, relType, target string)
- func (rs *XMLRelationships) Count() int
- func (rs *XMLRelationships) FromXML(data []byte) error
- func (rs *XMLRelationships) GetByID(id string) *XMLRelationship
- func (rs *XMLRelationships) GetByTarget(target string) *XMLRelationship
- func (rs *XMLRelationships) GetByType(relType string) []XMLRelationship
- func (rs *XMLRelationships) ToXML() ([]byte, error)
- type XMLSRgbColor
- type XMLSchemeColor
- type XMLShape
- type XMLShapeTree
- type XMLSlideLayout
- type XMLSlideMaster
- type XMLSolidFill
- type XMLSpPr
- type XMLTitlesOfParts
- type XMLTransform
- type XMLW3CDTFDate
- type XMLWriter
- func (xw *XMLWriter) Bytes() []byte
- func (xw *XMLWriter) CData(content string) error
- func (xw *XMLWriter) Capacity() int
- func (xw *XMLWriter) CharData(data []byte) error
- func (xw *XMLWriter) Comment(content string) error
- func (xw *XMLWriter) Declaration() error
- func (xw *XMLWriter) DeclarationWithEncoding(encoding string) error
- func (xw *XMLWriter) Dedent()
- func (xw *XMLWriter) EmptyElement(prefix, localName string) error
- func (xw *XMLWriter) EmptyElementWithAttrs(prefix, localName string, attrs ...string) error
- func (xw *XMLWriter) EndElement(prefix, localName string) error
- func (xw *XMLWriter) Flush() error
- func (xw *XMLWriter) Indent()
- func (xw *XMLWriter) Newline() error
- func (xw *XMLWriter) ProcessingInstruction(target, data string) error
- func (xw *XMLWriter) Raw(content string) error
- func (xw *XMLWriter) Reset(w io.Writer)
- func (xw *XMLWriter) ResetBuffer()
- func (xw *XMLWriter) SetAutoFlush(enable bool)
- func (xw *XMLWriter) SetIndent(indentStr string)
- func (xw *XMLWriter) SetUseIndent(use bool)
- func (xw *XMLWriter) Size() int
- func (xw *XMLWriter) StartElement(prefix, localName string) error
- func (xw *XMLWriter) StartElementNS(prefix, localName, ns string) error
- func (xw *XMLWriter) StartElementNSWithAttrs(prefix, localName, ns string, attrs ...string) error
- func (xw *XMLWriter) StartElementRaw(prefix, localName string, attrs ...string) error
- func (xw *XMLWriter) StartElementWithAttrs(prefix, localName string, attrs ...string) error
- func (xw *XMLWriter) String() string
- func (xw *XMLWriter) Text(content string) error
- func (xw *XMLWriter) TextRaw(content string) error
- func (xw *XMLWriter) WithIndent(fn func())
- func (xw *XMLWriter) WriteBool(val bool) error
- func (xw *XMLWriter) WriteBoolStr(val bool) error
- func (xw *XMLWriter) WriteCentimetersAsEMU(cm float64) error
- func (xw *XMLWriter) WriteEMUs(val int64) error
- func (xw *XMLWriter) WriteEMUsF(val float64) error
- func (xw *XMLWriter) WriteEMUsWithUnit(val int64) error
- func (xw *XMLWriter) WriteFloat64(val float64, prec int) error
- func (xw *XMLWriter) WriteInchesAsEMU(inches float64) error
- func (xw *XMLWriter) WriteInt(val int) error
- func (xw *XMLWriter) WriteInt64(val int64) error
- func (xw *XMLWriter) WriteMillimetersAsEMU(mm float64) error
- func (xw *XMLWriter) WritePercentage(val int) error
- func (xw *XMLWriter) WritePixelsAsEMU(pixels float64) error
- func (xw *XMLWriter) WritePointsAsEMU(points float64) error
- func (xw *XMLWriter) WriteUint64(val uint64) error
- type XMLWriterPool
- type XNonVisualDrawingPic
- type XNonVisualDrawingShape
- type XNonVisualGraphicFrame
- type XNvCxnSpPr
- type XNvGraphicFramePr
- type XNvGrpSpPr
- type XNvPicPr
- type XNvPr
- type XNvSpPr
- type XOutputOptions
- type XOv2DrExtent
- type XOv2DrOffset
- type XPicture
- type XPresentation
- type XPresetFill
- type XPrintSettings
- type XSRGBColor
- type XSchemeClr
- type XScriptFont
- type XShapeProperties
- type XSldId
- type XSldIdLst
- type XSldMasterId
- type XSldMasterIdLst
- type XSldSz
- type XSlide
- type XSp
- type XSpTree
- type XSrgbClr
- type XStretchProperties
- type XSysColor
- type XTable
- type XTableCell
- type XTableColumn
- type XTableGrid
- type XTableRow
- type XTextBody
- type XTextParagraph
- type XTextParagraphList
- type XTextProperties
- type XTextRun
- type XTheme
- type XThemeElements
- type XTransform2D
Constants ¶
const ( // NamespaceExtendedProperties 扩展属性命名空间 NamespaceExtendedProperties = "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" // NamespaceDocPropsVTypes 文档属性类型命名空间 NamespaceDocPropsVTypes = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" )
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}}" )
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" )
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" )
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 关系类型常量
const ChartTemplateArea = `` /* 1946-byte string literal not displayed */
ChartTemplateArea 面积图模板
const ChartTemplateBar = `` /* 1975-byte string literal not displayed */
ChartTemplateBar 柱状图模板
const ChartTemplateDoughnut = `` /* 1549-byte string literal not displayed */
ChartTemplateDoughnut 环形图模板
const ChartTemplateLine = `` /* 2030-byte string literal not displayed */
ChartTemplateLine 折线图模板
const ChartTemplatePie = `` /* 1508-byte string literal not displayed */
ChartTemplatePie 饼图模板
const ChartTemplateScatter = `` /* 2077-byte string literal not displayed */
ChartTemplateScatter 散点图模板
const DefaultThemeXML = `` /* 11896-byte string literal not displayed */
DefaultThemeXML 默认 Office 主题 XML(完整版) 直接复制自标准 Office 主题,确保内容不缺漏
const SlideIDStart = 256
SlideIDStart 是 Slide ID 的起始值
const XMLDeclaration = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`
XMLDeclaration OPC 包中所有 XML 文件的标准声明头
Variables ¶
var DefaultAppProps = &XMLAppProps{
Application: "Microsoft Office PowerPoint",
AppVersion: "15.0000",
Company: "",
Manager: "",
}
DefaultAppProps 默认应用属性模板
var EMUToCentimeters = utils.EMUToCentimeters
EMUToCentimeters 将 EMU 转换为厘米
var EMUToInches = utils.EMUToInches
EMUToInches 将 EMU 转换为英寸
var EMUToPixels = utils.EMUToPixels
EMUToPixels 将 EMU 转换为像素(96 DPI)
var EMUToPoints = utils.EMUToPoints
EMUToPoints 将 EMU 转换为磅
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 StripNamespacePrefixes ¶
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 (*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) 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 设置字数
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) 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 时有效)
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 NewChartPartWithType ¶
NewChartPartWithType 创建指定类型的图表部件
func NewChartPartWithURI ¶
NewChartPartWithURI 使用指定 URI 创建图表部件
func (*ChartPart) GetExternalDataRID ¶
GetExternalDataRID 获取外部数据关系 ID
func (*ChartPart) HasExternalData ¶
HasExternalData 检查是否有外部数据
func (*ChartPart) ReplacePlaceholder ¶
ReplacePlaceholder 替换单个占位符 placeholder: 占位符名称(不含 {{}}) value: 替换值
func (*ChartPart) ReplacePlaceholders ¶
ReplacePlaceholders 批量替换占位符
func (*ChartPart) SetExternalDataRID ¶
SetExternalDataRID 设置外部数据关系 ID
type ChartSeriesData ¶
ChartSeriesData 图表系列数据
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 // 访问过的超链接 )
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) EmbedType ¶
func (e *EmbeddingPart) EmbedType() EmbeddingType
EmbedType 返回嵌入类型
func (*EmbeddingPart) SetDataReader ¶
func (e *EmbeddingPart) SetDataReader(r io.Reader) error
SetDataReader 从 Reader 设置数据
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) 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) Extension ¶
func (m *MediaResource) Extension() string
Extension 返回文件扩展名(如 .png)
func (*MediaResource) FileName ¶
func (m *MediaResource) FileName() string
FileName 返回文件名(如 image1.png)
func (*MediaResource) Reader ¶
func (m *MediaResource) Reader() io.Reader
Reader 返回数据 Reader 对于小文件(使用 Bytes 创建),返回 nil
func (*MediaResource) Target ¶
func (m *MediaResource) Target() string
Target 返回在 ZIP 中的完整路径(如 ppt/media/image1.png)
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) DefaultStyle ¶
func (p *Placeholder) DefaultStyle() *TextStyle
DefaultStyle 返回默认文本样式(可能为 nil)
type PlaceholderType ¶
type PlaceholderType int8
PlaceholderType 占位符类型枚举 对应 XML: <p:ph type="...">
const ( PlaceholderTypeNone PlaceholderType = iota // 未指定 PlaceholderTypeTitle // 标题 PlaceholderTypeBody // 正文/内容 PlaceholderTypeCenterTitle // 居中标题 PlaceholderTypeSubTitle // 副标题 PlaceholderTypeDateTime // 日期时间 PlaceholderTypeSlideNumber // 幻灯片编号 PlaceholderTypeHeader // 页眉 PlaceholderTypeObject // 对象 PlaceholderTypeChart // 图表 PlaceholderTypeTable // 表格 PlaceholderTypeClipArt // 剪贴画 PlaceholderTypeOrgChart // 组织结构图 PlaceholderTypeMedia // 媒体 PlaceholderTypeSlideImage // 幻灯片图像 PlaceholderTypePicture // 图片 )
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) NextBatch ¶
func (a *ShapeIDAllocator) NextBatch(count int) []uint32
NextBatch 批量分配多个 ID count: 需要分配的 ID 数量 返回分配的 ID 数组(不包含 reservedID)
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) NextBatch ¶
func (a *ShapeIDAllocatorSync) NextBatch(count int) []uint32
NextBatch 线程安全地批量分配多个 ID
func (*ShapeIDAllocatorSync) Peek ¶
func (a *ShapeIDAllocatorSync) Peek() uint32
Peek 线程安全地返回下一个将被分配的 ID
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) LayoutType ¶
func (l *SlideLayoutData) LayoutType() SlideLayoutType
LayoutType 返回版式类型
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) 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) 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) 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 NewSlidePartWithURI ¶
NewSlidePartWithURI 使用指定 URI 创建幻灯片部件
func (*SlidePart) AddChartRel ¶
AddChartRel 添加图表关系(带去重) 返回分配的 rId
func (*SlidePart) AddImageRel ¶
AddImageRel 添加图片关系(带去重) 返回分配的 rId
func (*SlidePart) AddMediaRel ¶
AddMediaRel 添加媒体关系(带去重) 返回分配的 rId
func (*SlidePart) AddTableRel ¶
AddTableRel 添加表格关系(带去重) 返回分配的 rId
func (*SlidePart) AllocateShapeID ¶
AllocateShapeID 分配一个新的 shape ID 返回新分配的 ID 值
func (*SlidePart) AllocateShapeIDBatch ¶
AllocateShapeIDBatch 批量分配多个 shape ID
func (*SlidePart) AllocateShapeIDWithOffset ¶
AllocateShapeIDWithOffset 分配一个带偏移量的 shape ID offset: 在当前基础上增加的偏移量
func (*SlidePart) Allocator ¶
func (s *SlidePart) Allocator() *ShapeIDAllocator
Allocator 返回当前的 Shape ID 分配器(用于自定义管理) 注意:单个 Slide 由单 goroutine 负责生成,非并发安全
func (*SlidePart) AppendShapeChild ¶
AppendShapeChild 向形状树添加子元素(用于高层构建器操作)
func (*SlidePart) CurrentShapeID ¶
CurrentShapeID 返回当前最后分配的 Shape ID
func (*SlidePart) NextShapeID ¶
NextShapeID 返回下一个可用的 Shape ID(不递增)
func (*SlidePart) PeekNextShapeID ¶
PeekNextShapeID 查看下一个可用的 Shape ID(不递增)
func (*SlidePart) Relationships ¶
func (s *SlidePart) Relationships() *opc.Relationships
Relationships 返回幻灯片关系管理器(使用 opc.Relationships)
func (*SlidePart) SetLayoutRId ¶
SetLayoutRId 设置关联的布局 rId
func (*SlidePart) SetMasterRId ¶
SetMasterRId 设置关联的母版 rId
func (*SlidePart) SetShapeIDStart ¶
SetShapeIDStart 设置 Shape ID 的起始值
func (*SlidePart) ShapeIDCount ¶
ShapeIDCount 返回已分配的 Shape ID 数量
type SlideSize ¶
SlideSize 幻灯片尺寸
func NewSlideSizeFromStandard ¶
NewSlideSizeFromStandard 根据标准尺寸名称创建 SlideSize
type TextStyle ¶
type TextStyle struct {
// contains filtered or unexported fields
}
TextStyle 文本样式(只读) 用于定义占位符中文本的默认字体、大小、颜色等
type ThemePart ¶
type ThemePart struct {
// contains filtered or unexported fields
}
ThemePart 主题部件
func NewThemePartWithURI ¶
NewThemePartWithURI 使用指定 URI 创建主题部件
func (*ThemePart) GetThemeColor ¶
func (t *ThemePart) GetThemeColor(role ColorRole) *XColorVariant
GetThemeColor 获取指定角色的颜色
func (*ThemePart) GetThemeColorRGB ¶
GetThemeColorRGB 获取指定角色的 RGB 颜色值 返回 6 位十六进制字符串(如 "FF0000"),如果无法获取则返回空字符串
func (*ThemePart) GetThemeColorType ¶
GetThemeColorType 获取指定角色的颜色类型
func (*ThemePart) SetThemeColorRGB ¶
SetThemeColorRGB 设置指定角色的 RGB 颜色值 rgb 为 6 位十六进制字符串(如 "FF0000")
func (*ThemePart) SetThemeColorSystem ¶
SetThemeColorSystem 设置指定角色的系统颜色 sysColorName 为系统颜色名称(如 "windowText", "window") lastClr 为回退 RGB 颜色值(6 位十六进制)
func (*ThemePart) SetThemeData ¶
SetThemeData 设置主题数据(用于设置克隆后的主题)
func (*ThemePart) SetThemeMajorFont ¶
SetThemeMajorFont 设置标题字体
func (*ThemePart) SetThemeMinorFont ¶
SetThemeMinorFont 设置正文字体
func (*ThemePart) SetThemeScriptFont ¶
SetThemeScriptFont 设置脚本特定字体 isMajor: true 为标题字体,false 为正文字体
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 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) RGB ¶
func (c *XColorVariant) RGB() string
RGB 返回 RGB 颜色值 对于 RGB 颜色,直接返回值 对于系统颜色,返回 LastClr(回退颜色)
func (*XColorVariant) SystemColorName ¶
func (c *XColorVariant) SystemColorName() string
SystemColorName 返回系统颜色名称
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 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"` // 超链接是否更改
// 标题对和部件标题(使用 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 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 ¶
XMLExtents 尺寸结构体 对应 XML: <a:ext cx="..." cy="..."/> 用于表示形状或对象的宽度/高度(EMU 单位)
func (*XMLExtents) IsValid ¶
func (e *XMLExtents) IsValid() bool
IsValid 检查是否有效(OpenXML 规范要求 cx 和 cy 必须为正数) 零值或负值尺寸通常表示无效的形状
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 ¶
XMLOffset 偏移量结构体 对应 XML: <a:off x="..." y="..."/> 用于表示形状或对象的 X/Y 坐标位置(EMU 单位)
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) AddNew ¶
func (rs *XMLRelationships) AddNew(id, relType, target string)
AddNew 创建并添加新关系
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 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 NewXMLWriterBuffered ¶
NewXMLWriterBuffered 创建使用缓冲区的 XMLWriter
func NewXMLWriterWithIndent ¶
NewXMLWriterWithIndent 创建带缩进的 XMLWriter
func (*XMLWriter) Bytes ¶
Bytes 返回缓冲区内容的副本(并发安全) 注意:必须返回副本,因为 XMLWriter 会被池化复用 如果返回引用,当 writer 被放回池并重新使用时会导致数据竞争
func (*XMLWriter) DeclarationWithEncoding ¶
DeclarationWithEncoding 写入带编码的 XML 声明
func (*XMLWriter) EmptyElement ¶
EmptyElement 写入空元素标签
func (*XMLWriter) EmptyElementWithAttrs ¶
EmptyElementWithAttrs 写入带属性的空元素
func (*XMLWriter) EndElement ¶
EndElement 写入结束元素标签
func (*XMLWriter) ProcessingInstruction ¶
ProcessingInstruction 写入处理指令
func (*XMLWriter) SetAutoFlush ¶
SetAutoFlush 设置是否自动刷新到 writer
func (*XMLWriter) StartElement ¶
StartElement 写入起始元素标签
func (*XMLWriter) StartElementNS ¶
StartElementNS 写入带命名空间的起始元素
func (*XMLWriter) StartElementNSWithAttrs ¶
StartElementNSWithAttrs 写入带命名空间和属性的起始元素
func (*XMLWriter) StartElementRaw ¶
StartElementRaw 写入起始元素(不转义属性值)
func (*XMLWriter) StartElementWithAttrs ¶
StartElementWithAttrs 写入带属性的起始元素
func (*XMLWriter) WriteBoolStr ¶
WriteBoolStr 写入布尔值字符串(true/false)
func (*XMLWriter) WriteCentimetersAsEMU ¶
WriteCentimetersAsEMU 将厘米转换为 EMU 并写入
func (*XMLWriter) WriteEMUsF ¶
WriteEMUsF 写入浮点 EMU 值(基于常用单位转换)
func (*XMLWriter) WriteEMUsWithUnit ¶
WriteEMUsWithUnit 写入带单位的 EMU 值
func (*XMLWriter) WriteFloat64 ¶
WriteFloat64 写入浮点数值
func (*XMLWriter) WriteInchesAsEMU ¶
WriteInchesAsEMU 将英寸转换为 EMU 并写入
func (*XMLWriter) WriteInt64 ¶
WriteInt64 写入 64 位整数值
func (*XMLWriter) WriteMillimetersAsEMU ¶
WriteMillimetersAsEMU 将毫米转换为 EMU 并写入
func (*XMLWriter) WritePercentage ¶
WritePercentage 写入百分比值
func (*XMLWriter) WritePixelsAsEMU ¶
WritePixelsAsEMU 将像素转换为 EMU 并写入
func (*XMLWriter) WritePointsAsEMU ¶
WritePointsAsEMU 将磅转换为 EMU 并写入
func (*XMLWriter) WriteUint64 ¶
WriteUint64 写入无符号 64 位整数值
type XMLWriterPool ¶
type XMLWriterPool struct {
// contains filtered or unexported fields
}
XMLWriterPool 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
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 ¶
XNvCxnSpPr 连接形状非视觉属性
type XNvGraphicFramePr ¶
type XNvGraphicFramePr struct {
CNvPr *XNvPr `xml:"cNvPr,omitempty"`
}
XNvGraphicFramePr 图形框架非视觉属性
type XNvGrpSpPr ¶
type XNvGrpSpPr struct {
CNvPr *XNvPr `xml:"cNvPr,omitempty"`
}
XNvGrpSpPr 组形状非视觉属性
type XOutputOptions ¶
type XOutputOptions struct {
UsePrintFml *bool `xml:"usePrintFml,attr,omitempty"`
CloneLinkedObjs *bool `xml:"cloneLinkedObjs,attr,omitempty"`
}
XOutputOptions 输出选项
type XOv2DrExtent ¶
XOv2DrExtent 扩展尺寸
type XOv2DrOffset ¶
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 图片
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 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 XSldMasterId ¶
XSldMasterId 单个母版 ID
type XSldMasterIdLst ¶
type XSldMasterIdLst struct {
SldMasterIds []XSldMasterId `xml:"sldMasterId"`
}
XSldMasterIdLst 母版 ID 列表
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 结构
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 形状
type XSpTree ¶
type XSpTree struct {
XMLName struct{} `xml:"spTree"`
NonVisual nvGrpSpPr `xml:"nvGrpSpPr"`
GroupShapeProperties *XGroupShapeProperties `xml:"grpSpPr,omitempty"`
Children []any `xml:"-"`
}
XSpTree 形状树
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 表格
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 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 表格行
type XTextBody ¶
type XTextBody struct {
XMLName struct{} `xml:"txBody"`
BodyPr *XBodyPr `xml:"bodyPr,omitempty"`
LstStyle *XTextParagraphList `xml:"lstStyle,omitempty"`
Paragraphs []XTextParagraph `xml:"p"`
}
XTextBody 文本主体
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 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 文本片段
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 根元素
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