How to access chart in PowerPoint via VSTO? - interop

I am trying to access charts in slides in PowerPoint 2007 via VSTO, and I am a bit confused. While the Interop provides a property Shape.HasChart which properly finds shapes that have/are charts, I can't figure out how to access the Chart object itself. I don't see a chart property on the Shape. Am I supposed to cast the Shape to a specific type?
Looking into the documentation, it seems that charts were not well-supported initially in Office 2007, but it's not clear to me whether there is a way to access the Chart and do things like change the title or the axis. Any pointers would be highly appreciated!

You need to access the OLEFormat.Object of the Shape.
Graph.Chart aChart = (Graph.Chart) pptSlide.Shapes[1].OLEFormat.Object;
aChart.Activate();
I can do this successfully with Office 2003.
I goggled a bit and apparently with 2007 SP2 there is a way to get a your shape object a .Chart property. I do not have 2007, so I can not test this.

Related

Shape property "decorative" not in VSTO?

I program PowerPoint add-ins both in VBA and in VSTO. In VBA I can use shape.Decorative to check, if a shape is decorative - and therefore does not need an alternative text. In VSTO however there is no such property.
I'm using Visual Studio 2022, the reference to PowerPoint is set to version 15.0.0.0.0 - but I can't see where I could change that. Am I using the wrong template?
I'm grateful for any tips how to get to that attribute. Thanks in advance, Sabina
The PowerPoint object model provides the Shape.Decorative property which sets or returns the decorative flag for the specified object. So, it doesn't matter whether it is a VSTO add-ins or VBA macro. The PowerPoint object model is common for all programming languages. In this situation you can:
Use a newer PIA to get access to the property (with intellisense suggestions).
Use the late-binding technology to invoke the property programmatically even when it is not available in PIAs. The Type.InvokeMember method invokes a specific member of the current Type.

Is there a way to know if a powerpoint shape is selected by the user?

I'm creating an addin on powerpoint using office-js and I don't know if there is a method to check if a shape selected by the user ?
I know that in vb.net it looks like this :
Dim shape = selection.ShapeRange.Item(1)
Unfortunately, there is no way to do this in Office.js at this time. It is a good idea. Please consider suggesting it at Microsoft 365 Developer Platform Ideas.

How do I change the colour of the results grid borders in Azure Data Studio?

There must be a way to do this, because switching between different themes changes the colour of the borders in the results grid. But I want to customise it for one of themes I'm currently using. (Which I know is possible based on this question.)
The only reference I can find in Microsoft's documentation is this page for Visual Studio Code:
https://code.visualstudio.com/api/references/theme-color
...but seeing as the results grid is an Azure Data Studio feature, there's nothing in there talking about it.
Anyone have any thoughts??

How to Insert svg images in PowerPoint?

I was able to add svg images into PPT so far, now suddenly unable to add them. when I add, it comes as internet explore icon with name of the image. anybody have any ideas why it changed suddenly? Is there any way without opening it in Illustrator and bring to ppt?
In the web version of PowerPoint you can drag and drop an SVG from your computer into a slide and it will be inserted as an image.
I've used the following workaround: import the SVG file into a LibreOffice Impress (it might look a bit ugly in LibreOffice, but don't worry), and then save this as a PowerPoint presentation.
When you open this file in PowerPoint, you'll find that your vector graphic will be correctly displayed.
Note that the feature to import vector graphics is included in Microsoft's subscription-based Office 365.

MS Access 2007 Load Image to Ribbon

I'm trying to get to grips with customising a Ribbon Bar for a converted A2003 app. I'm trying to work out how to use my own custom images on button controls in the ribbon. Can anyone point me to an example for Access 2007 that can do this pls?
Please check this MSDN article (Adding Custom Dynamic Menus to the Office Fluent User Interface) and see if it helps you. Furthermore I would point you to the specifying image resource MSDN article, because you need different sized images for different sized buttons - read the bottom of my post to make it easier on you.
I believe there was also custom images within the official MS example on ribbon extensibility with Access 2007 - I hope this example is sufficient, it helped me a great lot.
My personal favorite is just using a graphical UI editor, such as the "Custom UI Editor Tool". With it you just click a button to insert an image and it works (as explained in this tutorial). Even better as the Custom UI Editor is the IDBE Ribbon Creatror - my personal tool of choice. A shareware version is available from the website.
I have a working example class object you can use that makes this a good deal less code.
http://www.members.shaw.ca/albertKallal/Ribbon/ribbon.htm
The above lets you use a very much like previous style code approach. So, to set a picture for a ribbon, you can go:
meRib("Button1").Picture = "HappyFace.png"
The same download has a working form in which some images in the ribbon change from choices made on the form.

Resources