Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Writing matrix directly into Microsoft WORD as a table
Replies: 3   Last Post: Dec 27, 2012 12:12 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Mitra

Posts: 2
Registered: 12/27/12
Re: Writing matrix directly into Microsoft WORD as a table
Posted: Dec 27, 2012 11:52 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Vadivelu M" <velgates@hotmail.com> wrote in message <eec26db.0@WebX.raydaftYaTP>...
> Hi Jionglong,
>
>
> Following are the R13 commands for Word-Matlab activex controls.
>
>
> %%%%START%%%%
> %Get actx handles for the word application.
> word = actxserver('Word.Application');
>
>
> %Set visibility true.
> word.Visible = 1;
>
>
> %Add the new document
> newdoc = word.Documents.Add;
>
>
> %To insert a table into the document
> %Get the selection(cursor) handle
> selection = word.Selection;
> matrix = rand(5, 4);
> [rows, cols] = size(matrix);%get matrix size
> newtable = newdoc.Tables.Add(selection.Range, rows, cols);
>
>
> for row_idx = 1 : rows
> for col_idx = 1 : cols
> selection.TypeText(num2str(matrix(row_idx, col_idx)));
> selection.MoveRight;
> end
> selection.MoveRight;
> end
> %%%%END%%%%
>
>
> This will write your entire matrix contents into a word table.
>
>
> -Vadivelu M
> ===========




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.