SQL Developer导出HTML样式

时间:2015-09-29 19:01:41

标签: html css oracle-sqldeveloper

SQL Developer的最新版本(4.1.1.19)有一个新的黑色列标题行,不太吸引人。

导出的html文件的样式将保存为文件<style>标记中的<head>块。

SQL Developer偏好设置中似乎没有设置允许将查询结果导出的颜色或字体更改为HTML。也没有包含此信息的配置文件或可能包含在导出文件生成中的任何文件。

如何更改html导出的查询结果的样式块?

编辑:这可能是不可能的。经过一番挖掘后,我找到了创建样式的文件。它包含在文件$sqldeveloper_dir/sqldeveloper/lib/oracle.dbtools-common.jar中的oracle/dbtools/raptor/format/HTMLFormatter.class中。样式块是此文件中的硬编码实体:

public class HTMLFormatter
extends ResultsFormatter {
    public static final String TYPE = "HTML";
    public static final String EXT = "htm";
    public static final String KEY_REC_TERM = "EXPORT_HTM_REC_TERM";
    private boolean _result = true;
    private static final String HEADER = "<!DOCTYPE html>\n<html>\n\n<head>\n  <meta charset='@@ENCODING@@'>\n  \n  <title>Responsive Table</title>\n  \n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\n  \n  <style>\n  * { \n    margin: 0; \n    padding: 0; \n  }\n  body { \n    font: 14px/1.4 Georgia, Serif; \n  }\n  \n  /* \n  Generic Styling, for Desktops/Laptops \n  */\n  table { \n    width: 100%; \n    border-collapse: collapse; \n  }\n  /* Zebra striping */\n  tr:nth-of-type(odd) { \n    background: #eee; \n  }\n  th { \n    background: #333; \n    color: white; \n    font-weight: bold; \n  }\n  td, th { \n    padding: 6px; \n    border: 1px solid #9B9B9B; \n    text-align: left; \n  }\n  @media \n  only screen and (max-width: 760px),\n  (min-device-width: 768px) and (max-device-width: 1024px)  {\n    table, thead, tbody, th, td, tr { display: block; }\n    thead tr { position: absolute;top: -9999px;left: -9999px;}\n    tr { border: 1px solid #9B9B9B; }\n    td { border: none;border-bottom: 1px solid #9B9B9B; position: relative;padding-left: 50%; }\n    \n    td:before { position: absolute;top: 6px;left: 6px;width: 45%; padding-right: 10px; white-space: nowrap;}\n    \n    /*\n    Label the data\n    */";
    private static final String HEADER_PART2 = "  }\n  \n  /* Smartphones (portrait and landscape) ----------- */\n  @media only screen\n  and (min-device-width : 320px)\n  and (max-device-width : 480px) {\n    body { \n      padding: 0; \n      margin: 0; \n      width: 320px; }\n    }\n  \n  /* iPads (portrait and landscape) ----------- */\n  @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {\n    body { \n      width: 495px; \n    }\n  }\n  \n  </style>\n  <!--<![endif]-->\n<script type=\"text/javascript\">\n\nlsearch = function(){\n  //this.term = document.getElementById('S').value.toUpperCase();\n  var s = document.getElementById('search').value.toLowerCase();\n  rows = document.getElementById('data').getElementsByTagName('TR');\n  for(var i=0;i<rows.length;i++){\n    if (s ==\"\" ){\n      rows[i].style.display ='';\n    } else if ( rows[i].innerText.toLowerCase().indexOf(s) != -1 ) {\n      rows[i].style.display ='';\n    } else {\n      rows[i].style.display ='none';\n    }\n  }\n  this.time = false;\n}\n\n</script>\n</head>\n\n<body>\n<div><input type=\"text\" size=\"30\" maxlength=\"1000\" value=\"\" id=\"search\" onkeyup=\"lsearch();\" /><input type=\"button\" value=\"Go\" onclick=\"lsearch();\"/> </div>";

    public HTMLFormatter() {
        super("HTML", "HTML File", "htm");
    }
...

不幸的是,这是一个已编译的类和反编译 - &gt; edit-&gt;重新编译由于依赖而未成功,而且oracle没有发布构建项目(据我所知)。

0 个答案:

没有答案