JavaFX WebView显示与Libre Office Writer的HTML差异

时间:2016-10-15 01:49:16

标签: html css javafx webview libreoffice

我使用SceneBuilder 2来创建一个Dialog来托管WebView,我打算用它来显示帮助(HTML)文档。

然后我在Libre Office Writer中创建了一个HTML文档。

加载'Help.html'文件,但WebView中的行间距与我在Libre中看到的行间距不同。

我想在WebView中看到我在Libre看到的内容。

我需要设置一些Style属性吗?段落中的文字正确包装,这是CR / LF之后的过多间距,这就是问题。

Controller的初始化方法:

public void initialize(URL url, ResourceBundle rb) 
{           
    WebEngine webEngine = webView.getEngine();

    // Load HTML Content
    webEngine.load(getClass().getResource("/SampleHelp.html").toExternalForm());
}

HTML中的SampleHelp.html文件。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title></title>
    <meta name="generator" content="LibreOffice 4.2.8.2 (Linux)">
    <meta name="created" content="20161014;0">
    <meta name="changed" content="20161015;90732380852526">
    <style type="text/css">
    <!--
        @page { margin-left: 1cm; margin-right: 1cm }
        p { color: #000000 }
    -->
    </style>
</head>
<body lang="en-AU" text="#000000" dir="ltr" style="background: transparent">
<p align="center" style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt"><u><b>Load
File</b></u></font></p>
<p style="margin-bottom: 0cm; page-break-before: auto; page-break-after: auto">
<font size="1" style="font-size: 8pt"><u>Purpose</u>: To load files
provided by a Service Provider, that holds all relevant information
about a given event.</font></p>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">For
this reason file loading is considered to be 'Automatic', and
requires minimal input. </font>
</p>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt"><u><b>Load
File – Saleyard</b></u></font></p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">The
operator needs to:</font></p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">(1)
Choose a Saleyard </font>
</p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">The
first dialog opens to show a list of all Saleyards registered in the
system.</font></p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">Select
one and press the 'OK' button to accept the selection, or 'Cancel' to
stop the process.</font></p>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">(2)
Choose a file.</font></p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">A
FileChooser Dialog opens in the Saleyards directory ( home/Livestock
Manager/Source/Saleyards), which shows a sub-directory for each
registered Saleyard.</font></p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">Open
the relevant provider's directory, and choose the relevant event file
(.xml). </font>
</p>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">The
system will then:</font></p>
<ul>
    <p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">-
    check to see that the file is from the nominated Saleyard</font></p>
    <p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">-
    check to ensure this event ( provider + event date) has not been
    loaded before</font></p>
    <p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt">-
    load the relevant data</font></p>
</ul>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><font size="1" style="font-size: 8pt"><b>Recommended</b></font></p>
<p style="margin-bottom: 0cm"><a name="__DdeLink__16_440979877"></a><font size="1" style="font-size: 8pt">Once
loaded, it is recommended that you view ( see menu option View / Edit
– Saleyard ) the results, to verify the number of head bought and
sold, and the cost. The quality of data supplied varies according to
provider. So, this also provides an opportunity to improve the data
by updates to Breed, Sex, and Has Calf as appropriate.</font></p>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><br>
</p>
<p style="margin-bottom: 0cm"><br>
</p>
</body>
</html>

WebView(和Mozilla FireFox)中显示的SampleHelp.html:

加载文件

目的:加载服务提供商提供的文件,其中包含有关给定事件的所有相关信息。

因此,文件加载被认为是“自动”,并且需要最少的输入。

加载文件 - Saleyard

运营商需要:

(1)选择Saleyard

第一个对话框打开,显示系统中注册的所有Saleyards的列表。

选择一个并按“确定”按钮接受选择,或按“取消”停止该过程。

(2)选择一个文件。

FileChooser对话框在Saleyards目录(home / Livestock Manager / Source / Saleyards)中打开,该目录显示了每个注册Saleyard的子目录。

打开相关提供商的目录,然后选择相关的事件文件(.xml)。

系统将:

- check to see that the file is from the nominated Saleyard

- check to ensure this event ( provider + event date) has not been loaded before

- load the relevant data

推荐

加载后,建议您查看(参见菜单选项查看/编辑 - Saleyard)结果,以验证买入和售出的头数以及成本。提供的数据质量因提供商而异。因此,这也提供了通过更新Breed,Sex和Has Calf来改善数据的机会。

在Libre Office Writer中:(如果我在这里剪切并且它也没有正确描述这个。)WebView显示是正确的,它只是段落之间的间距(在CR / LF之后)这就是问题。

例如,标题“加载文件 - 售卖场”和接下来的四行应该是连续的,即它们之间没有空格。然后是下一个标题“(2)选择文件”的空格,接下来的3行应该是连续的。 然后是一个空格到下一个标题“系统将会:”接下来的3行连续。

加载文件 目的:加载服务提供商提供的文件,其中包含有关给定事件的所有相关信息。

因此,文件加载被认为是“自动”,并且需要最少的输入。

加载文件 - Saleyard 运营商需要: (1)选择一个Saleyard 将打开第一个对话框,显示系统中注册的所有Saleyards的列表。 选择一个并按“确定”按钮接受选择,或按“取消”停止该过程。

(2)选择一个文件。 在Saleyards目录(home / Livestock Manager / Source / Saleyards)中打开FileChooser对话框,其中显示了每个已注册Saleale的子目录。 打开相关提供程序的目录,然后选择相关的事件文件(.xml)。

系统将: - 检查文件是否来自指定的Saleyard - 检查以确保之前未加载此事件(提供者+事件日期) - 加载相关数据

推荐 加载后,建议您查看(参见菜单选项View / Edit - Saleyard)结果,以验证买卖头数和成本。提供的数据质量因提供商而异。因此,这也提供了通过更新Breed,Sex和Has Calf来改善数据的机会。

1 个答案:

答案 0 :(得分:0)

目前,我已经决定使用BlueFish HTML编辑器,使用最少的标签和格式。

我仍然想知道为什么用Libre Office Writee编写并保存为HTML的文档在浏览器中看起来与在编写时不一样?

HTML是:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
    <meta name="generator" content="Bluefish 2.2.5" >
    <meta name="created" content="20161014;0">
    <meta name="changed" content="20161015;74147709157253">
<title></title>
</head>
<body>
<span style="text-decoration: underline;">Purpose:</span> To load files provided by a Service Provider, that holds all relevant information about an event.<br>
<br>
For this reason file loading is considered to be 'Automatic', and requires minimal input.<br>
<br>
<b><span style="text-decoration: underline;">Load File - Saleyard</span></b><br>
The operator needs to:<br>
(1) <span style="text-decoration: underline;">Choose a Saleyard</span><br>
The first dialog opens to show a list of all Saleyards registered in the system.<br>
Select one and click on the 'OK' button to accept the selection, or 'Cancel' to stop the process.<br>
<br>
(2) <span style="text-decoration: underline;">Choose a File</span><br>
A FileChooser dialog opens in the Saleyards directory (home/Livestock Manager/Source/Saleyards), which shows a sub-directory for each registered Saleyard.<br>
Open the relevant Saleyard directory, and choose the relevant event file (.xml).<br>
<br>
The system will then :<br>
- check to see that the file  is from the nominated Saleyard<br>
- check to ensure this event (provider + event date) has not been loaded before<br>
- load the relevant data<br>
<br>
<b>Recommended</b><br>
Once loaded, you show view the results (see menu option View / Edit - Saleyard) to verify the numbers of head bought and sold, and the cost.<br>
The quality of data supplied varies between providers. So, this provides an opportunity to improve the data, via updates to Breed, Sex and Has Calf as appropriate.<br>
<br>
<br>
<b><span style="text-decoration: underline;">Load File - KillSheet</span></b><br>
This process is similar for consistency.
However, at present each registered Abattoir provides it's own file type and structure. Since most Livestock are slaughtered at JBS Dinmore, this is the only file loaded automatically.<br>
<br>
The operator needs to:<br>
(1) Choose an Abattoir<br>
The first dialog opens to show a list of all Abattoirs (where the entry type is 'Automatic') registered in the system.<br>
Select one and click on the 'OK' button to accept the selection, or 'Cancel' to stop the process.<br>
</body>
</html>