如何在Matlab中将多个图形插入到多个表格中?

3

我希望在MATLAB中实现以下内容:

页面1

______________
|      |     |
| Fig1 | Fig2|
|      |     |
|______|_____|
|      |     |
| Fig3 | Fig4|
|      |     |
|______|_____|

第二页

______________
|      |     |
| Fig5 | Fig6|
|      |     |
|______|_____|
|      |     |
| Fig7 | Fig8|
|      |     |
|______|_____|

我无法确定传递InsertBreak参数以获取新页面的方法:

word = actxserver('Word.Application');

word.Visible = 1;

op = invoke(word.Documents,'Add');

active=word.ActiveDocument;

%% Table 1
% Create 4x4 table
range=word.Selection.Range;
shapes=word.Selection.InlineShapes;
t=invoke(word.ActiveDocument.Tables,'add',range,2,2);

% fill each cell with an image, image will fit to table
invoke(shapes,'addpicture',fullfile(pwd, 'fig1.wmf'));

invoke(word.Selection,'moveright',1,1);
invoke(shapes,'addpicture',fullfile(pwd, 'fig2.wmf'));

invoke(word.Selection,'moveright',1,2);
invoke(shapes,'addpicture',fullfile(pwd, 'fig3.wmf'));

invoke(word.Selection,'moveright',1,1);
invoke(shapes,'addpicture',fullfile(pwd, 'fig4.wmf'));

%% Table 2, I want this on a new page
invoke(word.Selection,'InsertBreak',2); % how do I get the next stuff on a new page?
range=word.Selection.Range;
shapes=word.Selection.InlineShapes;
t=invoke(word.ActiveDocument.Tables,'add',range,1,2);

invoke(shapes,'addpicture',fullfile(pwd, 'fig1.wmf'));
invoke(word.Selection,'moveright',1,1);
invoke(shapes,'addpicture',fullfile(pwd, 'fig2.wmf'));
1个回答

1
尝试使用以下代码替换您的InsertBreak行。它将选择的起始位置移动到文档末尾。如果不进行移动,您的代码将在表格单元格内插入分页符。
invoke(word.Selection, 'MoveStart', 6);
invoke(word.Selection, 'InsertBreak');

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接