469,296 Members | 2,144 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,296 developers. It's quick & easy.

Dynamically Generate PowerPoint in C++ .NET


Is there a way to dynamically generate a powerpoint file from scratch in C++ .NET? I'm running VS2008 and from what I've found supposedly Visual Tools for Office is already installed. The problem is I can't access any namespaces (e.g. PowerPoint, Microsoft.Office.Core, etc). Any ideas? Or do I have to create a generic powerpoint file and then populate it programmatically? Thanks.
Mar 27 '09 #1
3 4231
280 Expert 100+
there is vb.net code here http://www.codeproject.com/KB/vb/Pow..._in_VBNET.aspx which you could possibly adapt. Key thing here is the imports used. Given this you can do the equivalent in C++.net
Mar 28 '09 #2
Thanks. I'll give it a try.
Mar 30 '09 #3
I'm on the right track I think, but does anyone know how to set the text in a cell in a table on a powerpoint slide? This is what I'm doing...

PpApp = gcnew PowerPoint::Application();
PpApp->Visible = MsoTriState::msoTrue;
PowerPoint::Presentations ^PpPresSet = PpApp->Presentations;
String ^val = WorkingDirectory + "\\wiips.pot";
PowerPoint::Presentation ^PpPres = PpPresSet->Open(val,
soTriState::msoFalse, MsoTriState::msoTrue, MsoTriState::msoTrue);
PowerPoint::Slides^ PpSlides = PpPres->Slides;
PowerPoint::Slide ^PpSlideImg = PpSlides->Add(1, PowerPoint::PpSlideLayout::ppLayoutBlank);
PowerPoint::Slide ^PpSlideTbl = PpSlides->Add(2, PowerPoint::PpSlideLayout::ppLayoutBlank);

//get picture parameters
int width = 0;
int height = 0;
GetPptPicSize(filename, &width, &height);
PpSlideImg->Shapes->AddPicture(filename, MsoTriState::msoFalse,
(float)(MAX_WIDTH + 20 - width)/2, (float)(MAX_HEIGHT + 20 - height)/2,
(float)width, (float)height);

PowerPoint::Shape ^tbl =
CsvDs->Tables[0]->Columns->Count, 10, 10, MAX_WIDTH, MAX_HEIGHT);

tbl->Table->Cell(1,1)->Shape->TextFrame->TextRange->Text = "hello";

The problem is that for some reason C++ .NET in VS2008 doesn't have a member
Text in the TextRange property. All the documentation says it does. What
gives? Thanks.

Mar 31 '09 #4

Post your reply

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

Similar topics

7 posts views Thread by Rathtap | last post: by
2 posts views Thread by Jeff Johnson | last post: by
reply views Thread by jijo kuruvila | last post: by
1 post views Thread by Scott Zabolotzky | last post: by
4 posts views Thread by Mike Logan | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.