user3496780
user3496780

Reputation: 15

open excel sheet using hssfworkbook

I am opening an excel sheet having 3 tabs, and I am writing i to those 2 tabs depends upon which of the given three links is clicked in the form. To explain further I have 3 links in form Add, Cancel, Modify and clicking on a certain link would download excel sheet which data in corresponding tab, rest 2 tabs will have blank data.

But every time 1st tab is getting open irrespective of which link has been clicked(data is being written in correct tab), which may confuse the end customer.

How can I make sure that a particular tab should be opened in which data has been written.

Thanks Dheeraj

Upvotes: 0

Views: 1067

Answers (1)

AdityaKeyal
AdityaKeyal

Reputation: 1228

Use the HssfWorkBook.setActiveSheet(int index) or XssfWorkBook.setActiveSheet(int index) where index is the index of the sheet. That should work.

And make sure after doing so, you need to perform write operation as well to make the changes permanent.

Upvotes: 2

Related Questions