我正在尝试制作一个简单的程序,该程序将读取幻灯片段落内的文本并在控制台中简单地打印出来。
我已经做了一些浏览并找到了解决方案,但仅适用于 Word 文档,没有专门针对 PPTX 文件的解决方案
这是错误:
[ DEBUG ] 2
[ DEBUG ] DocumentVersion.ID = 0
[ DEBUG ] Getting Raw Text
2019/05/21 01:54:22 unsupported relationship type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps tgt: ppt/presProps.xml
2019/05/21 01:54:22 unsupported relationship type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps tgt: ppt/viewProps.xml
2019/05/21 01:54:22 unsupported relationship type: http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles tgt: ppt/tableStyles.xml
slide
slide
slide
&{0xc00021f380 <nil> <nil>}
&{<nil> 0xc000289f28 <nil>}
这是一段代码
if *f == f.PPTX() {
pres, _ := presentation.Open("/Users/asus/Desktop/test.pptx")
buf := ""
_ = buf
for _, slide := range pres.Slides() {
fmt.Println("slide")
for _, box := range slide.PlaceHolders() {
fmt.Println(box.Index())
// for _, para := range box.Paragraphs() {
// fmt.Println(para)
// fmt.Println("para")
// }
}
}
}
虽然它在 pres.Slide() 成功循环
有人可以给我详细解释该错误以及如何解决该错误吗?我认为唯一的问题是它无法打开文件。
最佳答案
关于xml - 不支持的关系类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56226070/