通过MATLAB ActiveX服务器恢复Excel工作表中的CustomView设置

我正在使用ActiveX服务器通过MATLAB修改Excel电子表格中的格式。 我需要生成一个新的电子表格,并且需要在此工作表中设置与之前在较旧的电子表格中设置的CustomView设置相同的CustomView设置。 在这里,我加载了较旧的电子表格,并且能够查看通过Excel定义的CustomView的数量。

e = actxserver ('Excel.Application'); % open Activex server ewb = e.Workbooks.Open(fileName); % open file (enter full path!) >> ewb.CustomViews.get Application: [1x1 Interface.000208D5_0000_0000_C000_000000000046] Creator: 'xlCreatorCode' Parent: [1x1 Interface.000208DA_0000_0000_C000_000000000046] Count: 3 

这是我卡住的部分,因为我不知道如何将这些设置“转移”到另一张纸上。 我发现了一些ActiveX文档,但是没有提到如何能够存储这些设置并在另一个电子表格中使用它们。

我想到的是像…

 myCustomViews = ewb.CustomViews; save('myCustomViews.mat','myCustomViews'); % % % Clear all and close/quit instance of actxserver % % e = actxserver('Excel.Application'); newEwb = e.Workbooks.Open(newFileName); load myCustomViews.mat; newEwb.CustomViews = myCustomViews; 

但我知道这是行不通的,因为(1) myCustomViews似乎没有包含关于视图的任何信息,比如哪些列/行被隐藏,缩放级别等等;(2)不能加载myCustomViews对象保存后正确。 (MATLAB说它不能加载接口)