troubleshooting Question

Tyring to Serialize/Deserialize Office Class Objects

Avatar of DarklingG
DarklingGFlag for United Kingdom of Great Britain and Northern Ireland asked on
C#Microsoft Office
7 Comments1 Solution564 ViewsLast Modified:
I'm currently working an Reporting System to produce large amounts of Powerpoint Presentations from set data sources. This is all fine.

 But, my users don't always want to use just the standard set of Powerpoint Slides, they want to have custom ones depending on the service they provide.

 What I need to do is easily serialize individual Slides into Binary or SOAP (currently using Binary) and store them in a database so I can retrieve them.

 The below is working fine for images and custom classes, etc., but won't work with the Office Objects.

 Can someone help as to why? And hopefully provide an answer?

public class GeneralObjectSerialization<T>
        BinaryFormatter newBin;
        MemoryStream newStream;
        public byte[] SerializeObjectAndReturnByteArray(T newObject)
            byte[] newByteArray;
            newBin = new BinaryFormatter();
            newStream = new MemoryStream();
            newBin.Serialize(newStream, newObject);
            newByteArray = newStream.GetBuffer();
            return newByteArray;
        public T Deserialize(byte[] arrayStream)
            T newObject;
            newBin = new BinaryFormatter();
            newStream = new MemoryStream();
            newStream.Seek(0, 0);
            newObject = (T)newBin.Deserialize(newStream);
            return newObject;

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros