Unable to set the Orientation property of the PageSetup class - ASP.NET 2.0 Excel 2003
I am working on Excel report recentlty. Create Excel, Add worksheet all are working fine. the only problem is that I got the exception: System.Runtime.InteropServices. COMException (0x800A03EC): Unable to set the Orientation property of the PageSetup class
My code to set Orientation is something like this:
Dim objSheet As Excel.Worksheet
.........
objSheet.Activate()
objSheet.Select()
objSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape
I searched in google for a whole day to solve this. Now the solution comes out:
1. set up a default printer .
Once a default printer was added, the code worked fine!
2. The .net Process (aspnet_wp.exe) should have access to the printer.
Printer --> Properties --> Security --> add asp_net user

12/5/2007 10:38:44 PM
Category
.Net Tips
Back