Excel Automation landscape property question

jordi79jordi79 Member Posts: 273
I am having some problems in getting landscape property from an opened Excel worksheet.
  CREATE(xlApp);
  xlApp.Workbooks.Open('FileName.xls');
  xlWorkBook := xlApp.ActiveWorkbook;
  xlWorkSheet := xlWorkBook.Worksheets.Item(1);
  message(format(xlWorkSheet.PageSetup.Orientation));

When the code above is executed, it pops up with the message of 64. But the valid selection for pagesetup according to excel documentation is 1 for Portrait and 2 for Landscape. Can any provide any explanation for the above?

I also tried with some other page setup property, and I also get the value 64 or 65. But not the actual documented values in Excel.

Comments

  • Faithie_RobertsonFaithie_Robertson Member Posts: 24
    Check the logic in the Excel Buffer table for function CreateSheet. There's an example there of setting the orientation you can use.
    So You Want to be NAV Developer?
    http://www.archerpoint.com/blog/faithie-robertson
    A blog by Faithie Robertson
  • jordi79jordi79 Member Posts: 273
    Hi Faithie,
    Yes. I can set a sheet to landscape. But what I want to do, is to open an excel sheet, and determine whether the sheet is in landscape or in portrait and this is what i am not able to do. what i want to achieve, is to read the landscape or portrait setting in an excel sheet.
Sign In or Register to comment.