Merged document to Stream using DocumentBuilder

Home Forums Open-Xml-PowerTools Merged document to Stream using DocumentBuilder

This topic contains 0 replies, has 1 voice, and was last updated by  Qwerty 5 years, 9 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #7561

    Qwerty
    Participant

    I have below code to get Memory Stream of the merged document. But can i get MemoryStream directly from DocumentBuilder or Sources, instead f saving it and then reading it.

         List<Source> sources = new List<Source>();
    
                foreach (var b in blockSets)
                {
                    WmlDocument block = new WmlDocument(b.Title, StreamToMemoryStream(b.FileStream));
                    sources.Add(new Source(block, false));
                }
                
                DocumentBuilder.BuildDocument(sources, @"C:\Temp\MergedDoc.docx");
    
                MemoryStream result;
                using (Stream templateStream = File.OpenRead(@"C:\Temp\MergedDoc.docx"))
                {
                    result = StreamToMemoryStream(templateStream);
                }
                return 
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.