Colin,
I tried out your solution it works fine ..... Thanks
 
I have found another method of adding a worksheet as I had my back to the 
wall.
 
 
            //spreadSheet is the handle to the SpreadSheet I am working with
            WorksheetFeed wsFeed = spreadSheet.Worksheets;
           
            WorksheetEntry worksheet = new WorksheetEntry();
            worksheet = ((WorksheetEntry)wsFeed.Entries[0]);
            worksheet.Cols = 100;
            worksheet.Rows = 100;
            worksheet.Title.Text = "Marco";
            spreadSheetsService.Insert(wsFeed, worksheet);
It serves the intended purpose i.e. that of adding a worksheet.

 

Colin, Thanks once again

 

 

 

 

 

On Wednesday, 16 May 2012 21:35:34 UTC+2, Colin Jones wrote:

> We had this error last week. Unfortunately, I have since deleted the 
> code. I believe we solved it with: 
>
> worksheet.RowCount = new RowCountElement(20); 
> worksheet.ColCount = new ColCountElement(10); 
>
> hope this helps... 
>
> On May 16, 1:24 pm, Marco Desira <[email protected]> wrote: 
> > When the line workSheet.Cols = 10 is executed I get 
> > 
> > System.NullReferenceException was unhandled 
> >   Message=Object reference not set to an instance of an object. 
> >   Source=Google.GData.Spreadsheets 
> >   StackTrace: 
> >        at Google.GData.Spreadsheets.WorksheetEntry.set_Cols(UInt32 
> value) 
> > 
> > The error indicates that the object workSheet.Cols was not instantiated 
> > Any ideas how I can solve this .... Thanks 
> > 
> > Marco 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > On Wednesday, 16 May 2012 20:49:10 UTC+2, Claudio Cherubino wrote: 
> > > Hi Marco, 
> > 
> > > What is the error you get? 
> > > Thanks 
> > 
> > > Claudio 
> > 
> > > On Wed, May 16, 2012 at 11:47 AM, Marco Desira 
> > > <[email protected]>wrote: 
>
> > 
> > >> Adding a worksheet to a spreadsheet using .Net triggers an error. 
> > >> The error is triggered when setting the number of rows and cols of 
> the 
> > >> worksheet. 
> > 
> > >> It seems that there is a bug in the API 
> > 
> > >> The code is found at 
> > 
> > >>https://developers.google.com/google-apps/spreadsheets/#adding_a_work... 
>
> > 
> > >> Refer to the code below. Setting the cols and rows trigegrs the 
> error. 
> > 
> > >> WorksheetEntry worksheet = new WorksheetEntry(); 
> > >>  worksheet.Title.Text = "New Worksheet"; 
> > >>  worksheet.Cols = 10; 
> > >> worksheet.Rows = 20; 
> > 
> > >> Any ideas for a work around? 
> > 
> > >> Thanks

Reply via email to