Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi developers,

how to export the excel template with columns using XML

Regards
Aravind G
Posted

1 solution

lblImportError.Text = "";
string strXML;
strXML = "\n";
strXML += "\n";
strXML += "<workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" hold=" /> strXML += " xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">\n";
strXML += "<excelworkbook xmlns="urn:schemas-microsoft-com:office:excel">\n";
strXML += "<activesheet>2\n";
strXML += "\n";
strXML += "<styles>";
strXML += "<style ss:id="Default" ss:name="Normal">\n";
//strXML += "<style ss:id="merge" ss:selection.merge="">";
strXML += "<alignment ss:vertical="Bottom" ss:horizontal="Center">\n";
strXML += "<borders>\n";
strXML += "\n";
//strXML += "<interior>\n";
strXML += "<numberformat>\n";
strXML += "<protection>\n";
strXML += "</style>\n";
strXML += "<style ss:id="Default1">";
strXML += "<interior ss:color="#63D954" ss:pattern="Solid">";
strXML += "</style>";
strXML += "</style></styles>\n";
strXML += "<worksheet ss:name="Acquired Type">\n";
strXML += "\n";
strXML += " <ss:column ss:width="120">";
strXML += "<ss:column ss:width="120">";
strXML += "<row>\n";
strXML += "<cell ss:mergeacross="1">Acquired Type Template";
strXML += "\n";
strXML += "<row>\n";
strXML += "<cell ss:styleid="Default1">Acquired Type Code\n";
strXML += "<cell ss:styleid="Default1">Acquired Type Name\n";
strXML += "\n";
strXML += "
\n";
strXML += "\n";
strXML += "
";
String ExcelXML = strXML.Replace("'", "\"");
Response.Clear();
Response.AppendHeader("Content-Type", "application/vnd.ms-excel");
Response.AppendHeader("Content-disposition", "attachment; filename=AcquiredType");
Response.Write(ExcelXML);
Response.Flush();
Response.End();
 
Share this answer
 
v2

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