0
我剛開始使用Flying Saucer顯示將由我正在創建的解決方案填充的html報告。本質上,我試圖讓Flying Saucer的XHTMLPanel
顯示爲粗體,但到目前爲止一直無法使用。我試過使用<b></b>
標籤,以及使用<span class="b"></span>
與.b {font-weight:bold;}
和其他一些方法,但迄今沒有成功。下面是我正在使用的修剪的java代碼和下面的xhtml。Flying Saucer字體重量不顯示
public class HALReportViewMain extends JFrame {
XHTMLPanel panel;
FSScrollPane scroll;
public HALReportViewMain() throws Exception{
panel = new XHTMLPanel();
scroll = new FSScrollPane(panel);
panel.setDocument(new File("C:\\Users\\rudi.kershaw\\Desktop\\Report.html"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
add(scroll);
setSize((int)new PageFormat().getImageableWidth(), (int)new PageFormat().getImageableHeight());
setVisible(true);
}
public static void main(String[] args) throws Exception {
HALReportViewMain derp = new HALReportViewMain();
}
}
並從xhtml Report.html的一節;
<html>
<head>
<style type="text/css">
body {font:10px arial,sans-serif;}
p {margin-left:5px;}
.b {font-weight:800;display:inline;margin:0;}
#address {position:absolute;top:0px;right:5px;text-align:right}
#picture {position:absolute;top:85px;right:20px;height:120px;width:240px;background-color:#E6E6E6}
.sitecontactswrapper {display:inline-block;margin:0px 10px;}
.sitecontacts {margin:0;}
</style>
</head>
<body>
<div class="sitecontactswrapper">
<p class="sitecontacts"><span class="b">Description: </span>Example</p>
<p class="sitecontacts"><span class="b">Full Name/s: </span>Example</p>
<p class="sitecontacts"><span class="b">Office Phone: </span>Example</p>
<p class="sitecontacts"><span class="b">Mobile Phone: </span>Example</p>
<p class="sitecontacts"><span class="b">Email Address: </span>Example</p>
</div>
</body>
</html>