Error declaring Worksheet


#1

I'm getting an error on the declaration of a Worksheet?

Dim book As New Aspose.Cells.Workbook

Dim sheet As New Aspose.Cells.Worksheet

Dim cell As Aspose.Cells.Cell

Error 1 'Aspose.Cells.Worksheet.Private Sub New(stringTable As Aspose.Cells.Record.x4c60c9e2927f2d75, sheets As Aspose.Cells.Worksheets)' is not accessible in this context because it is 'Private'. C:\Inetpub\wwwroot\exporttoExcel\ExporttoExcel\ExporttoExcel\Default.aspx.vb 131 13 ExporttoExcel

Thanks.

Jennifer


#2

Hi Jennifer,

Thanks for considering Aspose.

Well, you cannot instantiate a Worksheet, Cells, Cell etc. objects with New keyworkd in the way, kindly change your code to:

e.g.,

Dim book As New Aspose.Cells.Workbook

//Create a worksheet object with respect to the first (default) worksheet in the book.

Dim sheet As Aspose.Cells.Worksheet = book.Worksheets(0)

//Create cells object and accesses all the cells collection in the sheet.

Dim cells As Aspose.Cells.Cells = sheet.Cells

//Create cell object with respect to A1 cell.

Dim cell As Aspose.Cells.Cell = cells("A1")

cell.PutValue("HelloWorld!")

.......

For Refer please check our wiki docs for programmer's guide and especially: http://www.aspose.com/wiki/default.aspx/Aspose.Cells/ManagingWorksheets.html

and also the source code of our online demos : http://www.aspose.com/Products/Aspose.Cells/Demos/

(The demos gets installed when you use Aspose.Cells MSI to install it on your machine)

Thank you.