• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Problem with macros in excel sheet

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic