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