Free Support Forum - aspose.com

Multiple questions for a newbie

Hi

Question 1: Workbook.Open - why does it not work if just supplying the name + path to an excel file?

Question 2: Worksheets - how do you "go" for Worksheets to Worksheet - what is the link and how to do it

Question 2.5: Why does Worksheets. Names not list all the sheet-names?

Quesion 3: How to get all the data in a given sheet?

ty

Regards

Claus Madsen

Hi Claus,

Thanks for considering Aspose.

Question 1: Workbook.Open - why does it not work if just supplying the name + path to an excel file?

Well, Workbook.Open(string filename) will work if your excel file is ".xls", But if the file has other formats like .xlsx, csv, xml etc. you have to provide the related FileFormatType.

Question 2: Worksheets - how do you "go" for Worksheets to Worksheet - what is the link and how to do it

Well you may do it quite easily:

Workbook workbook = new Workbook();

Worksheets sheets = workbook.Worksheets;

Worksheet mysheet = sheets[0];

Cells cells = mysheet.Cells;

Cell cell1 = cells["A1"];

.

.

.

http://www.aspose.com/wiki/default.aspx/Aspose.Cells/ManagingWorksheets.html

Question 2.5: Why does Worksheets. Names not list all the sheet-names?

Well, Worksheets.Names properly provides the collection of the named objects like Named Ranges etc.

Quesion 3: How to get all the data in a given sheet?

Well, there are a lots of options to get the worksheet data.

E.g.

Cells.ExportArray()

Cells.ExportDataTable()

Cells.ExportDataTableAsString()

http://www.aspose.com/wiki/default.aspx/Aspose.Cells/ExportData.html

To Copy a complete worksheet you may try to use:

Worksheet.Copy();

http://www.aspose.com/wiki/default.aspx/Aspose.Cells/CopyAndMoveSheets.html

Feel free to contact us any time for your queries.

Thank you.