From: Scott Neally on 26 Mar 2010 13:36 Andy.Barnard(a)ricardo.com wrote in message <73c11ceb-fe9f-491c-af34-8628057e0c9e(a)l42g2000hsc.googlegroups.com>... > Hi > > I'm successfully making word documents using active x from matlab but > I cannot resize the image that has been pasted into the word document > > using macro record in word the command syntax would appear to be > Selection.InlineShapes(1).Height = newheight > Selection.InlineShapes(1).Width = newheight > > > I use the following code to paste a figure > > > WordFileName=['test.doc']; > CurDir=pwd; > FileSpec = fullfile(CurDir,WordFileName); > actx_word = actxserver('Word.Application'); > actx_word.Visible = true; > trace(actx_word.Visible); > if ~exist(WordFileName,'file'); > % Create new document: > word_handle = invoke(actx_word.Documents,'Add'); > else > % Open existing document: > word_handle = invoke(actx_word.Documents,'Open',FileSpec); > end > > figtoprint=figure(1); > plot([1 1],[2 4]) > print(figtoprint,'-dmeta') > > % Find end of document and make it the insertion point: > end_of_doc = get(actx_word.activedocument.content,'end'); > set(actx_word.application.selection,'Start',end_of_doc); > set(actx_word.application.selection,'End',end_of_doc); > % Paste the contents of the Clipboard: > invoke(actx_word.Selection,'Paste'); > actx_word.Selection.ParagraphFormat.Alignment=2; %align figure to the > right > > > The line below should resize the pasted figure but doesnt work > % actx_word.Selection.InlineShapes(1).Height = 396.85; > > delete(actx_word); > > > > > Does anyone have any experience of doing this and what command you > used > Thank you > I was researching the same thing but didn't come up with a solution using activex. However, you can resize the figure before you save it/copy to clipboard and this will solve your problem with a little trial and error.
|
Pages: 1 Prev: help with NNSYSID neural networks toolbox Next: mean block in simulink |