Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am exporting excel by transform xml,xslt into xls. Below is my coding :

C#
ds.WriteXml(MyXmlPath);

  XPathDocument xmlDoc = new XPathDocument(MyXmlPath);
  XslCompiledTransform XSLTransform = new XslCompiledTransform();
  XSLTransform.Load(AppBasePath + @"\Master\XSLT\" + strSelectedXSLT.ToString() + ".xslt");
  XSLTransform.Transform(MyXmlPath, MyExcelPath);



C#
From the above coding i am write xml into disk for the given path by using dataset. And read from the disk path in order to transform xls file.BECAUSE ITS TAKE HEAVY TIME TO WRITE EXCEL

**PROBLEM : Instead of writing & Reading the xml content , why should i write the xml content into string and convert .

What I have tried:

so i tried below coding . But its not working . 




C#
StringWriter sw = new StringWriter();
    ds.WriteXml(sw, XmlWriteMode.IgnoreSchema);
    string xmlcontent = sw.ToString();

XslCompiledTransform XSLTransform = new XslCompiledTransform();
 XSLTransform.Load(AppBasePath + @"\Master\XSLT\" + strSelectedXSLT.ToString() + ".xslt");
 XSLTransform.Transform(xmlcontent, MyExcelPath);



C#
Any suggestions ?
Posted
Updated 4-Jul-16 21:40pm
v2
Comments
Suvendu Shekhar Giri 5-Jul-16 3:45am    
Not working means? Giving any error?
Vicky Siddharth 5-Jul-16 4:13am    
no error is showing

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900