Vicky Siddharth Ответов: 0

Как преобразовать строку, содержащую XML и XSLT, в excel на C#?


я экспортирую excel путем преобразования xml, xslt в xls. Ниже приведено мое кодирование :

ds.WriteXml(MyXmlPath);

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



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 . 




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);



Any suggestions ?

Suvendu Shekhar Giri

Не работает значит? Давать какие-то ошибки?

Vicky Siddharth

никакой ошибки не видно

0 Ответов