2016-08-18 81 views
0

我想爲同一段落設置多個樣式,只應用一種樣式。我想應用多種風格如何使用apache poi將多個樣式設置爲單詞段落

XWPFDocument document = new XWPFDocument(new FileInputStream("D:\\LatestStyleTemplates.docx")); 
      out = new FileOutputStream(new File("D:\\createdocument.docx")); 
      XWPFParagraph article = document.createParagraph(); 
      XWPFParagraph title = document.createParagraph(); 
      XWPFParagraph endnoteText = document.createParagraph(); 
      XWPFParagraph heading1 = document.createParagraph(); 
      endnoteText.setStyle("Strong"); 
      endnoteText.setStyle("EndnoteText"); 
+1

Microsoft Word甚至允許您這樣做嗎? – Gagravarr

回答

1

每個段落只能有一個段落層次樣式。如果您需要覆蓋段落樣式的特定方面,則可以在運行中定義其他字符樣式(每次運行最多一個)。