Board index » delphi » Detect pagesetup.orientation of excel file

Detect pagesetup.orientation of excel file


2004-12-11 01:08:14 PM
delphi279
How to detect the orientation of excel file
using Landscape or portrait.
i have try
worksheet.pagesetup.orientation
it's always return 0
 
 

Re:Detect pagesetup.orientation of excel file

that's for printing (the page setup)
what do you mean orientation of excel file?
if Excel 2003 or similar has added macro-recording, try it and start
recording a macro - then do the action on the GUI that changes the
"orientation" (???) and stop the macro recording - see the VBA code it made
and you find out the API call you need
Quote
How to detect the orientation of excel file
using Landscape or portrait.

i have try
worksheet.pagesetup.orientation
it's always return 0



 

Re:Detect pagesetup.orientation of excel file

Page Setup for Printing ... using Landscape or portrait.
I have read source office*.pas in folder C:\Program
Files\Borland\Delphi7\Ocx\Servers
but i don't understand how to used the functions and passing the parameter.
could you give me a sample code how to detect pagesetup.orientation.
I have try
worksheet.pagesetup.orientation
it's always return 0,
Portrait always return 2
Landscape always return 2
thank's in advance
"George Birbilis" <XXXX@XXXXX.COM>writes
Quote
that's for printing (the page setup)
what do you mean orientation of excel file?

if Excel 2003 or similar has added macro-recording, try it and start
recording a macro - then do the action on the GUI that changes the
"orientation" (???) and stop the macro recording - see the VBA code it
made
and you find out the API call you need

>How to detect the orientation of excel file
>using Landscape or portrait.
>
>i have try
>worksheet.pagesetup.orientation
>it's always return 0
>
>
>


 

Re:Detect pagesetup.orientation of excel file

Hi,
XLApplication := CreateOleObject('Excel.Application');
XLApplication.Visible := True;
LWbk := XLApplication.Workbooks.Add(xlWBATWorksheet);
LSheets := LWbk.Sheets;
LSheet := LSheets.Item[1];
LSheet.PageSetup.Orientation := 1;
LSheet.Range['A1'].Value := LSheet.PageSetup.Orientation;
LSheet.PageSetup.Orientation := 2;
LSheet.Range['B2'].Value := LSheet.PageSetup.Orientation;
1 is portrait, 2 is landscape
hth,
Mariusz
"PlutuDev" <XXXX@XXXXX.COM>writes
Quote
Page Setup for Printing ... using Landscape or portrait.
I have read source office*.pas in folder C:\Program
Files\Borland\Delphi7\Ocx\Servers
but i don't understand how to used the functions and passing the
parameter.

could you give me a sample code how to detect pagesetup.orientation.

I have try
worksheet.pagesetup.orientation
it's always return 0,
Portrait always return 2
Landscape always return 2

thank's in advance


"George Birbilis" <XXXX@XXXXX.COM>writes
news:41bad57a$XXXX@XXXXX.COM...
>that's for printing (the page setup)
>what do you mean orientation of excel file?
>
>if Excel 2003 or similar has added macro-recording, try it and start
>recording a macro - then do the action on the GUI that changes the
>"orientation" (???) and stop the macro recording - see the VBA code it
made
>and you find out the API call you need
>
>>How to detect the orientation of excel file
>>using Landscape or portrait.
>>
>>i have try
>>worksheet.pagesetup.orientation
>>it's always return 0
>>
>>
>>
>
>


 

Re:Detect pagesetup.orientation of excel file

I have try it this code
landscape and portrait always return 0
Thanks
"Mariusz Celmer" <XXXX@XXXXX.COM>writes
Quote
Hi,

XLApplication := CreateOleObject('Excel.Application');
XLApplication.Visible := True;
LWbk := XLApplication.Workbooks.Add(xlWBATWorksheet);

LSheets := LWbk.Sheets;
LSheet := LSheets.Item[1];

LSheet.PageSetup.Orientation := 1;
LSheet.Range['A1'].Value := LSheet.PageSetup.Orientation;
LSheet.PageSetup.Orientation := 2;
LSheet.Range['B2'].Value := LSheet.PageSetup.Orientation;

1 is portrait, 2 is landscape

hth,
Mariusz

"PlutuDev" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Page Setup for Printing ... using Landscape or portrait.
>I have read source office*.pas in folder C:\Program
>Files\Borland\Delphi7\Ocx\Servers
>but i don't understand how to used the functions and passing the
parameter.
>
>could you give me a sample code how to detect pagesetup.orientation.
>
>I have try
>worksheet.pagesetup.orientation
>it's always return 0,
>Portrait always return 2
>Landscape always return 2
>
>thank's in advance
>
>
>"George Birbilis" <XXXX@XXXXX.COM>writes
>news:41bad57a$XXXX@XXXXX.COM...
>>that's for printing (the page setup)
>>what do you mean orientation of excel file?
>>
>>if Excel 2003 or similar has added macro-recording, try it and start
>>recording a macro - then do the action on the GUI that changes the
>>"orientation" (???) and stop the macro recording - see the VBA code it
>made
>>and you find out the API call you need
>>
>>>How to detect the orientation of excel file
>>>using Landscape or portrait.
>>>
>>>i have try
>>>worksheet.pagesetup.orientation
>>>it's always return 0
>>>
>>>
>>>
>>
>>
>
>


 

Re:Detect pagesetup.orientation of excel file

strange... I test it and works right...
did you use whole my sample or some part of it, and when I change
orientation is it changing in your Excel? I mean the lines:
Quote
>LSheet.PageSetup.Orientation := 1;
and
>LSheet.PageSetup.Orientation := 2;
Mariusz
"PlutuDev" <XXXX@XXXXX.COM>writes
Quote
I have try it this code
landscape and portrait always return 0

Thanks

"Mariusz Celmer" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>Hi,
>
>XLApplication := CreateOleObject('Excel.Application');
>XLApplication.Visible := True;
>LWbk := XLApplication.Workbooks.Add(xlWBATWorksheet);
>
>LSheets := LWbk.Sheets;
>LSheet := LSheets.Item[1];
>
>LSheet.PageSetup.Orientation := 1;
>LSheet.Range['A1'].Value := LSheet.PageSetup.Orientation;
>LSheet.PageSetup.Orientation := 2;
>LSheet.Range['B2'].Value := LSheet.PageSetup.Orientation;
>
>1 is portrait, 2 is landscape
>
>hth,
>Mariusz
>
>"PlutuDev" <XXXX@XXXXX.COM>writes
>news:XXXX@XXXXX.COM...
>>Page Setup for Printing ... using Landscape or portrait.
>>I have read source office*.pas in folder C:\Program
>>Files\Borland\Delphi7\Ocx\Servers
>>but i don't understand how to used the functions and passing the
>parameter.
>>
>>could you give me a sample code how to detect pagesetup.orientation.
>>
>>I have try
>>worksheet.pagesetup.orientation
>>it's always return 0,
>>Portrait always return 2
>>Landscape always return 2
>>
>>thank's in advance
>>
>>
>>"George Birbilis" <XXXX@XXXXX.COM>writes
>>news:41bad57a$XXXX@XXXXX.COM...
>>>that's for printing (the page setup)
>>>what do you mean orientation of excel file?
>>>
>>>if Excel 2003 or similar has added macro-recording, try it and start
>>>recording a macro - then do the action on the GUI that changes the
>>>"orientation" (???) and stop the macro recording - see the VBA code
it
>>made
>>>and you find out the API call you need
>>>
>>>>How to detect the orientation of excel file
>>>>using Landscape or portrait.
>>>>
>>>>i have try
>>>>worksheet.pagesetup.orientation
>>>>it's always return 0
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


 

Re:Detect pagesetup.orientation of excel file

Sorry.
it works fined. I have try what's you wrote.
Before i use component TExcelApplication from Server pallete.
it's does not work.
Thanks for your help.
"Mariusz Celmer" <XXXX@XXXXX.COM>writes
Quote
strange... I test it and works right...

did you use whole my sample or some part of it, and when I change
orientation is it changing in your Excel? I mean the lines:

>>LSheet.PageSetup.Orientation := 1;
and
>>LSheet.PageSetup.Orientation := 2;


Mariusz


"PlutuDev" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...
>I have try it this code
>landscape and portrait always return 0
>
>Thanks
>
>"Mariusz Celmer" <XXXX@XXXXX.COM>writes
>news:XXXX@XXXXX.COM...
>>Hi,
>>
>>XLApplication := CreateOleObject('Excel.Application');
>>XLApplication.Visible := True;
>>LWbk := XLApplication.Workbooks.Add(xlWBATWorksheet);
>>
>>LSheets := LWbk.Sheets;
>>LSheet := LSheets.Item[1];
>>
>>LSheet.PageSetup.Orientation := 1;
>>LSheet.Range['A1'].Value := LSheet.PageSetup.Orientation;
>>LSheet.PageSetup.Orientation := 2;
>>LSheet.Range['B2'].Value := LSheet.PageSetup.Orientation;
>>
>>1 is portrait, 2 is landscape
>>
>>hth,
>>Mariusz
>>
>>"PlutuDev" <XXXX@XXXXX.COM>writes
>>news:XXXX@XXXXX.COM...
>>>Page Setup for Printing ... using Landscape or portrait.
>>>I have read source office*.pas in folder C:\Program
>>>Files\Borland\Delphi7\Ocx\Servers
>>>but i don't understand how to used the functions and passing the
>>parameter.
>>>
>>>could you give me a sample code how to detect pagesetup.orientation.
>>>
>>>I have try
>>>worksheet.pagesetup.orientation
>>>it's always return 0,
>>>Portrait always return 2
>>>Landscape always return 2
>>>
>>>thank's in advance
>>>
>>>
>>>"George Birbilis" <XXXX@XXXXX.COM>writes
>>>news:41bad57a$XXXX@XXXXX.COM...
>>>>that's for printing (the page setup)
>>>>what do you mean orientation of excel file?
>>>>
>>>>if Excel 2003 or similar has added macro-recording, try it and
start
>>>>recording a macro - then do the action on the GUI that changes the
>>>>"orientation" (???) and stop the macro recording - see the VBA
code
it
>>>made
>>>>and you find out the API call you need
>>>>
>>>>>How to detect the orientation of excel file
>>>>>using Landscape or portrait.
>>>>>
>>>>>i have try
>>>>>worksheet.pagesetup.orientation
>>>>>it's always return 0
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>