• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with macros in excel sheet

 
Megan Hill
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a web application which opens an excel spreadsheet upon clicking a link.
It all works fine but there are a few macros on the excel sheet and they don't seem to work.
This is the code I use to open the excel sheet:
ServletOutputStream sout = null;
try {
response.setContentType(result.getMimeType());
response.setContentLength(result.getData().length);
sout = response.getOutputStream();
sout.write(result.getData());
sout.flush();
} finally {
if (sout != null) {
sout.close();
}
where the result object has the info for mime type as "application/msexcel" and the data is loaded from the database.
The macros are there but when a button is clicked on the excel sheet
it displays an error saying "the macro sharedobject.do?criteria.object=1234'!clearcontents' cannot be found".
where sharedobject.do?criteria.object=1234 is the original URL for opening the excel sheet and clearcontents is the macro name.
Any help would be appreciated.
 
Megan Hill
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I guess what is happening is that the URL gets displayed in the title of the excel spreadsheet and the macro appends the title to the maro name.
Is there a way to display the file name in the title instead of the URL from where it is downloaded.
Waiting for a response. Thanks
 
Guru
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi megan,
i hope u need to set the header before write to outputstream. by using...

response.setHeader("Content-disposition", "inline; filename="+ FileName);
but before that you need to get the filename.
All the Best.
ravus
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!