Problem with merging cells horizontally and vertically at the same time using actxserver in Word

7 ビュー (過去 30 日間)
Hello,
I try to handle the Word with my MATLAB script. I tried to insert a new table and merge cells like on the following example:
Using actxserver and base commands I'm able to insert blank table and merge cells like for Header 1 or for Header 2, but I'm not able to do this operation at the same time. There is an error telling I've already merged some cells e.x. horizontally and I'm not now able to do it vertically. Is there any walkaround to obtain results like on the picture above?
Thanks for help.
  2 件のコメント
chicken vector
chicken vector 2023 年 4 月 24 日
You should share your code if you want detailed help.
Grzegorz Diaczek
Grzegorz Diaczek 2023 年 4 月 24 日
編集済み: Grzegorz Diaczek 2023 年 4 月 24 日
Doing same as here:
https://uk.mathworks.com/matlabcentral/answers/402295-create-and-fill-in-a-table-in-microsoft-word-with-actx-server-from-matlab
%wtable: a word table object
%rowidx: scalar, the row on which the two cells to merge are. 1-based
%colidx: two element array, the two columns to merge on the row. 1-based
trow = wtable.Rows.Item(rowidx);
trow.Cells.Item(colidx(1)).Merge(trow.Cells.Item(colidx(2)))
tcol = wtable.Columns.Item(colidx);
tcol.Cells.Item(rowidx(1)).Merge(tcol.Cells.Item(rowidx(2)))

サインインしてコメントする。

採用された回答

Grzegorz Diaczek
Grzegorz Diaczek 2023 年 4 月 25 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeUse COM Objects in MATLAB についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by