[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

Printer orientation i word.application COM from Axapta

DR

2/1/2006 10:58:00 PM

How du you set paper orientation i word com object created from Axapta?

COM word = new COM("Word.Application.8");
newDoc = word.Documents();
newDoc.Open(this.parmFileName());
doc = word.ActiveDocument();
pageSetup = doc.pageSetup();
pageSetup.orientation(1)

the above code should work, but it dosen't. I et an error in the
"orientation method"

3 Answers

Mike Frank

2/2/2006 8:48:00 AM

0

The usage of PageSetup works OK for me, though I have a newer Word version (Word 2003, 11.0).

Mabye you could try to use new COM("Word.Application") instead of new COM("Word.Application.8") to
get the most recent Word version on your system.

Mike

DR

2/2/2006 9:28:00 AM

0

Hi Mike

It still don't work. Could you post som x++. Here is the full setup.

I make a .rtf file from axapta 2.5. after that i create a word com object to
make the .ps file though the word print() method. Before i print i would like
the change i orientation

"Mike Frank" wrote:

> The usage of PageSetup works OK for me, though I have a newer Word version (Word 2003, 11.0).
>
> Mabye you could try to use new COM("Word.Application") instead of new COM("Word.Application.8") to
> get the most recent Word version on your system.
>
> Mike
>

Mike Frank

2/2/2006 1:41:00 PM

0

Below find the code which works fine, though it will probably not help you. On your first post you
forgot to mention that you are dealing with an RTF file. In that constellation the test fails for me
too. If you open your RTF file manually in Word, you will see, that the page setup menu item is
disabled. So this is probably just not supported in Word.

#define.wdOrientPortrait(0)
#define.wdOrientLandscape(1)

COM wordApp, docs, doc, selection, pageSetup;

wordApp = new COM("Word.Application");
wordApp.visible(true);
docs = wordApp.Documents();
docs.Add();
doc = wordApp.ActiveDocument();

selection = wordApp.Selection();
selection.TypeText("Hallo Ballo");

pageSetup = doc.pageSetup();
pageSetup.orientation(#wdOrientLandscape);