Thanks John - tis is a really useful example - particularly as I can never find the right CLSID's when I need them.
You can make this example a little more general by embedding a 2002 object inside a 2003 object - which means you can send it to a client browser without needing them to pick the version.
The browser will then cascade to the one it can handle.
(Although you have to send the data twice.)
64 # Insert the ExcelXML code into a Html doc using a simple temp
+late.
65 # Use HTML::Template or the Template::Toolkit for real applica
+tions.
66 #
67 my $clsid2002 = "CLSID:0002E541-0000-0000-C000-000000000046" ;
68 my $clsid2003 = "CLSID:0002E559-0000-0000-C000-000000000046" ;
69
70 my $template = do {local $/; <DATA>};
71 $template =~ s/__EXCEL_XML_DATA__/$xml_str/g;
72 $template =~ s/__SPREADSHEET_CLSID2002__/$clsid2002/;
73 $template =~ s/__SPREADSHEET_CLSID2003__/$clsid2003/;
74
75 print $template;
76
77
78
79 __END__
80 Content-type: text/html
81
82
83 <html xmlns:o="urn:schemas-microsoft-com:office:office"
84 xmlns:x="urn:schemas-microsoft-com:office:excel"
85 xmlns="http://www.w3.org/TR/REC-html40">
86
87 <body>
88 <div id="Spreadsheet" align=center x:publishsource="Ex
+cel">
89 <object id="Spreadsheet" classid="__SPREADSHEET_CL
+SID2003__">
90 <param name=DisplayTitleBar value=false>
91 <param name=Autofit value=true>
92 <param name=DataType value=XMLData>
93 <param name=XMLData value="__EXCEL_XML_DATA__
+">
94 <object id="Spreadsheet" classid="__SPREADSHEET_CL
+SID2002__">
95 <param name=DisplayTitleBar value=false>
96 <param name=Autofit value=true>
97 <param name=DataType value=XMLData>
98 <param name=XMLData value="__EXCEL_XML_DATA__
+">
99 <p>
100 To use this Web page interactively, you mu
+st have Microsoft Internet Explorer 5.01 Service Pack 2 (SP2) or late
+r and the Correct V ersion of Microsoft Office Web Components.
101 </p>
102 <p>
103 See the <a href="http://r.office.microsoft
+.com/r/rlidmsowcpub?clid=1033&p1=Excel">
104 Microsoft Office Web site</a> for more inf
+ormation.
105 </p>
106 </object>
107 </object>
108 </div>
109 </body>
110 </html>