2013-10-22 44 views
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> 

回答

0

似乎飞碟有某些字体变体的问题。我改变

font:10px arial,sans-serif; 

font-size:10px;font-family:"Trebuchet MS"; 

,我已经声明字体大小分别是无关紧要的事实。我只是把它分开来进行测试。我检查了其他字体,看起来Arial,Helvetica,sans-serif和其他一些字体不会在XHTMLPanel中变得粗体。为什么这是我不知道的。我会直接向他们报告,以防它是一些描述的错误。

相关问题