Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default AxSpreadsheet Help !!!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default AxSpreadsheet Help !!!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default AxSpreadsheet Help !!!

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using axSpreadsheet Kaustav Excel Worksheet Functions 0 October 10th 06 05:44 PM
Loading AxSpreadsheet from a .NET resource Paul Hasell Excel Programming 4 September 20th 05 07:26 AM
Opening an Excel file in OWC10.AxSpreadSheet santhosh.b Excel Programming 1 September 16th 05 11:07 AM


All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"