Load document from byte array

hi there,

i am loading a document template from a database, like explained in the article
How to load and save a document to database

now my problem:
if the template contains an Excel worksheet object, this object is converted to an image.
what can i do?

Hi Birgit,

Thanks for your inquiry. I think, you can use the following code to extract those embedded excel objects and save them to separate files on disk:

// Get collection of shapes
NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
int i = 0;
// Loop through all shapes
foreach(Shape shape in shapes)
{
    if (shape.OleFormat != null)
    {
        if (!shape.OleFormat.IsLink)
        {
            // Extract OLE Word object
            if (shape.OleFormat.ProgId == "Word.Document.12")
            {
                MemoryStream stream = new MemoryStream();
                shape.OleFormat.Save(stream);
                Document newDoc = new Document(stream);
                newDoc.Save(string.Format(@"C:\test\outEmbeded_{0}.html", i));
                i++;
            }
            // Extract OLE Excel object
            if (shape.OleFormat.ProgId == "Excel.Sheet.12")
            {
                // Here you can use Aspose.Cells component**
                // to be able to read and save MS Excel files to disk**
            }
        }
    }
}

I hope, this helps.

Best Regards,

thx a lot, but that doesn’t help at all, because i don’t want to extract the Excel object. all i want to do is using the document template to create a serial letter, which means that, if the template contains an Excel object, it should be an Excel object after processing the merge fields.
i broke the problem down to creating a document object from your words library, so the merge field filling should be the next step, but the problem is generated by the document object.

Hi Birgit,

Thanks for your inquiry and sorry for the delayed response. Aspose.Words preserves the Excel OLE objects that is embedded inside Word documents during open/save. We have just released Aspose.Words v11.9.0; could you please upgrade to the latest version of Aspose.Words and let us know how it goes on your side? You can download it from the following link:
https://releases.aspose.com/words/net

Best Regards,