Unable to set the Orientation property of the PageSetup class with Interop 2003 and Server 2008 RRS feed

  • Question

  • Hi,

    In the most recent release of a new service, we have a section of code that creates an Excel document and saves it in a location.  Nothing super complicated.  This service uses the 2003 Excel Interops (not my choice -- it's what is passed down to us from above as a requirement) to do this.

    Previous to this weekend's install, the service was installed on Server 2003 and worked perfectly.  The production version that it lives on, however, is Server 2008.  Any time this service tries to create an Excel document it thows the error Unable to set the Orientation property of the PageSetup class.  It was not giving this error on 2003.

    After searching online the only things I can find tell me to install a default printer.  Which I did.  It did not fix anything.  The 2003 server didn't have any installed anyway, so I don't see this as the hinderance.

    Is this something weird with 2008 not installing the ASPNET user?  Maybe something else that I maybe don't even know to guess?

    If anyone has any other ideas, they would be greatly appreciated.  At this point I'm at a loss as to what to even try.


    Tuesday, July 27, 2010 12:30 PM


  • Hi Jay,

    Office is not designed and supposed to be automated from the server side. So you are running into an unsupported scenario. You can read more detailed information about this in the following KB article,

    "Developers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service."

    As to the issue itself, see if the following KB article and thread help,

    Best regards,
    Ji Zhou - MSFT
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, July 28, 2010 9:21 AM