View unanswered posts | View active topics
It is currently Sat Dec 21, 2024 10:16 am
|
Page 1 of 1
|
[ 6 posts ] |
|
How to get a list of Worksheets in a workbook
Author |
Message |
gregg.drennan@pb.com
Joined: Tue Aug 19, 2008 7:04 pm Posts: 3
|
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 |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
You ca use the following methods to build the list of worksheets:
ExcelDocument.SheetCount
ExcelDocument.easy_getSheetAt
|
Thu Aug 21, 2008 5:17 am |
|
|
gregg.drennan@pb.com
Joined: Tue Aug 19, 2008 7:04 pm Posts: 3
|
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 |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
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 |
|
|
gregg.drennan@pb.com
Joined: Tue Aug 19, 2008 7:04 pm Posts: 3
|
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 |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Microsoft Excel is not required to be installed.
|
Wed Sep 10, 2008 2:26 am |
|
|
|
Page 1 of 1
|
[ 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
|
|