473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Excel object in C#

Hello,
Does anyone know how looks the syntax of SORT method in
Excel object ( i mean precisely in
Excel.Workbook.Worksheet.Cells.Sort(...) ) I have tryied
in VBA and it works great, but I don't know how to build a
Keys for this method in C# and how to pass this arguments
in this method. Any example howto use this method would be
nice.
Thanks,
Bart

Nov 15 '05 #1
3 8862
private void DemoSort()
{
Excel.Range rng = ThisApplication.get_Range("Fruits",Type.Missing);
rng.Sort(rng.Columns[1, Type.Missing], Excel.XlSortOrder.xlAscending,
rng.Columns[2,Type.Missing], Type.Missing,
Excel.XlSortOrder.xlAscending, Type.Missing,
Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlNo,
Type.Missing, Type.Missing, Excel.XlSortOrientation.xlSortColumns,
Excel.XlSortMethod.xlPinYin, Excel.XlSortDataOption.xlSortNormal,
Excel.XlSortDataOption.xlSortNormal,
Excel.XlSortDataOption.xlSortNormal);
}
"Bart Filipski" <bf******@poczta.onet.pl> wrote in message
news:03****************************@phx.gbl...
Hello,
Does anyone know how looks the syntax of SORT method in
Excel object ( i mean precisely in
Excel.Workbook.Worksheet.Cells.Sort(...) ) I have tryied
in VBA and it works great, but I don't know how to build a
Keys for this method in C# and how to pass this arguments
in this method. Any example howto use this method would be
nice.
Thanks,
Bart

Nov 15 '05 #2
Thanks it works. By the way do you know how to permametly
quit from excel application without quiting the C# program
(I mean in my project function objExcel.Quit() doesn't
stop Excel application, which still remains in background )

Regards
Bart
-----Original Message-----
private void DemoSort()
{
Excel.Range rng = ThisApplication.get_Range ("Fruits",Type.Missing);rng.Sort(rng.Columns[1, Type.Missing], Excel.XlSortOrder.xlAscending, rng.Columns[2,Type.Missing], Type.Missing,
Excel.XlSortOrder.xlAscending, Type.Missing,
Excel.XlSortOrder.xlAscending, Excel.XlYesNoGuess.xlNo, Type.Missing, Type.Missing, Excel.XlSortOrientation.xlSortColumns, Excel.XlSortMethod.xlPinYin, Excel.XlSortDataOption.xlSortNormal, Excel.XlSortDataOption.xlSortNormal,
Excel.XlSortDataOption.xlSortNormal);
}
"Bart Filipski" <bf******@poczta.onet.pl> wrote in message
news:03****************************@phx.gbl...
Hello,
Does anyone know how looks the syntax of SORT method in
Excel object ( i mean precisely in
Excel.Workbook.Worksheet.Cells.Sort(...) ) I have tryied
in VBA and it works great, but I don't know how to build a Keys for this method in C# and how to pass this arguments in this method. Any example howto use this method would be nice.
Thanks,
Bart

.

Nov 15 '05 #3
After calling objExcel.Quit(); add
System.RunTime.InteropServices.Marshal.ReleaseComO bject(objExcel);
"Bart Filipski" <bf******@poczta.onet.pl> wrote in message
news:12****************************@phx.gbl...
Thanks it works. By the way do you know how to permametly
quit from excel application without quiting the C# program
(I mean in my project function objExcel.Quit() doesn't
stop Excel application, which still remains in background )

Regards
Bart
-----Original Message-----
private void DemoSort()
{
Excel.Range rng = ThisApplication.get_Range

("Fruits",Type.Missing);
rng.Sort(rng.Columns[1, Type.Missing],

Excel.XlSortOrder.xlAscending,
rng.Columns[2,Type.Missing], Type.Missing,
Excel.XlSortOrder.xlAscending, Type.Missing,
Excel.XlSortOrder.xlAscending,

Excel.XlYesNoGuess.xlNo,
Type.Missing, Type.Missing,

Excel.XlSortOrientation.xlSortColumns,
Excel.XlSortMethod.xlPinYin,

Excel.XlSortDataOption.xlSortNormal,
Excel.XlSortDataOption.xlSortNormal,
Excel.XlSortDataOption.xlSortNormal);
}
"Bart Filipski" <bf******@poczta.onet.pl> wrote in message
news:03****************************@phx.gbl...
Hello,
Does anyone know how looks the syntax of SORT method in
Excel object ( i mean precisely in
Excel.Workbook.Worksheet.Cells.Sort(...) ) I have tryied
in VBA and it works great, but I don't know how to build a Keys for this method in C# and how to pass this arguments in this method. Any example howto use this method would be nice.
Thanks,
Bart

.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hema S | last post by:
Hi, I want to use excel object in my asp.net application. When excel application is installed its working fine. When i uninstal the excel application and refer the relevant dll explicitly... i...
2
by: Darren Barrick via .NET 247 | last post by:
Hello All! I am using Office Automation in one of my applications in orderto read/write to an excel spreadsheet from a VB.Net application. I thus create the application with ExcelApplication...
3
by: yaya via DotNetMonster.com | last post by:
Hi all, Im using Microsoft Excel 11.0 Object Library as my program reference to create an Excel object, everything works fine but I notice that a process named EXCEL.EXE will run on the backgraound...
3
by: eye5600 | last post by:
I want to read/write Excel files but I am having trouble getting started. Using MS article 302084 as a cookbook, I try to add the reference for MS Excel Object Library. Two versions are listed, 5 &...
4
by: Norton | last post by:
I type the following code to open/close an excel appz Dim oExcel As Excel.Application oExcel = new Excel.Application .... .... ... If Not oExcel Is Nothing Then oExcel.Quit() If Not oExcel...
4
by: Mr.Doubt | last post by:
I've a widows application, that makes use of an EXCEL COM object, to run a few macros available in a EXCEL file. The object is created when the app is started and is closed when the app is closed....
0
by: NDK | last post by:
Ok so I have an html page with an embedded excel object. I load some information into the object from a spreadsheet. (works perfectly) I would like to be able to change the background of a few...
3
by: rlntemp-gng | last post by:
RE: Access 2003/Excel 2003 Problem: After I close the Access application completely, I go out to the Task Manager and there is an Excel.exe object still sitting out there. My Access...
1
by: Scott M. | last post by:
Many methods return objects when they are called. With Excel these objects are placed in memory and must be destroyed via ReleaseComObject as you have done with your NAR method, but the line: ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.