Hi
Thanks for the idea. I have done it and it works!
I serialize the document as an XmlDocument to the client. The client then deserializes the XmlDocument to Aspose document. Great stuff.
This is the code to serialize the document to XmlDocument.
///
/// Function to convert a Document to XmlDocument
///
/// Document that is to be serialized to XML
/// XmlDocument
public static XmlDocument SerializeToXmlDocument(Document doc)
{
//Save the Aspose.Doc into a memory stream.
MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.WordML);//SaveFormat.WordML);
//Seek to the beginning so it can be read by XmlDocument.
stream.Seek(0, SeekOrigin.Begin);
//Load the document into an XmlDocument
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(stream);
stream.Close();
return xmlDoc;
}
This is the code to DeSerialize the xml document created by the document
public static Document DeserializeXmlDocument(XmlDocument xmldoc)
{
// Save the XML to a memory stream.
MemoryStream memStream = new MemoryStream();
ASCIIEncoding AE = new ASCIIEncoding();
string xmlStr = xmldoc.DocumentElement.OuterXml;
// // Write the xml to memory
memStream.Write(AE.GetBytes(xmlStr), 0, xmlStr.Length);
//Rewind stream just to make sure its at beginning.
memStream.Seek(0, SeekOrigin.Begin);
//Load the stream into a document.
Document doc = new Document(memStream);
//Close the stream
memStream.Close();
return doc;
}
George France
MCAD