2016-10-15 3 views
1

Ich habe SceneBuilder 2 verwendet, um einen Dialog zum Hosten eines WebView zu erstellen, mit dem ich Hilfe (HTML) -Dokumente anzeigen möchte.JavaFX WebView zeigt HTML-Unterschiede zu Libre Office Writer

Ich habe dann ein HTML-Dokument in Libre Office Writer erstellt.

Die Datei 'Help.html' wird geladen, aber der Zeilenabstand in der WebView unterscheidet sich von dem in Libre.

Ich möchte im WebView sehen, was ich in Libre sehe.

Gibt es ein Style-Attribut, das ich einstellen muss? Text in Absätzen wird korrekt umgebrochen, es ist der übermäßige Abstand nach CR/LF, das ist das Problem.

Die Methode initialize des Controllers:

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

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

Die SampleHelp.html Datei in 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> 

SampleHelp.html wie im WebView angezeigt (und Mozilla FireFox):

Datei laden

Zweck: Dateien, die von einem Service-Provider zur Verfügung gestellt laden, die alle relevanten Informationen über eine hält gegeben Veranstaltung.

Aus diesem Grund wird das Laden von Dateien als 'Automatisch' betrachtet und erfordert nur minimale Eingaben.

Datei laden - Saleyard

Der Betreiber muss:

(1) Wählen Sie eine Saleyard

Der erste Dialog eine Liste aller Saleyards im System registriert zeigen öffnet.

Wählen Sie einen aus und drücken Sie die 'OK' Taste, um die Auswahl zu bestätigen, oder 'Abbrechen', um den Vorgang zu stoppen.

(2) Wählen Sie eine Datei.

Im Verzeichnis Saleyards (Startseite/Livestock Manager/Source/Saleyards) wird ein FileChooser-Dialogfeld geöffnet, in dem für jedes registrierte Saleyard ein Unterverzeichnis angezeigt wird.

Öffnen Sie das entsprechende Anbieterverzeichnis und wählen Sie die relevante Ereignisdatei (.xml).

Das System wird dann:

- 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 

Empfohlene

Einmal geladen, wird empfohlen, dass Sie sehen (siehe Menüpunkt Ansicht/Bearbeiten - Saleyard) die Ergebnisse, die Anzahl des Kopfes überprüfen gekauft und verkauft, und die Kosten. Die Qualität der gelieferten Daten variiert je nach Anbieter. Somit bietet dies auch die Möglichkeit, die Daten durch Aktualisierungen von Rasse, Geschlecht und Kalb entsprechend zu verbessern.

Im Libre Office Writer: (Wenn ich hier schneide und hier vorbei, wird das auch nicht korrekt dargestellt.) Die WebView-Anzeige ist korrekt, nur der Abstand zwischen den Absätzen (nach CR/LF) ist das Problem.

Zum Beispiel die Überschrift "Load File - Saleyard" und die nächsten vier Zeilen sollten aufeinander folgen, d. H. Ohne Leerzeichen zwischen ihnen. Dann ein Leerzeichen zur nächsten Überschrift "(2) Wählen Sie eine Datei" und die nächsten 3 Zeilen sollten aufeinander folgen. Dann ein Leerzeichen bis zur nächsten Überschrift "Das System wird dann:" mit den nächsten 3 aufeinander folgenden Zeilen.

Datei laden Zweck: Laden von Dateien, die von einem Dienstanbieter bereitgestellt werden und die alle relevanten Informationen zu einem bestimmten Ereignis enthalten.

Aus diesem Grund wird das Laden von Dateien als 'Automatisch' betrachtet und erfordert nur minimale Eingaben.

Datei laden - Saleyard Der Betreiber muss: (1) Wählen Sie einen Saleyard Der erste Dialog eine Liste aller Saleyards im System registriert zeigen öffnet. Wählen Sie eine aus und drücken Sie die 'OK'-Taste, um die Auswahl zu bestätigen, oder' Abbrechen ', um den Vorgang zu stoppen.

(2) Wählen Sie eine Datei. Ein FileChooser-Dialogfeld wird im Verzeichnis "Saleyards" (Home/Livestock Manager/Source/Saleyards) geöffnet, in dem für jeden registrierten Saleyard ein Unterverzeichnis angezeigt wird. Öffnen Sie das entsprechende Anbieterverzeichnis und wählen Sie die relevante Ereignisdatei (.xml).

Das System wird dann: - überprüfen, um zu sehen, dass die Datei aus dem nominierten Saleyard ist - überprüfen Sie diese Veranstaltung (Provider + Datum des Ereignisses), um sicherzustellen, hat vor nicht geladen wurde - laden Sie die relevanten Daten

Empfohlen Nach dem Laden empfiehlt es sich, die Ergebnisse anzuzeigen (siehe Menüoption Anzeigen/Bearbeiten - Verkauf), um die Anzahl der gekauften und verkauften Exemplare sowie die Kosten zu überprüfen. Die Qualität der gelieferten Daten variiert je nach Anbieter. Somit bietet dies auch die Möglichkeit, die Daten durch Aktualisierungen von Rasse, Geschlecht und Kalb entsprechend zu verbessern.

+0

Die Antwort ist für mich auf kurze Sicht liegt mit einem anderen HTML-Editor. Ich vermutete, dass etwas an dem in Libre Office Writer generierten HTML-Code zu Problemen mit dem Zeilenabstand führte. – gbear

+0

Ich habe erwartet, dass Libre auf WYSIWYG-Art funktioniert, aber das tut es offensichtlich nicht. Ist das ein bekannter Fehler oder gibt es etwas, das ich nicht gemacht habe? – gbear

Antwort

0

Für jetzt habe ich mich für die Verwendung von BlueFish HTML-Editor mit minimalen Tags und Formatierung entschieden.

Ich möchte immer noch wissen, warum ein in Libre Office Writee geschriebenes und als HTML gespeichertes Dokument in einem Browser nicht genauso aussieht wie beim Schreiben?

HTML ist:

<!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> 
Verwandte Themen