Visual Studio .NET - Generation of Spreadsheet in OWC (ASP NET) in C#

Asked By Eduardo Narváez on 02-Sep-04 05:03 PM
I've seen this article (http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=52701dd7-5606-4256-819e-d2ecf26e6cd7) but I tried to translate to C#, when i tried to compile it, VStudio tells me that "Property, indexer or event 'Range' is not supported by the language" in this code...
 
Microsoft.Office.Interop.OWC.SpreadsheetClass xlsheet = new Microsoft.Office.Interop.OWC.SpreadsheetClass();

xlsheet.Range("A1:A2").Cells(1).Value = 30;

I had another example using (for the object SpreadsheetClass) ActiveSheet.Cells and it works OK but I can't see a way how to format the sheet before presenting it, that's why I wanted to use the way it was used in that example. Can you help me ?

Is there a way to format the values before creating the sheet using OWC in C#, if so, how ?

In C#, indexers are put in sqare brackets - Asked By Peter Bromberg on 02-Sep-04 08:22 PM

xlsheet.Range("A1:A2").Cells(1).Value = 30; 

should be:

xlsheet.Range["A1:A2"].Cells[1].Value = 30; 

Try that first, and see if it works for you.