Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
I am trying to Transform the XSLT,XSL file into .xsl . So i tried below coding



C#
Below Coding is working fine. But when i open the created Excel sheet it is opening in XML SPREAD SHEET 2003. But it should be open in Excel 97-2003 Workbook. How can i achieve ?


What I have tried:

string MyXmlPath = ReportPath + @"\XML\chennai.xml";
dataset.WriteXml(MyXmlPath);
string MyExcelPath = ReportPath + @"\Report\chennai.xls";

XPathDocument xmlDoc = new XPathDocument(MyXmlPath);
XslCompiledTransform XSLTransform = new XslCompiledTransform();
XSLTransform.Load(AppBasePath + @"\Master\XSLT\chennai.xslt");
XSLTransform.Transform(MyXmlPath, MyExcelPath);
Posted
Updated 9-Aug-16 1:17am
v2
Comments
Kornfeld Eliyahu Peter 9-Aug-16 4:02am    
Not clear...
XLS is a binary! format for older Excel files, so how do you expect to create one using XML transformation?
Vicky Siddharth 9-Aug-16 4:11am    
Ok. Have any other methods to create .xls by combine xslt and xml ?
Kornfeld Eliyahu Peter 9-Aug-16 4:14am    
No. There is no way to create any binary (including old Excel) file using XML and transformation at all...
Actually (as the format is proprietary) the only way is using Microsoft's tools...
Vicky Siddharth 9-Aug-16 4:17am    
What do you mean by Microsoft Tool's? refer any dll's or what?
Kornfeld Eliyahu Peter 9-Aug-16 4:21am    
Exactly. Referring the Office Interop DLLs and write some ugly code...
However, consider that Microsoft itself does not support old Excel, so you probably can focus on the new, XML based, format...

you can't open an .xlsx (excel xml file) in excel 2003 because the .xlsx format was introduced with Excel 2007.
You need to install a MS extension to excel that allow excel 2003 to read .xlsx (Excel 2007) format.
 
Share this answer
 

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