CustomerData XML in Aspsoe.Slides (C# .NET)

Does Aspose.Slides provide access to PowerPoint shapes’ CustomerData property?

Hi Thomas,


Thanks for considering Aspose.Slides.

I have tried to understand the issue shared by you. Can you please share the the further information with us regarding what you are actually looking in Aspose.Slides.

Many Thanks,

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,


Please visit this thread link for setting custom properties for the presentations. Please share, if I may help you further in this regard. Currently these properties are supported in Aspose.Slides.

Many Thanks,

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,


I have tried to understand the requirement shared by you but unfortunately have not been able to understand them clearly. Kindly, share some more details about your requirements and if possible share in the form of presentation.

Many Thanks,

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 for sharing the additional information.

I regret to share that support for setting CustomerData property for shape is unavailable in Aspose.Slides for .NET presently. I have created an issue with ID SLIDESNET-33571 as new feature request in our issue tracking system for this. Our development team will investigate the possibility of implementing and providing the requested support. I will share the further information with you as soon as it will be shared by our development team.

We are sorry for your inconvenience,

Thanks,

I think I can work around this limitation in the meantime.

Thomas

@OmNomServal,

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);
}