{"id":33,"date":"2017-04-04T10:07:24","date_gmt":"2017-04-04T10:07:24","guid":{"rendered":"http:\/\/www.yohz.com\/blogs\/?p=33"},"modified":"2017-04-04T10:07:24","modified_gmt":"2017-04-04T10:07:24","slug":"customizing-db-doc-html-and-chm-report-templates","status":"publish","type":"post","link":"https:\/\/www.yohz.com\/blogs\/2017\/04\/04\/customizing-db-doc-html-and-chm-report-templates\/","title":{"rendered":"Customizing DB Doc HTML and CHM report templates"},"content":{"rendered":"<p>The <a href=\"http:\/\/www.yohz.com\/dbdoc_details.htm\">DB Doc<\/a> HTML and CHM reports share the same templates. \u00a0The report is generated by means of a Pascal-like scripting engine, so every single element is customizable. \u00a0The DB Doc <a href=\"http:\/\/www.yohz.com\/help\/dbdoc\/tserver.htm\">help file<\/a> contains a class reference for every schema element.<\/p>\n<p>To edit the template, click on the <strong>Edit<\/strong> button next to the script file name value.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-51 size-full\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_04.png\" alt=\"\" width=\"800\" height=\"640\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_04.png 800w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_04-300x240.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_04-768x614.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_04-150x120.png 150w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>This brings up the script editor, which you can modify.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-52 size-full\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_05.png\" alt=\"\" width=\"800\" height=\"778\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_05.png 800w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_05-300x292.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_05-768x747.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_36_05-150x146.png 150w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>The script runs roughly in this order of procedures:<\/p>\n<p><strong>Main<\/strong> &gt; <strong>CopyTemplateFiles<\/strong> &gt; <strong>CreateHTMLPages<\/strong><\/p>\n<p>The <strong>Main<\/strong> procedure sets up some global values for the script, and also sets up the output files depending on whether it is generating a HTML or CHM file.<\/p>\n<p>The <strong>CopyTemplateFiles<\/strong>\u00a0procedure copies the icons and stylesheets from the DB Doc template folder into the selected HTML output folder. \u00a0If you want to modify the default icons, just replace the image files in the DB Doc images template folder (e.g.\u00a0C:\\Program Files (x86)\\Yohz Software\\DB Doc\\template\\images\\). \u00a0 The HTML and CHM outputs use only the 16&#215;16 and 32&#215;32 images.<\/p>\n<p>The main work is performed in the <strong>CreateHTMLPages<\/strong> procedure. \u00a0This procedure creates the individual schema elements pages by calling the relevant procedures. \u00a0To generate the pages for each type of schema element, there are usually 3 steps:<\/p>\n<ul>\n<li>the <strong>CreateListItemLink<\/strong> procedure is called to create the table of contents navigation structure for that element type<\/li>\n<li>if that element type consists of multiple items like tables and views, a listing function is called to create a summary page e.g.\u00a0<strong>CreateTableListingPage<\/strong> for tables,\u00a0<strong>CreateViewListingPage<\/strong> for views<\/li>\n<li>the details page for that element type is called e.g.\u00a0<strong>CreateSchemaPage<\/strong> for schemas,\u00a0<strong>CreateTablePage<\/strong> for tables<\/li>\n<\/ul>\n<p>Within each of the procedures, you can modify the script to display different values depending on your needs. \u00a0Take the <strong>CreateTablePage<\/strong> function for example. \u00a0At the beginning, we create the HTML file for that table, and insert the standard header elements.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-58 size-full\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script01.png\" alt=\"\" width=\"864\" height=\"226\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script01.png 864w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script01-300x78.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script01-768x201.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script01-150x39.png 150w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/p>\n<p>We want to display some details about that table, so we create a HTML table to display those details.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-54\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script02.png\" alt=\"\" width=\"864\" height=\"550\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script02.png 864w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script02-300x191.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script02-768x489.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script02-150x95.png 150w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/p>\n<p>Next comes the columns. \u00a0We create a HTML table, set up its columns, and then iterate through all the columns, and display each columns&#8217; properties.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-55\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script03.png\" alt=\"\" width=\"864\" height=\"622\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script03.png 864w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script03-300x216.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script03-768x553.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script03-150x108.png 150w\" sizes=\"(max-width: 864px) 100vw, 864px\" \/><\/p>\n<p>The same process is repeated for indexes, check constraints, unique constraints, triggers, and foreign keys. \u00a0You can modify any element you want simply by modifying the script. \u00a0Once the page for this table has been completed, it&#8217;s then saved as a HTML file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-56\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script04.png\" alt=\"\" width=\"608\" height=\"256\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script04.png 608w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script04-300x126.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script04-150x63.png 150w\" sizes=\"(max-width: 608px) 100vw, 608px\" \/><\/p>\n<p>Every schema element that has a HTML page is named using a specific naming convention provided by the <strong>GetObjectDetailsPage<\/strong> function.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-57\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script05.png\" alt=\"\" width=\"931\" height=\"520\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script05.png 931w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script05-300x168.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script05-768x429.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script05-150x84.png 150w\" sizes=\"(max-width: 931px) 100vw, 931px\" \/><\/p>\n<p>Using this function, you can get the name of a HTML page for a particular schema element, simply by passing the element as a parameter to this function. \u00a0For example, in the <strong>CreateTablePage<\/strong> function, when listing out the foreign keys, we display a link to the reference table using the <strong>GetObjectDetailsPage<\/strong> function by passing the reference table as the parameter. \u00a0It does not matter that the page may not have been created yet, because when it does get created, it will use the same naming convention provided by the\u00a0<strong>GetObjectDetailsPage<\/strong> function.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-59\" src=\"http:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script06.png\" alt=\"\" width=\"1004\" height=\"335\" srcset=\"https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script06.png 1004w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script06-300x100.png 300w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script06-768x256.png 768w, https:\/\/www.yohz.com\/blogs\/wp-content\/uploads\/2017\/04\/dbdoc_script06-150x50.png 150w\" sizes=\"(max-width: 1004px) 100vw, 1004px\" \/><\/p>\n<p>So that&#8217;s generally how DB Doc uses scripting to create your HTML and CHM reports. \u00a0If you have had any experience coding or writing scripts, you should be able to modify the scripts quite easily. \u00a0As mentioned earlier, the <a href=\"http:\/\/www.yohz.com\/help\/dbdoc\/tserver.htm\">class reference<\/a> in the help file would assist you greatly in seeing what methods are available for each schema object type.<\/p>\n<p>If you need any assistance customizing the template, please do drop us a line at <a href=\"mailto:support@yohz.com\">support@yohz.com<\/a>.<\/p>\n<div class=\"fcbkbttn_buttons_block\" id=\"fcbkbttn_left\"><div class=\"fcbkbttn_like \"><fb:like href=\"https:\/\/www.yohz.com\/blogs\/2017\/04\/04\/customizing-db-doc-html-and-chm-report-templates\/\" action=\"like\" colorscheme=\"light\" layout=\"button\"  size=\"small\"><\/fb:like><\/div><div class=\"fb-share-button  \" data-href=\"https:\/\/www.yohz.com\/blogs\/2017\/04\/04\/customizing-db-doc-html-and-chm-report-templates\/\" data-type=\"button\" data-size=\"small\"><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>The DB Doc HTML and CHM reports share the same templates. \u00a0The report is generated by means of a Pascal-like scripting engine, so every single element is customizable. \u00a0The DB Doc help file contains a class reference for every schema element. To edit the template, click on the Edit button next to the script file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[15,3,14],"_links":{"self":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts\/33"}],"collection":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":4,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/posts\/33\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yohz.com\/blogs\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}