Reply to topic  [ 6 posts ] 
How to get a list of Worksheets in a workbook 
Author Message

Joined: Tue Aug 19, 2008 7:04 pm
Posts: 3
Reply with quote
Post How to get a list of Worksheets in a workbook
I need to allow a user to interactively choose the spreadsheet to open but then provide a list, dropdown, etc. for the user to then choose the worksheet(s) to import.

I haven't been able to find anything in the documentation that addresses how to get a list of the worksheets in a workbook and would appreciate any information or direction where I might be able to find this.

Thanks,

_________________
Gregg Drennan
Advanced Application Development
Pitney Bowes, Inc.


Tue Aug 19, 2008 7:09 pm
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
You ca use the following methods to build the list of worksheets:
ExcelDocument.SheetCount
ExcelDocument.easy_getSheetAt


Thu Aug 21, 2008 5:17 am
Profile WWW

Joined: Tue Aug 19, 2008 7:04 pm
Posts: 3
Reply with quote
Post 
Hi Daniela,

While your solutiopn will tell me the number of sheets in the workbook and then allow importing them via the ordinal number it doesn't address my need of getting a list of the sheet names to then present to a customer from which they can the choose the sheet that they want to import.

I've found a method that works in C#, basically opening the workbook with OLEDB and then getting all the "tables" from the schema.

Since I've purchased the EasyXLS library and it is all about reading and writing workbooks and formatted worksheets, I assume that this would be one of the basic functionalities that EasyXLS would provide.

_________________
Gregg Drennan
Advanced Application Development
Pitney Bowes, Inc.


Fri Aug 22, 2008 1:47 pm
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
You can use a code similar with this:

//Create the sheet list for the dropdown
ExcelDocument xls = new ExcelDocument();
xls.easy_LoadXLSFile(file);
for (int nSheet=0; nSheet<xls.SheetCount(); nSheet++){
yourlist.add(xls.easy_getSheetAt(nSheet)).getSheetName();
}

......................................................

//Load the selected sheet for the dropdown list
ExcelWorksheet xlsWorksheet = (ExcelWorksheet)xls.easy_getSheet(selectedSheetName);


Mon Sep 08, 2008 2:36 am
Profile WWW

Joined: Tue Aug 19, 2008 7:04 pm
Posts: 3
Reply with quote
Post 
Hi Daniela,

Thanks for the response but please see my previous comments regarding using only the EasyXLS functionallity.

Both of your previous suggested solutions would require Excel or at least the Excel runtime to be installed on our server... which our administrators refuse to do.

I need a EasyXLS based solution.

If EasyXLS doesn't support this then please just say so and I can get on with business.

Thanks,

Gregg

_________________
Gregg Drennan
Advanced Application Development
Pitney Bowes, Inc.


Mon Sep 08, 2008 3:11 am
Profile

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 189
Location: Brasov, Romania
Reply with quote
Post 
Microsoft Excel is not required to be installed.


Wed Sep 10, 2008 2:26 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.