cbMcWatersK.C.tq
New Member
Need to generate an html report from XML and corresponding XSL butI have to use memorystream instead of IO File write on server directories. For the most part I managed to create an xml \[code\]MemoryStream ms = new MemoryStream();XmlWriterSettings wSettings = new XmlWriterSettings();wSettings.Indent = true;using(XmlWriter writer = XmlWriter.Create(ms,wSettings)){ /** creating xml here **/ writer.Flush(); writer.Close();}return ms; // returning the memory stream to another function // to create html// This Function creates protected string ConvertToHtml(MemoryStream xmlOutput){ XPathDocument document = new XPathDocument(xmlOutput); XmlDocument xDoc = new XmlDocument(); xDoc.Load(xmlOutput); StringWriter writer = new StringWriter(); XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(reportDir + "MyXslFile.xsl"); transform.Transform(xDoc, null, writer); xmlOutput.Position = 1; StreamReader sr = new StreamReader(xmlOutput); return sr.RearToEnd();}\[/code\]Somewhere along the line I am messing up with creating the HTML Report and cant figure out how to send that file to client end. I dont have much experience working with memorystream. So, any help would be greatly appreciated. Thank you.