473,397 Members | 1,972 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,397 software developers and data experts.

Open powerpoint presentation from a Windows C# form

I have the same exact question as Josep in this thread: http://bytes.com/forum/thread272940.html except when I try and compile the program I get a few errors (6 of them to be exact)

They are as follows.

C:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\Form1.cs(129,45): error CS0234: The type or namespace name 'Core' does not exist in the namespace 'Microsoft.Office' (are you missing an assembly reference?)
C:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\Form1.cs(134,13): error CS0103: The name 'objPres' does not exist in the current context
C:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\Form1.cs(134,48): error CS0103: The name 'MsoTriState' does not exist in the current context
C:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\Form1.cs(135,13): error CS0103: The name 'MsoTriState' does not exist in the current context
C:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\Form1.cs(135,34): error CS0103: The name 'MsoTriState' does not exist in the current context

Now, please take in mind that I am still learning C# and know a little bit about C++, so I will be able to get some of it but I might need a more dumbed down version.

Also, since this code is not exactly something I want to post right up on the board, if you think you can help me please let me know. :)

-Tom

EDIT: Here's the snippet of code that I copy pasted from the old thread

Oct 3 '08 #1
13 10372
joedeene
583 512MB
perhaps google.com help you greatly in your situation..."type in how to open a powerpoint in c#"

joedeene
Oct 3 '08 #2
perhaps google.com help you greatly in your situation..."type in how to open a powerpoint in c#"

joedeene
Nope, it doesn't.. Leads me back to here, and other sites that link to that old thread.

I need help with the errors that it's giving me. :(
Oct 3 '08 #3
joedeene
583 512MB
Nope, it doesn't.. Leads me back to here, and other sites that link to that old thread.

I need help with the errors that it's giving me. :(
try exploring areas of this MSDN site. or looking up tutorials on the Powerpoint.Application class?

joedeene
Oct 3 '08 #4
Well, first off, I'm not using Visual Basic, second of all, I don't even think you looked over these errors.. I may be a beginner, but I know this is a step in the wrong direction... I appreciate that you're trying to help, but do you even know how to do this..?


EDIT: I do not have a Microsoft.Office.Core reference.. Bleh, let me see if I can't fix that.
Oct 3 '08 #5
Curtis Rutland
3,256 Expert 2GB
I think you may need to add a reference to Microsoft.Office.Core, but I can't be sure, since I don't have Visual Studio in front of me right now.

See if you can do that and let me know.

Edit, seems like you beat me to the punch. Let us know how it goes.

Now, let's try to keep it polite, fellas. joedeene is trying to help, and if the help isn't working, just say it didn't work and ask for more help. OK?

Mod.
Oct 3 '08 #6
I think you may need to add a reference to Microsoft.Office.Core, but I can't be sure, since I don't have Visual Studio in front of me right now.

See if you can do that and let me know.

Edit, seems like you beat me to the punch. Let us know how it goes.

Now, let's try to keep it polite, fellas. joedeene is trying to help, and if the help isn't working, just say it didn't work and ask for more help. OK?

Mod.
Sorry, I've been working on this for a week and since I've hit this brick wall my boss has been heckling me.. Well, I'm sure how you all know how it goes. :/

I apologize.

And yes, I got the office core file in there now but instead of giving me the whole core not being there I get:
C:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\Form1.cs(130,28): error CS0029: Cannot implicitly convert type 'Microsoft.Office.Core.MsoTriState [c:\Documents and Settings\Tom\Desktop\Work\High School US\HighSchool US\HighSchool US\obj\Debug\Interop.Microsoft.Office.Core.dll]' to 'Microsoft.Office.Core.MsoTriState []'

Man.. that's a doozy.

I'm reading up on error CS0029 right now, but here is the offending line of code:
oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;


EDIT:
I'm reading up here: http://msdn.microsoft.com/en-us/libr...x5(VS.71).aspx but... their examples are way more simple than the ones that I've got going on here, and well.. I'm lost again. xD
Oct 3 '08 #7
Curtis Rutland
3,256 Expert 2GB
That's really wierd...it's expecting an explicit cast, but it seems to be the same datatype. Try explicitly casting it anyway.

Put the datatype in parenthesis behind it, or right after it say "as <datatype>" replacing <datatype> with whatever it was.

Interop is always a pain, IMHO.
Oct 3 '08 #8
I've started to figure that out. :/

Now I've got "The as operator must be used with a reference type or a nullable type (Microsoft.Office.Core.MsoTriState is a non nullable value type)"

Bleh.

This is what I've got in the code right now on that line that's causing the error:
oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue as Microsoft.Office.Core.MsoTriState;

Also: I tried oPPT.Visible = Microsoft.Office.Core.MsoTriState.msoTrue as <Microsoft.Office.Core.MsoTriState>;
just for the heck of it, and that didn't work either.
):

EDIT:

error CS0012: The type 'Microsoft.Office.Core.MsoTriState' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.


the oPPT.Visible on that same line gives me this error code as well, do you think that the fact that PowerPoint.ApplicationClass() does not have a Visible class?
Oct 4 '08 #9
Curtis Rutland
3,256 Expert 2GB
OK, I read something weird on the internet, but it's worth a shot. Try removing the reference to Powerpoint, and then adding it again. Then see if it builds.

Also try the explicit cast like this:
Expand|Select|Wrap|Line Numbers
  1. oPPT.Visible = (Microsoft.Office.Core.MsoTriState)Microsoft.Office.Core.MsoTriState.msoTrue;
There shouldn't be space in there, so just ignore it.
Oct 4 '08 #10
Hm, at first I thought it was going to work and then those 6 errors popped up again... Is there another way to go about doing this without having to use interop? It seems like it's too much of a hassle. :/
Oct 5 '08 #11
Curtis Rutland
3,256 Expert 2GB
Well, there's always
Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.Process.Start("pathToFileToStart");
That will just open a powerpoint application, if you point it to the .ppt file.
Oct 5 '08 #12
joedeene
583 512MB
ya, i was thinking of that too, but it opens up MS Office Powerpoint and then you have to click view slide show or something to watch it....unless there's a command you can send to it, to start the slideshow as soon as it opens ?

joedeene
Oct 5 '08 #13
Well, there's always
Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.Process.Start("pathToFileToStart");
That will just open a powerpoint application, if you point it to the .ppt file.
It's not as flashy, but I guess that will have to do as seeing as the interop doesn't really want to work in the program.
Oct 6 '08 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Levi | last post by:
How can I use php and mysql to create a downloadable .ppt file from the php-made output?
2
by: WillRead | last post by:
I have a VB.Net application and a PowerPoint presentation explaining how each form in the application works, etc.. I would like to select and display the slide appropriate for each form by pressing...
4
by: Joseph | last post by:
I am trying to open a 3 powerpoint presentation simultaneously afte each other without interruption, the operator of the application doe not need to notice anything or interfere in the operation of...
0
by: Alexander Czernay | last post by:
I created a VB.NET-PowerPoint-AddIn as described in the VisualStudio 2003 documentation. That works very well. The AddIn adds a new toolbar to PowerPoint if the active document is based on a...
9
by: Sensei76 | last post by:
Hello, I have the following problem and I do not know how to accomplish this. I have an (existing) powerpoint presentation that should be displayed not within its own window, but within a control...
0
by: PaulJMiddleton | last post by:
I'm in the middle of writing an application to display a scrolling marquee and a PowerPoint presentaion on multiple monitors. Powerpoint is unable to display more than one presentaion on one PC so...
6
by: BWPanda | last post by:
Hi everyone, I'm wanting to use VB.NET to display a powerpoint presentation, much the same way as the presenter that comes with PowerPoint (when used on multiple monitors). Basically, I want to...
3
by: WPeterson | last post by:
Converting PowerPoint to Flash would absolutely be a good choice to distribute your bulky PowerPoint presentations. You can do the whole PowerPoint to Flash conversion manually or with...
0
by: dotnets8n | last post by:
Good day! I have such problem. I must play the PowerPoint presentation in my application. Several ActiveX components (f.e. EDraw Office Viewer) can do that but if the MS Office is not installed,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.