Tyring to Serialize/Deserialize Office Class Objects
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(); newStream.Close(); return newByteArray; } public T Deserialize(byte[] arrayStream) { T newObject; newBin = new BinaryFormatter(); newStream = new MemoryStream(); newStream.Write(arrayStream,0,arrayStream.Length); newStream.Seek(0, 0); newObject = (T)newBin.Deserialize(newStream); return newObject; } }
Andrew