Hi,
I could not view the output (Excel file) when i trying
to export the xml content to a excel sheet from an user
control. I use the following code in the user control:
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(sb.ToString());
Stream streamOut = new MemoryStream();
XslCompiledTransform transformFile = new
XslCompiledTransform();
string strTransformFileName = strXSLFile;
transformFile.Load(Server.MapPath(strTransformFileName));
transformFile.Transform(xdoc, null, streamOut);
streamOut.Flush();
streamOut.Position = 0;
System.IO.StreamReader sr = new System.IO.StreamReader
(streamOut);
string xmlOut = sr.ReadToEnd();
Response.AppendHeader("Content-disposition", "inline;
filename=" + strXLSFile);
Response.ContentType = "text/excel";
Response.Write(xmlOut); //xmlOut content is fine here when i
view through quick watch
Response.Flush();
sr.Close();
streamOut.Close();
After saving the output file and when i try to view the page
i get the following error
"Problem during load:Unknown, File cannot be loaded because
of errors.Error are listed in......<file name>" and when i
open the error list page i get the following error
XML PARSE ERROR: Non-unique or duplicate attribute
Error occurs at or below this element stack:
<html>
<body>
<form>
<div>
<div>
<div>
<div>
<div>
<div>
<table>
<tr>
<td>
Where as when i use the same content in aspx page i could
able to view the output file.
Can any one help me how to solve this..