Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear users and developers,
I want to use on my C# application an windows form containing an AxSpreadsheet to load xls files for the user to edit it. I dont found a way to load an xls file into AxSpreadsheet! can any one help me please? thanks Daniel Junges |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Daniel,
There may be better methods, but the only way I could get that to work (and I ONLY work in VBA, not C#) was to retrieve the data into a recordset, then loop through the recordset and write the data into the ActiveX Spreadsheet control. I didn't post any code because I figured VBA won't help you much... HTH. "Daniel Junges" wrote: Dear users and developers, I want to use on my C# application an windows form containing an AxSpreadsheet to load xls files for the user to edit it. I dont found a way to load an xls file into AxSpreadsheet! can any one help me please? thanks Daniel Junges |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, i found a solution to import the data, its not a fine solution but i
dont found a better way to do it. Now i have to pass the formating. I can't understand wy isn't possible to open a file with AxSpreadsheet :-( Excel.Application excelApp = new Excel.ApplicationClass(); Excel.Workbook excelWorkbook = null; string workbookPath = "C:\\Book1.xls"; excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true); Excel.Sheets sheets = excelWorkbook.Worksheets; Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1); for(int c=1; c<=10; c++){ // From A1 to J10 String CC = "" + (char)(64 + c); Excel.Range range = worksheet.get_Range(CC + "1", CC + "10" ); System.Array myvalues = (System.Array)range.Cells.Value; for (int i = 1; i <= myvalues.Length; i++) { if (myvalues.GetValue(i, 1) == null) axSpreadsheet1.ActiveSheet.Cells[i, c] = ""; else{ String val = (string)myvalues.GetValue(i, 1).ToString(); axSpreadsheet1.ActiveSheet.Cells[i, c] = val; } } } On Thu, 06 Oct 2005 09:43:03 -0300, quartz wrote: Daniel, There may be better methods, but the only way I could get that to work (and I ONLY work in VBA, not C#) was to retrieve the data into a recordset, then loop through the recordset and write the data into the ActiveX Spreadsheet control. I didn't post any code because I figured VBA won't help you much... HTH. "Daniel Junges" wrote: Dear users and developers, I want to use on my C# application an windows form containing an AxSpreadsheet to load xls files for the user to edit it. I dont found a way to load an xls file into AxSpreadsheet! can any one help me please? thanks Daniel Junges -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using axSpreadsheet | Excel Worksheet Functions | |||
Loading AxSpreadsheet from a .NET resource | Excel Programming | |||
Opening an Excel file in OWC10.AxSpreadSheet | Excel Programming |