Import graphics in Excel

R

RcCluster

Hi Friends,

This may be easy but I can't find a way and also I'm still not familiar with
late binding.

I solved this bevor in VBA. But now I have to do it in .NET.

Here is the old VBA-code:

' get picture number
Artikel = ActiveCell

'complete with path
bild = "f:\datenbilder\bilder\schuhe\" + Right$(Str$(Artikel), 6) + ".pcx"

'and simply add it
ActiveSheet.Pictures.Insert(bild).Select


How can I do this in my add-in?

Please!

Thanks
Alex
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UmNDbHVzdGVy?=,
This may be easy but I can't find a way and also I'm still not familiar with
late binding.
What does late binding have to do with anything?
I solved this bevor in VBA. But now I have to do it in .NET.
Which .NET language? Where, more exactly, are you getting stuck?
Here is the old VBA-code:

' get picture number
Artikel = ActiveCell

'complete with path
bild = "f:\datenbilder\bilder\schuhe\" + Right$(Str$(Artikel), 6) + ".pcx"

'and simply add it
ActiveSheet.Pictures.Insert(bild).Select


How can I do this in my add-in?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
R

RcCluster

Hi Cindy,

Thank you for your reply. I will try to do it more exactly:

I'm using VS .Net 2003 and trying to make a add-in for Excel which is able
do import a graphic. In VBA I had used the ActiveSheet.Pictures collection
(see below).

Now I trying to do this in C#. Here are the interesting fragments:

// import the Excel Object Model
using Excel = Microsoft.Office.Interop.Excel;
....
// get the application
xl = (Excel.Application)application;
....
// Get the actice WorkSheet
Excel.WordSheet sh = xl.ActiceCell.WorkSheet;
// Get the Pictures collection for add a picture
Excel.Pictures pics = sh.Pictures; <---- don't work!!!!
pics.Add("C:\test\test.jpg");

Do you have an idea to solve this? Also I can't find a good documentation
about the office object models. Despite I have VS.Net 2003 Professional and
VSTO.

Thank you
Alex
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UmNDbHVzdGVy?=,
I'm using VS .Net 2003 and trying to make a add-in for Excel which is able
do import a graphic. In VBA I had used the ActiveSheet.Pictures collection
(see below).
Are you certain you used a Pictures collection? I don't find anything like
that in the Excel object model. To the best of my knowledge, all Office
applications use the Shapes collection (because the Drawing functionality is
actually an "Addin" class they all share).
Also I can't find a good documentation
about the office object models. Despite I have VS.Net 2003 Professional and
VSTO.
The only documentation is what you find in the Help files for the Object
models, and any documentation on msdn, or on internet sites. The Help files
are available through the applications' VB IDE, or you can download them from
MSDN. But if you have VSTO you probably have them already?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
R

RcCluster

Cindy!

You deserve kisses and hugs :)

Thank you!

Now I'm stucked in another problem (find the right scaling for the picture)
but hopefully this problem is not NP-hard :)

Ja, there is not much documentation. Thus I have to rely on Whitechappel.
But at the end of this year there will be published a german book about
office-programming from Peter Monadjemi. Maybe this will help me more/better.

Alex
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UmNDbHVzdGVy?=,
But at the end of this year there will be published a german book about
office-programming from Peter Monadjemi.
Or maybe not :) I was supposed to work on this with him, but so far nothing
has happened...

OTOH, four MVPs just got project approval from MS Press, Germany, for a Word
Entwicklerhandbuch which should come out at the end of the year :) Can't
promise that everything you'd want will be in there, but right now we're at
the point where we can consider suggestions.
Now I'm stucked in another problem (find the right scaling for the picture)
but hopefully this problem is not NP-hard :)
As I mentioned, Shapes is Office-wide, so perhaps I can help. No promises :)
Shapes are really strange things. But it doesn't hurt for you to ask.

Also, please note that the really best place to get help with Excel questions
would be the Excel.programming group. You'll find people there such as Stephen
Bullen, Rob Bovey, John Walkenbach - the really top-notch players.

Cindy Meister
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top