Does Aspose.Slides provide access to PowerPoint shapes’ CustomerData property?
Hi Thomas,
From the PowerPoint Developer Reference for Office 2007 http://msdn.microsoft.com/en-us/library/bb251511(v=office.12).aspx
"Stores information about a customer (such as name, address, telephone number, and so on) or other information in XML form, as a collection of CustomXMLPart objects associated with a Microsoft Office PowerPoint object.
You can store customer data in CustomLayout, Master,Presentation, Shape, and Slide objects. You can associate one or more CustomXMLPart objects with the same object."
The CustomerData property is similar to the “Tag” property of many controls used in C# programming (except that, instead of an object reference, you can only add XML).
I currently use this property in my slide templates to specify data source and slide template key information, etc.
.
Does Aspose.Slides support access to the CustomerData property of PowerPoint objects?
Hi Thomas,
Thanks Mudassir but that thread refers to DocumentProperties which are available only at the presentation level. I am looking for access to CustomerData, which in PowerPoint automation is available on any shape.
In my case, I may have information stored in the CustomerData property of a chart object(s) and/or a table object(s).
My appologies for the long delay in responding, my initial evaluation of Aspose was unsuccessful but I am reevaluating based on some recent enhancements.
Thomas
Hi Thomas,
Thank you for the prompt reply.
I have attached a simple presentation containing a table and a chart. Both the table and chart have had their CustomerData property set by a PowerPoint add-in.
Each PowerPoint Shape (in this case a table shape and a chart shape) has a CustomerData property which may be set by programming. These property values are saved with the presentation and may be accessed with programming later. In our case, we mark the shapes with references to data sources which will then be used to populate the shapes (i.e. table data and chart data in the case of the attached presentation).
Here is a link for reference: http://code.msdn.microsoft.com/office/PowerPoint-2010-Use-Custom-794ffe88
Hi Thomas,
Thanks,
I think I can work around this limitation in the meantime.
Thomas
In latest Aspose.Slides API, you can now manage CustomXML by adding, removing or accessing them using simple API calls.
We have added a Property Aspose.Slides.ICustomData.CustomXmlParts which actually represents a collection of custom xml parts associated with the corresponding ICustomData instance. You can add CustomXML data using following sample code.
using(Presentation pres = new Presentation())
{
pres.Slides[0].CustomData.CustomXmlParts.Add(GetXmlStringSample("John Doe")); //add new custom xml to slide custom data
pres.Save(@"out.pptx", SaveFormat.Pptx);
}
private static string GetXmlStringSample(string name)
{
string xmlString =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<employees xmlns=\"http://schemas.test.com/sample\">" +
"<employee>" +
"<name>" + name + "</name>" +
"</employee>" +
"</employees>";
return xmlString;
}
The following sample can be used to remove the CustomXML from slides.
//Sample for clear all custom xml parts from presentation
using (Presentation pres = new Presentation("PresentationWithCustomXml.pptx"))
{
foreach (ICustomXmlPart item in pres.AllCustomXmlParts)
{
item.Remove();
}
pres.Save("out.pptx", SaveFormat.Pptx);
}