PowerPoint and C++ .NET

V

Vinoj

Hi,

I'm using VS2008 and added references to Office.dll (v12) and
Microsoft.Office.Interop.PowerPoint (v12). The problem is that the TextRange
object doesn't have a Text property - although the documentation indicates
that it should. Any ideas? I can create a blank table, but I can't input any
text into the cells. Thanks.

Vinoj
 
S

Steve Rindsberg

Hi,

I'm using VS2008 and added references to Office.dll (v12) and
Microsoft.Office.Interop.PowerPoint (v12). The problem is that the TextRange
object doesn't have a Text property - although the documentation indicates
that it should. Any ideas? I can create a blank table, but I can't input any
text into the cells. Thanks.

This is how you'd do it in VBA:

Dim oSh As Shape

With ActivePresentation.Slides(1).Shapes
Set oSh = .AddTable(5, 3)
With oSh.Table.Cell(1, 1).Shape.TextFrame.TextRange
.Text = "Sure it has a text property!"
End With
End With


VBA --> Anything.NET is an exercise for the reader.
 
V

Vinoj

I think I'm doing the equivalent in C++:

PowerPoint::Shape ^tbl = PpSlideTbl->Shapes->AddTable(4,3, 10, 10 200,200);
tbl->Table->Cell(1,1)->Shape->TextFrame->TextRange->Text = "hello";

But when I compile this, I get errors - 'Text': ambiguous symbol, 'Text':
illegal use of namespace identifier in expression.

And there is no Text member in the Intellisense either. Do I need to
upgrade something? Thanks.

Vinoj
 
S

Steve Rindsberg

I think I'm doing the equivalent in C++:

I don't know C++ but it certainly *looks* reasonable from here.

I'm afraid I can't give you any reason why it wouldn't work though.
 
V

Vinoj

Thanks guys. How would you do that? I would think (but look where that has
got me so far...) that since I'm using the "->" operator it would associate
the Text with the right t ype.

Vinoj
 
V

Vinoj

The plot thickens... I wrote a program in C# to see if the Text member
existed (Shape.TextFrame.TextRange.Text) and it does. Why would it exist in
C#, but not C++?
 
S

Steve Rindsberg

The plot thickens... I wrote a program in C# to see if the Text member
existed (Shape.TextFrame.TextRange.Text) and it does. Why would it exist in
C#, but not C++?

Buggy type library perhaps?

Under VB/VBA you could probably do something like:

Dim oRng as TextRange
Set oRng = Shape.TextFrame.TextRange
oRng.Text = "Something"
 

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