【发布时间】:2020-08-29 15:45:16
【问题描述】:
有谁知道我如何使用 matlab 和 activeX 将超链接添加到 powerpoint 文件?
在 MatlabCentral 上有两个有用的帖子,但它们并没有给我所需的一切。第一篇讲解如何使用matlab创建powerpoint文件:"Create Powerpoint Files with Matlab"
第二个显示如何使用 ActiveX 将超链接插入 Excel:"Add Hyperlink in Excel from Matlab"(参见 Kaustubha 的第二个答案)
我试图合并这两个答案。在 powerpoint 中,slide 对象具有 .Hyperlinks 属性,但没有像 Excel 中那样用于 .Hyperlinks 的 .Add 方法。
这是我到目前为止的代码。我希望链接出现在表格中:
ppt = actxserver('PowerPoint.Application');
op = invoke(ppt.Presentations,'Add');
slide = invoke(op.Slides,'Add',1,1);
sH = op.PageSetup.SlideHeight; % slide height
sW = op.PageSetup.SlideWidth; % silde width
table = invoke(slide.Shapes, 'AddTable', 1, 3, 0.05*sW, sH*.2, 0.9*sW, sH*.60);
table.Table.Cell(1,1).Shape.TextFrame.TextRange.Text = 'www.stackoverflow.com';
% Add hyperlink to text in table using ActiveX
% slide.Hyperlinks - this exists but there is no add feature
invoke(op,'Save');
invoke(op,'Close');
invoke(ppt,'Quit');
delete(ppt);
【问题讨论】:
标签: matlab hyperlink activex powerpoint