How do I use .net to write from Matlab to a word doc

1 回表示 (過去 30 日間)
Eddie
Eddie 2014 年 1 月 30 日
コメント済み: Eddie 2014 年 1 月 30 日
Hi
2011b
I've executed these commands to open a word doc
NET.addAssembly('microsoft.office.interop.word');
wordApp = Microsoft.Office.Interop.Word.ApplicationClass;
wordDoc = wordApp.Documents;
newDoc = wordDoc.Add;
wordApp.Visible = true;
Now I'd like to write text and figure to the word doc. I tried the follwing and got the error
>> para1 = newDoc.Content.Paragraphs.Add;
>> para1.Range.Text = 'Heading 1';
Setting the 'Range' property of the 'Microsoft.Office.Interop.Word.Paragraph'
class is not allowed.
I can see that the text 'Heading 1' was added to the word doc, but why am I getting the error?
What commands would I use to add a figure?
Many thanks Cheers2u

採用された回答

Shivaputra Narke
Shivaputra Narke 2014 年 1 月 30 日
  1 件のコメント
Eddie
Eddie 2014 年 1 月 30 日
works like a charm! Thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Microsoft .NET についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by