MCPcopy
hub / github.com/qax-os/excelize / setContentTypePartRelsExtensions

Method setContentTypePartRelsExtensions

workbook.go:289–307  ·  view source on GitHub ↗

setContentTypePartRelsExtensions provides a function to set the content type for relationship parts and the Main Document part.

()

Source from the content-addressed store, hash-verified

287// setContentTypePartRelsExtensions provides a function to set the content type
288// for relationship parts and the Main Document part.
289func (f *File) setContentTypePartRelsExtensions() error {
290 var rels bool
291 content, err := f.contentTypesReader()
292 if err != nil {
293 return err
294 }
295 for _, v := range content.Defaults {
296 if v.Extension == "rels" {
297 rels = true
298 }
299 }
300 if !rels {
301 content.Defaults = append(content.Defaults, xlsxDefault{
302 Extension: "rels",
303 ContentType: ContentTypeRelationships,
304 })
305 }
306 return err
307}
308
309// setContentTypePartImageExtensions provides a function to set the content type
310// for relationship parts and the Main Document part.

Callers 2

addContentTypePartMethod · 0.95

Calls 1

contentTypesReaderMethod · 0.95

Tested by 1