all groups > dotnet windows forms > january 2007 >
You're in the

dotnet windows forms

group:

Excel grid control in Visual Studio 2005 app


Excel grid control in Visual Studio 2005 app Any User
1/31/2007 10:44:58 AM
dotnet windows forms:
Hello

I have an Excel spreadsheet, that holds some tabular data, and a macro,
that exports it daily do SQL Server 2000 table.

Now I want to build VS2005 application, that embeds Excel grid, that is
connected directly to SQL Server.

I've seen such application (unfortunately closed source), so I know,
that this is possible. But I don't know, how to start, since I'm a
DotNet beginner.

Can someone point me, where to start?

Re: Excel grid control in Visual Studio 2005 app RobinS
1/31/2007 3:19:32 PM
I think this is the kind of thing that Visual Studio Tools for Office does.
The only other way I could think of is to imbed the grid in a webpage, and
I don't think that will suffice.

Robin S.
----------------------------
[quoted text, click to view]

Re: Excel grid control in Visual Studio 2005 app RobinS
2/1/2007 2:54:03 PM
[quoted text, click to view]

Oliver,

I agree with you, I don't really think he can do it, but I've only seen
quick demos of VSTO, and didn't want to rule it out. But I do think you're
right, it's for Excel Applications, and not for imbedding Excel into a VB
application, but since I wasn't 100% sure, didn't want to post that.

The only way I think this would work is imbedding it in IE, and I guess
you'd have to do the updates using ADO. I'd actually just us a DataGrid;
bringing Excel into the mix is too difficult. What if they put in formulas
and stuff like that, how are you going to save that to a database?

If I was going to use Excel today, I'd use OLE Automation. I've done a lot
of that to create reports. If I needed user input, I'd stick with Windows
Forms.

I went to the Vista Launch in San Francisco on Tuesday, and the Office 2007
stuff is really cool. They showed a lot of updating it here and having the
results show up there, but I think the whole thing had Sharepoint behind
it, which is a completely different beast altogether. (It looked cool,
though!)

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.

Re: Excel grid control in Visual Studio 2005 app Oliver Sturm
2/1/2007 7:43:36 PM
Hello RobinS,

[quoted text, click to view]

I can't claim I've looked into this in all detail, but I think at least by
default VSTO works the other way round: it allows you to develop
extensions for Office applications, which can go so far as to get rid of
all the standard Office UI and replace it with your own (within limits).
At least this works in conjunction with Office 2007, not sure how far it
goes with 2003. In any case, if your UI and your application functionality
are rather complex, I believe this is not the way to go. Please correct me
if I'm missing something.

A few years ago the answer to the OP's question would have been easy:
embed an OLE document of the right type in your form and you're done - MFC
was able to do the rest for you. With .NET this has become rather more
complicated. Originally, Microsoft were planning to include a control
called ActiveDocumentHost in .NET 2, but it was removed before .NET 2 went
RTM (http://www.shawnburke.com/default.aspx?document=128&userinterface=9).

Currently I think if you can't make do with the WebBrowser control (this
works in some instances to activate OLE docs), you'd have to write that
thing yourself... dig out your Inside OLE 2 and get going :-)


Oliver Sturm
--
Re: Excel grid control in Visual Studio 2005 app Oliver Sturm
2/2/2007 9:01:54 AM
Hello RobinS,

[quoted text, click to view]

Well, you wouldn't. Embedding Excel in your application allows you to edit
Excel files in a window that looks like it's an integral part of your
application, that's all. Of course an Excel sheet can, in turn, be
configured to retrieve its data from an external source, which may happen
to be the same data source (i.e. database) that your application also
uses. But even though Excel is visualizing its output inside one of your
application windows, it's still Excel running there and it does its own
job very much like it would if it were running on its own.

[quoted text, click to view]

But that's exactly the crux - for certain kinds of input, Windows Forms is
pretty bad. Theoretically you could create a control that would emulate
the table-oriented editing capabilities that Excel has, but that's
extremely complex and why bother if Excel is already there? OLE (note the
"E" - it stands for "embedding") was going to solve that dilemma, and I do
think it's a pity that the idea has been more or less abandoned in .NET.
It was probably never perfect, but it allowed for amazing functionality if
used correctly. Of course it's still possible today if you use the
existing APIs... only it's a lot of work and there are fewer developers
around than ever who know how to code that kind of thing themselves. OLE
automation may suffice to remote control an application, but it doesn't
give you the integrated look and feel and handling that object embedding
does.

[quoted text, click to view]

Yeah, I know it does :-) Sharepoint or not - Microsoft is envisioning
Office to be the platform for applications these days, not "just" the tool
that's being used by other applications. And granted, VSTO does amazing
things in many ways. But it doesn't give developers the freedom to
integrate in the way they want (focusing on their own applications as the
central platform instead of Office) and it also doesn't do much to improve
the often stupid and restricted data and event models that most Office
applications work with (but that's a completely different topic).

[quoted text, click to view]

Lbh qba'g fnl!


Oliver Sturm
--
Re: Excel grid control in Visual Studio 2005 app RobinS
2/2/2007 4:23:24 PM

[quoted text, click to view]

**You're right about that.

[quoted text, click to view]

I guess I haven't had any problems using Windows Forms for anything I've
done, except in VB6 the form couldn't be larger than the real estate, and
that was annoying, but sort of circumventable with Tab controls.

I've done a *lot* of reporting with OLE Automation, and am really hoping it
still works with Office 2007. I'm not sure how much of it is going to be
broken. My users in the corporate world *love* Excel, and being able to
dump their data and muck around with it makes them really, really happy.

I haven't ever used Excel for modifying data because I'm more
anal-retentive than that -- I *really* like to validate the heck out of
data before trying to store it. In VB6 I beat the Heirarchical Grid into
submission (phew, that was exhausting), and in VB2005 I'm using the
DataGridView, although I still prefer to have an edit screen for a specific
record because it gives me more control.

[quoted text, click to view]

I agree with that. I think they're driving Office because customers found
ways to do things with it that Microsoft never thought of and now they can
use that to market to other people. Who ever thought you'd need more than
65,000(ish) rows in a spreadsheet, or more than 255 columns? Frankly, I
think there's a point where it's too much data to absorb, but you know how
customers are -- they know best.

I was annoyed that VSTO was a separate product than VS2005. I would have
liked to play around with it, but no way was I going to buy two of them.
Why couldn't it be a plug-in for VS2005?

During the presentations at the launch, someone said the new one is an
add-on to VS2005. It apparently works with Office2003, too. And it actually
is an add-on, but if you have VS2005Pro, you don't get any "document-level
customizations or other functionality that is part of the full version of
VSTO 2005; VSTO 2005 SE adds only the application-level features..." So you
have to have Team Suite or original VSTO to get the whole shebang.

The only big problem I had with the demos at the Launch is I couldn't
easily tell what was Sharepoint, what was InfoPath, and what was Office. I
suppose that's part of the selling point, but as a developer, I need to
know what I'm going to need to know, if you know what I mean. And they
didn't show the code connecting the stuff, or tell how you're supposed to
do that. At one point, I did see some .net code (for 2 seconds while they
were flipping through screens) with a Sharepoint namespace, but that's all
I know about it.

The WPF stuff is pretty cool; I'm learning that now, and it *really* lets
you imbed stuff all over the place. Haven't tried imbedding office in it
yet, though.


[quoted text, click to view]

What in the world does *that* mean?? It doesn't even have enough characters
for me to figure it out by pattern recognition (I do cryptograms). Please
don't leave me in suspense!

Robin S.

Re: Excel grid control in Visual Studio 2005 app Oliver Sturm
2/3/2007 10:47:01 AM
Hello RobinS,

[quoted text, click to view]

Yeah, they always love to do that... I think it should still work in 2007,
although of course some details may have changed as usual.

[quoted text, click to view]

Certainly a healthy attitude.

[quoted text, click to view]

Why, everybody! That must have been one of the major points of criticism,
at least since Excel included an environment that allowed to automate
certain tasks... I remember those complaints from Excel 2.0 days, at least.

[quoted text, click to view]

You should get a subscription. People are complaining a lot about that as
well, but it's definitely value for money...

[quoted text, click to view]

Hehe... that's a different thing :-)

[quoted text, click to view]

I didn't make it very complicated... it's a (usenet) standard ROT13 "code".


Oliver Sturm
--
Re: Excel grid control in Visual Studio 2005 app RobinS
2/4/2007 11:31:42 AM
Comments below...

[quoted text, click to view]

<SNIP Excel OLE Automation and data validation>>

[quoted text, click to view]

Apparently so. I don't see how a person can assimilate that much
information.

[quoted text, click to view]

Aren't they like $2,000?

<snip WPF>

[quoted text, click to view]

Guess I haven't been going UseNet long enough, but with the help of
Wikipedia, I figured it out. I did UseNet years ago when I used to do
Vax/VMS System Support (I was a project lead on a huge software project,
but our system manager left. How did I end up with the System Support?
Let's just say, never go to the bathroom during a staff meeting) but only
started in again last year.

Unir n avpr qnl!

Robin S.

Re: Excel grid control in Visual Studio 2005 app Oliver Sturm
2/12/2007 4:40:04 PM
Hello RobinS,

[quoted text, click to view]

No, I agree. But the problem is that a macro/VBA program running in Excel
can make automated use of that space, which is a very common approach. And
in those cases the restriction seemed rather arbitrary (definitely once
there was 32 bit somewhere in Microsoft's Windows marketing blurb, and
don't forget that Excel programmers don't necessarily understand about
binary encodings and such things), and so can obviously lead to problems
in cases that are not that far removed from the imaginable :-)

[quoted text, click to view]

It totally depends on which one you get, but yes, they might be around
that price tag. And if you're quoting USD, be glad you're not in Europe,
where they're quite a lot more expensive. But then - do you know of any
craftsman or manufacturer who spends significantly less than that for the
tools and commodities of his trade during the course of a year? And of
course, where and how do you get hold of your copy of VS so that it's much
cheaper?

[quoted text, click to view]

Maybe that's not everybody's definition, but we're using UseNet right now,
aren't we?

[quoted text, click to view]

Thanks, you too.


Oliver Sturm
--
Re: Excel grid control in Visual Studio 2005 app RobinS
2/12/2007 5:47:12 PM

[quoted text, click to view]


That's a good point; I don't innately think of using Excel as a database,
but you're right, many use it as such.


[quoted text, click to view]


Well, I got my copies of Visual Studio Pro 2005 and SQLServer 2005 at the
Worldwide Launch event for those products in San Francisco in Nov/Dec 2005
for free. You're absolutely right, if I had to buy those two products, I
might consider buying an MSDN subscription. I just got a copy of Microsoft
Vista Ultimate and Office 2007 at the Vista launch a couple of weeks ago.
:-D So I should be set for a while. 6 months maybe. <G>


[quoted text, click to view]

Well, yes, but I've only been back on usenet since around October of last
year, and hadn't run across the ROT13.

Have fun.

Robin

AddThis Social Bookmark Button