File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Error in POI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Error in POI" Watch "Error in POI" New topic
Author

Error in POI

Sylvia Crissy
Greenhorn

Joined: May 14, 2008
Posts: 8
Hi all,

I am working with Excel using POI API.I need to read an excel file and do some modifications and save this file into different location. Along with this I need to remove the extra sheets which is not used by the program. For this I wrote a method inside calling workbook.removeSheetAt(index). This works fine without any exception. The problem now is whenever I tried opened the newly created worksheet it is showing a Removed one or more invalid names repair message box.

how do i solve the problem

thanks in advanced.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi,

I have worked a little with POI and are you sure you are dealing with separate ExcelDocument objects here?

Cheers,
Raj.
Sylvia Crissy
Greenhorn

Joined: May 14, 2008
Posts: 8
Hi Raj,
No I didnt use different ExcelDocument Objects since I need to modify the existing file.
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi Sylvia,

I need to read an excel file and do some modifications and save this file into different location. Along with this I need to remove the extra sheets which is not used by the program. For this I wrote a method inside calling workbook.removeSheetAt(index). This works fine without any exception.
The problem now is whenever I tried opened the newly created worksheet it is showing a Removed one or more invalid names repair message box.


How can you say it is working fine? Because after you do your modifications (including the deletion of unwanted worksheets) if you are not able to check the worksheet how can you say it is working?

My assumption is your modification of the worksheet is working ok and you are probably able to copy it to a new location too. But after deleting unwanted worksheets from the original document you are not able to open the second one?

My thought goes like this, since the two documents are two completely seperate entities why should a deletion of worksheets from one cause an error while opening the other? Unless they are related in some possible manner, which is why I asked the ExcelDocument question. May sound childlike but are you sure you are opening and closing the documents correctly?

Cheers,
Raj.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41839
    
  63
Have you written a little program that opens both files and prints out the names of all sheets? Do you notice anything unusual in that output?

My thought goes like this, since the two documents are two completely seperate entities why should a deletion of worksheets from one cause an error while opening the other? Unless they are related in some possible manner,...

They are related, in that the second document is the first one minus some sheets, saved under a different name, if I understand the question correctly.


Ping & DNS - my free Android networking tools app
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi Ulf,

What I meant by that is not about the content being similar or even same. I feel they are connected as in ExcelDocument or ExcelWorksheet or some other POI object being shared or common for these two files.

Cheers,
Raj.
Sylvia Crissy
Greenhorn

Joined: May 14, 2008
Posts: 8
Hi Ulf,
I tried with a small program which print the sheet names of both the files. the old prints all the sheets while new one prints only modified sheet by deleting the blank sheet.

here is the repair message
Microsoft Excel File Repair Log

Errors were detected in file 'C:\Documents and Settings\Sylvia.ONTASHINDIA\My Documents\Sylvia\projects\hcris\trunk1.1\data\330064_2000-12-31_L.xls'
The following is a list of repairs:

Removed one or more invalid names.


Sanoj Zubair
Greenhorn

Joined: Oct 06, 2008
Posts: 2
[ UD: Please do not post unrelated questions to existing topics. That's called "hijacking" and is frowned upon. Start a new thread instead. ]
[ October 06, 2008: Message edited by: Ulf Dittmer ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error in POI