I have a JSP that needs the capacity to be viewed from the browser and also exported to MS Excel. I have the display in the browser working fine. On the JSP I have an "Export to Excel" button. When clicked, I set a hidden field called format to "excel" and then the page is submitted. When the page is reloaded, I examine the request parameters for this value:
This code does cause MS Excel to open and display my page. My questions concern how could I control the formatting of the data when it has been exported to Excel: -- How do I control the width and height of the cells? I need the data to be formatted so that it will all fit on one page when printed in portrait mode. -- The file is not automatically maximized in the Excel window. How can I tell it to open fully maximized? -- I specify that the name of the file is DailyCensus.xls. When it opens in Excel, it is DailyCensus.xls and the name of the worksheet is DailyCensus 1. Why does it use the "1"? Is there a way to prevent this? -- Is there a way for me to set the default location for the file to be saved? Currently, it defaults to C:\Documents and Settings\[user id]\Local Settings\Temporary Internet Files\... I'd rather have it set to a specific folder of a network drive. How do I do this? I really appreciate any suggestions you have. Thanks.
Joined: Jan 18, 2001
The only way that I have found to control the layout and look of the data once it is exported to Excel is to use ActiveXObject. I want to know now if there are any security concerns when using code with the ActiveX object. Also, does anyone know how to specify the margins? I'm using:
If anyone can tell me the security implications of using such an ActiveXControl, I'd appreciate it. I'm also confused on how to set the margins. The code above is commented out because it doesn't work. Thanks for your help.