Changing Captions in Word using Matlab

11 ビュー (過去 30 日間)
Mitra
Mitra 2013 年 1 月 9 日
回答済み: Dave! 2019 年 10 月 5 日
Hello All,
1. Does any one know how to change the Font and Size of the caption to tables in word using Matlab commands?
I use
actx_Report = actxserver('Word.Application');
actx_Report.ActiveDocument.Tables.Add(actx_Report.Selection.Range,5,7,1,1);
to generate the table.
and
actx_Report.Selection.InsertCaption('Table', [' : Absolute Mean Error', num2str(j)], '', 0, false);
to insert captions.

回答 (1 件)

Dave!
Dave! 2019 年 10 月 5 日
Hello,
I know this is an older question, but here is a workaround that I have found handy.
Since you have access to the Styles of a document, I find it easier to create an absolutely empty file that has all Styles in it that I want. For instance, I set the Caption style to be bold, centered, non-italics, and the font size that I want. When I want to create a new Word file from MATLAB, I simply make a copy of my template file and open that rather than open a brand new document that will be of Word's default template style.
Then, when I actxserver.Selection.InsertCaption, it is already formatted how I want.
Word also has a set of Table styles that you can apply:
tbl = actXObj.ActiveDocument.Tables.Add(actXObj.Selection.Range, nRows, nCols, 1, 1);
tbl.ApplyStyleDirectFormatting('NameOfCustomTableStyle');

カテゴリ

Help Center および File ExchangeMATLAB Report Generator についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by