#usage "<b>Export an HTML partlist</b>\n"
       "<p>"
       "Generates an HTML file of a board's partlist for publishing on an intranet."
       "<p>"
       "<author>Author: Sean D. Alcorn (SYD) <sdalcorn@avion.com.au><br>Extended by support@cadsoft.de</author>"

// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

if (board) board(B) {
   string fileName = dlgFileSave("Save File", filesetext(B.name, ".htm"), "*.htm");
   if (fileName == "") exit(0);
   output(fileName) {
     printf("<html>\n\n");
     printf("<head>\n");
     printf("<meta http-equiv=\"Content-Type\"\n");
     printf("content=\"text/html; charset=iso-8859-1\">\n");
     printf("<meta name=\"GENERATOR\" content=\"Avion International\'s PART2HTM v0.4\">\n");
     printf("<title>Parts Listing for %s</title>\n", B.name);
     printf("<head>\n\n");
     printf("<body bgcolor=\"\#FFFFFF\">\n\n");
     printf("<h1 align=\"center\">Parts List for</h1>\n\n");
     printf("<h1 align=\"center\">%s</h1>\n", B.name);
     printf("<hr width=\"90%%\">\n\n");
     printf("<blockquote>\n");
     printf("    <h2 align=\"left\">Parts Listing</h2>\n");
     printf("</blockquote>\n");
     printf("<div align=\"center\"><center>\n\n");
     printf("<table border=\"2\" width=\"90%%\">\n");
     printf("    <tr>\n");
     printf("        <td align=\"center\" width=\"25%%\"><font size=\"4\"><strong>Part</strong></font></td>\n");
     printf("        <td align=\"center\" width=\"25%%\"><font size=\"4\"><strong>Value</strong></font></td>\n");
     printf("        <td align=\"center\" width=\"25%%\"><font size=\"4\"><strong>Package</strong></font></td>\n");
     printf("        <td align=\"center\" width=\"25%%\"><font size=\"4\"><strong>Library</strong></font></td>\n");
     printf("    </tr>\n");

     B.elements(E) {

        printf("    <tr>\n");
        printf("<td align=\"center\" width=\"25%%\">%s</td>\n", E.name);
        printf("<td align=\"center\" width=\"25%%\">%s</td>\n", E.value);
        printf("<td align=\"center\" width=\"25%%\">%s</td>\n", E.package.name);
        printf("<td align=\"center\" width=\"25%%\">%s</td>\n", E.package.library);
        printf("    </tr>\n");
        }
     printf("</table>\n");
     printf("</center></div>\n\n");
     printf("<p></p>\n\n");
     printf("<blockquote>\n");
     printf("    <p><em>Generated by PART2HTM v0.4 by </em><a\n");
     printf("    href=\"mailto:sdalcorn@avion.com.tw\"><em>Sean D. Alcorn</em></a><em><br>\n");
     printf("    &copy; 1997 </em><a href=\"http://www.avion.com.tw/\"><em>Avion\n");
     printf("    International Co. Ltd.</em></a><em><br>\n");
     printf("    Bangkok &#149; Sydney &#149; Taipei</em></p>\n");
     printf("</blockquote>\n");
     printf("</body>\n");
     printf("</html>");
     }
   }
