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[1].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.