开发者

Powerpoint Add-In: Add a Button to PPT to SyntaxHighlight a Textbox

开发者 https://www.devze.com 2022-12-24 06:35 出处:网络
I am trying to write an Add-In to PowerPoint that does basically one thing: Give users a button somewhere to click, once they click on it the currently selected TextField should get syntax highlighted

I am trying to write an Add-In to PowerPoint that does basically one thing: Give users a button somewhere to click, once they click on it the currently selected TextField should get syntax highlighted.

The Syntax highlighting part is easy, I'm just having a real hard time finding some good information on how to successfully interact with PowerPoint from code. There are some MSDN articles highlighting how to add controls on document start or AddSlide, but no good information on how to extend the UI.

Has anyone had some experience in this field and could point me to some resource that may help?

Also, I am running PowerPoint 2007 while my customer may end 开发者_如何学Pythonup running PPT2003. How is the backwards compatibility of the Add-ins?

Update: I already use VSTO, the main problem is to find out on how to actually add buttons to PowerPoint. I already managed to add a shape or manipulate one.


Here's some help with the core ask - find the active shape and do something with its text. This VBA example that can be ported easily to VB.NET/C#.

Sub FindActiveShapeFormatting()
Dim Sel As Selection
Set Sel = ActiveWindow.Selection
With Sel
    If .Type = ppSelectionShapes Then
        Dim sr As ShapeRange
        Set sr = .ShapeRange
        */ With .TextRange you can now manipulate the text inside the shape
        sr.TextFrame.TextRange.Words(1).Font.Bold = msoCTrue
    End If
End With
End Sub

For interacting with Office from .NET, the best/easiest way is to use VSTO (Visual Studio Tools for Office). Check this out for more details: Beginning VSTO development

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号