This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

How to set active sheet in Excel sheet?

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a report which opens up in Excel sheet.

Now i have 3 tabs in the sheet.but by default when excel sheet gets opened,its get opened with first tab default selected.

But my requirement is this that it should get opened with 3rd tab selected.
i.e i basically wants to set the focus to 3rd tab.

I am using java Aplet viewer to show the report.

Prashant
 
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you're using some Java component for displaying XLS files? Whichever one that is, doesn't it have an API method you can use to switch between tabs?
 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

Thanks for your reply.

I analysed the code and found that


is the code which displays the output in excel sheet.

so may be i will have to look for some method in response object which can set the focus on the desired tab.

Am i right?

Prashant
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code streams something from a servlet, so I guess the answer to my question is "no, I do not use a component to display an Excel sheet".
The servlet API doesn't know the first thing about the contents of what it streams; you need to check the API of whichever library you're using to create the file.
 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

Thanks for your reply.

But as per my knowledge,here is my analysis.


the first if block checks if the file name ends with 'PDF then the output(i.e the report contents will be shown in PDF format or else if it is not ending with
the .PDF,then the output will be shown in excel sheet.

so i think i need to do something in else statement only.

What do you think?
 
Ulf Dittmer
Rancher
Posts: 43011
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what the "the report contents" are, but you seem to assume that the servlet emits certain file types according to the content type you set. That is not the case; all that header does is tell the client "this is PDF" or "this is XLS". If the content that then gets streamed is not actually in that format, then there will be problems.

So: What format is the content in? How is it created?
 
Prashant Langade
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf

Thanks for your immediate replies.I certainly appreciate .

but you seem to assume that the servlet emits certain file types according to the content type you set



Yes.. it is like that only because when i commented following code



then the report output was directly shown on applet viewer. and it didnt ask for the dialog box (I have attached the dialog box)



File-download-pop-up.JPG
[Thumbnail for File-download-pop-up.JPG]
 
Get me the mayor's office! I need to tell him about this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!