L
Lowell
I have a .NET component (DLL, written in C# with VS 2002)
which loads data from a database into an Excel sheet then
uses that data to create a chart.
When I run it from a Windows program (EXE, also written in
C# with VS 2002), everything is fine.
When I run it as a server-side component from an ASPX
page, I get an error "Unable to set the XXX property of
the PageSetup class" where "XXX"
is "ChartSize", "Orientation", (and presumably, I gave up
after trying the previous ones), "PaperSize" and "Zoom".
(I'm trapping the error and printing out the message that
comes from the exception.) (The idea is to have a web
server component generate the spreadsheet and GIFs of the
charts and then display a page that lets the user download
the GIFs. That way, the client doesn't have to have
Framework, Excel, etc. installed.)
I can make it work through the ASPX page if I completely
remove anything that has to do with the "PageSetup"
property, but then my resulting spreadsheet charts won't
print on a single page (among other issues).
I suspect that there is something with the fact that Excel
does not have access to a display (since it is running
under the IIS server) which makes the "PageSetup" property
invalid. Please say it isn't so and tell me of some magic
trick I can use to make this work!
The code looks like this:
private bool SetPageSetup ( Excel.Chart CurrentChart, ... )
{
....
CurrentChart.PageSetup.ChartSize =
Excel.XlObjectSize.xlFullPage;
....
}
Remember, the DLL works fine as a component in a Windows
EXE or as a downloaded client-side component. It does not
work as a server-side component when run from an ASP.NET
web page.
Any suggestions?
which loads data from a database into an Excel sheet then
uses that data to create a chart.
When I run it from a Windows program (EXE, also written in
C# with VS 2002), everything is fine.
When I run it as a server-side component from an ASPX
page, I get an error "Unable to set the XXX property of
the PageSetup class" where "XXX"
is "ChartSize", "Orientation", (and presumably, I gave up
after trying the previous ones), "PaperSize" and "Zoom".
(I'm trapping the error and printing out the message that
comes from the exception.) (The idea is to have a web
server component generate the spreadsheet and GIFs of the
charts and then display a page that lets the user download
the GIFs. That way, the client doesn't have to have
Framework, Excel, etc. installed.)
I can make it work through the ASPX page if I completely
remove anything that has to do with the "PageSetup"
property, but then my resulting spreadsheet charts won't
print on a single page (among other issues).
I suspect that there is something with the fact that Excel
does not have access to a display (since it is running
under the IIS server) which makes the "PageSetup" property
invalid. Please say it isn't so and tell me of some magic
trick I can use to make this work!
The code looks like this:
private bool SetPageSetup ( Excel.Chart CurrentChart, ... )
{
....
CurrentChart.PageSetup.ChartSize =
Excel.XlObjectSize.xlFullPage;
....
}
Remember, the DLL works fine as a component in a Windows
EXE or as a downloaded client-side component. It does not
work as a server-side component when run from an ASP.NET
web page.
Any suggestions?