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\" &amp;&amp;\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.


In reply to Non-standard options to tags for CGI.pm by dragonchild

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.