Changing Captions in Word using Matlab

14 visualizaciones (últimos 30 días)
Mitra
Mitra el 9 de En. de 2013
Respondida: Dave! el 5 de Oct. de 2019
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.

Respuestas (1)

Dave!
Dave! el 5 de Oct. de 2019
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');

Categorías

Más información sobre MATLAB Report Generator en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by