Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Simple quetion on Activex

Subject: Simple quetion on Activex

From: Squall Mania

Date: 13 Jan, 2010 19:11:04

Message: 1 of 4

I'm using ActiveX-Word in MATLAB and I would like to know a few things:

1. How to underline a certain word. Example of a code is below:

end_of_doc = get(content,'end');
set(selection,'Start',end_of_doc);
selection.TypeParagraph;
set(selection, 'Text',' Compressor');
selection.Font.Size=12;
selection.MoveDown;
set(paragraphformat, 'Alignment','wdAlignParagraphCenter');

How to underline the word "Compressor" in the above example?

2. How to insert a picture (logo) into the word document? I have a certain logo and I want to insert it at the top left corner. Is that possible?

Your answer is highly appreciated!

Thanks

Subject: Simple quetion on Activex

From: Yair Altman

Date: 14 Jan, 2010 13:33:06

Message: 2 of 4

"Squall Mania" <r_skeik@hotmail.com> wrote in message <hil5s8$eos$1@fred.mathworks.com>...
> I'm using ActiveX-Word in MATLAB and I would like to know a few things:
>
> 1. How to underline a certain word. Example of a code is below:
>
> end_of_doc = get(content,'end');
> set(selection,'Start',end_of_doc);
> selection.TypeParagraph;
> set(selection, 'Text',' Compressor');
> selection.Font.Size=12;
> selection.MoveDown;
> set(paragraphformat, 'Alignment','wdAlignParagraphCenter');
>
> How to underline the word "Compressor" in the above example?
>
> 2. How to insert a picture (logo) into the word document? I have a certain logo and I want to insert it at the top left corner. Is that possible?
>
> Your answer is highly appreciated!
>
> Thanks


You can do these things (and more) using the OfficeDoc utility: http://www.mathworks.com/matlabcentral/fileexchange/15192-officedoc

Yair Altman
http://UndocumentedMatlab.com
http://ymasoftware.com

Subject: Simple quetion on Activex

From: Matt J

Date: 14 Jan, 2010 15:17:20

Message: 3 of 4

On a related note, I'm interested in getting an intro to ActiveX. Any good "Getting Started" resources out there?

Subject: Simple quetion on Activex

From: rickcanham

Date: 29 Jan, 2010 00:26:43

Message: 4 of 4

Squall,

Word = actxserver('Word.Application');
Word.Visible = true;
WordDoc = invoke(Word.Documents, 'Add');
Word.Selection.Font.Underline = 'wdUnderlineSingle';
Word.Selection.TypeText('My underlined text');
Word.Selection.Font.Underline = 'wdUnderlineNone';
Word.Selection.TypeText('More text without underline');

I go to Microsofts MSDN's site to look up commands then hack through
code until I get it to work.

The underline options are:

wdUnderlineDash 7 Dashes.
wdUnderlineDashHeavy 23 Heavy dashes.
wdUnderlineDashLong 39 Long dashes.
wdUnderlineDashLongHeavy 55 Long heavy dashes.
wdUnderlineDotDash 9 Alternating dots and dashes.
wdUnderlineDotDashHeavy 25 Alternating heavy dots and heavy
dashes.
wdUnderlineDotDotDash 10 An alternating dot-dot-dash
pattern.
wdUnderlineDotDotDashHeavy 26 An alternating heavy dot-dot-dash
pattern.
wdUnderlineDotted 4 Dots.
wdUnderlineDottedHeavy 20 Heavy dots.
wdUnderlineDouble 3 A double line.
wdUnderlineNone 0 No underline.
wdUnderlineSingle 1 A single line. default.
wdUnderlineThick 6 A single thick line.
wdUnderlineWavy 11 A single wavy line.
wdUnderlineWavyDouble 43 A double wavy line.
wdUnderlineWavyHeavy 27 A heavy wavy line.
wdUnderlineWords 2 Underline individual words only.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us