I'm working on creating on-the-fly Excel spreadsheets that are already converted to HTML. Well, I've already got that done. However, I didn't use CGI;, so I'm trying to get with the program. Except, I'm not that good with CGI (or HTML post-2.0, for that matter), so I'm a little confused.
How would I convert the following code snippet to use CGI? (Assume that all relevant variables have been set to the appropriate values. I'm not looking for advice save for how to remove the embedded HTML.)
print $file "<html xmlns:o=\"urn:schemas-microsoft-com:office:offi
+ce\"\n";
print $file " xmlns:x=\"urn:schemas-microsoft-com:office:exce
+l\"\n";
print $file " xmlns=\"http://www.w3.org/TR/REC-html40\">\n\n"
+;
print $file "<head>\n\n";
# In here are a few <META> and <LINK> tags I've already converted ...
print $file "<style>\n";
print $file "<!--table\n";
print $file "{\n";
print $file " mso-displayed-decimal-separator:\"\.\";\n";
print $file " mso-displayed-thousand-separator:\"\,\";\n";
print $file "}\n";
print $file "\@page\n";
print $file "{\n";
print $file " margin:1.0in .75in 1.0in .75in;\n";
print $file " mso-header-margin:.5in;\n";
print $file " mso-footer-margin:.5in;\n";
print $file "}\n";
print $file "-->\n";
print $file "</style>\n";
print $file "<![if !supportTabStrip]><script language=\"JavaScript
+\">\n";
print $file "<!--\n";
print $file " function fnUpdateTabs() {\n";
print $file " if (parent.window.g_iIEVer >= 4) {\n";
print $file " if (parent.document.readyState == \"compl
+ete\" &&\n
";
print $file " parent.frames['frTabs'].document.read
+yState ==
\"complete\")\n";
print $file " parent.fnSetActiveSheet($sheet_num);\
+n";
print $file " else\n";
print $file " window.setTimeout(\"fnUpdateTabs();\"
+, 150);\n"
;
print $file " }\n";
print $file " }\n";
print $file "\n";
print $file " if (window.name != \"frSheet\")\n";
print $file " window.location.replace(\"../$source_doc\");\
+n";
print $file " else\n";
print $file " fnUpdateTabs();\n";
print $file "//-->\n";
print $file "</script>\n";
print $file "<![endif]>\n";
print $file "<!--[if gte mso 9]>\n";
print $file "<xml>\n";
print $file " <x:WorksheetOptions>\n";
print $file " <x:FreezePanes/>\n";
print $file " <x:FrozenNoSplit/>\n";
print $file " <x:SplitHorizontal>1</x:SplitHorizontal>\n";
print $file " <x:TopRowBottomPane>1</x:TopRowBottomPane>\n";
print $file " <x:ActivePane>2</x:ActivePane>\n";
print $file " <x:Selected/>\n" if $selected;
print $file " <x:DoNotDisplayGridlines/>\n";
print $file " <x:ProtectContents>True</x:ProtectContents>\n";
print $file " <x:ProtectObjects>True</x:ProtectObjects>\n";
print $file " <x:ProtectScenarios>True</x:ProtectScenarios>\n";
print $file " </x:WorksheetOptions>\n";
print $file "</xml>\n";
print $file "<![endif]-->\n";
print $file "</head>\n\n";
------ We are the carpenters and bricklayers of the Information Age. Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|