none
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.

    Thanks!

    Tuesday, July 27, 2010 12:30 PM

Answers

  • 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,

    http://support.microsoft.com/kb/257757

    "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 asp.net thread help,

    http://support.microsoft.com/?id=291298

    http://forums.asp.net/t/1189871.aspx


    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
    Moderator