(Update: self-answered, below)
Using VS2013 Premium, asp.net. vb.net, website, win7
Using the OpenXML SDK and the OpenXML Productivity Tool
I have a dictionary of class objects which describe graphic shapes (rectangles, arrows, text boxes) by position and text content. I use the class objects to create shapes in a blank PowerPoint presentation. The shapes show up in the correct positions with the correct text. However, I can't figure out how to change some of the styling, starting with the textbox outline style "solid & dark" or "none".
Overall mechanics:
- started with a PowerPoint 2013 document with one slide with one shape
- used the Productivity Tool to reflect the PPTX to C#, converted that to VB.Net, put it in a class in my project (again, website)
- located the place in the code where the shape was added to the slide shape tree
- replaced that code with a function call to a class that imports the dictionary, translates the dictionary's class objects into openxml shapes, and adds the shapes to the shape tree.
That all works fine.
However, some of the shapes are graphic rectangles which need outlines, and others are text boxes that don't. Again, I can't figure out how to modify the outlines on the textboxes.
This is a test setup which illustrates the problem (although as an openxml newb, I could be missing some very large obvious piece).
Starting point: create a PPTX with a textbox without an outline; copy it; in the PPTX copy add an outline to the textbox, take a look in PowerPoint, and see the comparison below:
Compare the two documents in the OpenXML Productivity Tool, looking at the difference in the XML, and reflect the corresponding code:
Open the PPTX with the textbox without the outline in the Productivity Tool, and reflect the full code required to generate that entire PPTX. Put that code in a class in a new website project. Create a webform that will execute that code on page load.
Locate where the textbox is added to the shapetree, and where the shapeproperties are created for the shape. Add the differential code that is supposed to add the outline to the textbox, so that the outline is added to the shapeproperties:
Run it with the code active and inactive (using the If statement) and take a look at the resulting PPTX's:
PPTX with textbox without the outline:
PPTX with textbox with the outline (notice: no shape at all)
Then open and compare the new output PPTX's in the Productivity Tool:
("without outline" on the left, "with outline" on the right)
The comparative XML of the output documents looks the same as it did in the comparison of the starting input documents, however, the output PPT that should have the shape with outline shows nothing. Strangely, the XML shows that the shape is in that PPTX, but it does not show in the PowerPoint client.
Any help with understanding how to add the outline to some of the textboxes, arrows and rectangles and not others would be appreciated.