本文整理汇总了Java中com.lowagie.text.Paragraph.setSpacingBefore方法的典型用法代码示例。如果您正苦于以下问题:Java Paragraph.setSpacingBefore方法的具体用法?Java Paragraph.setSpacingBefore怎么用?Java Paragraph.setSpacingBefore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Paragraph
的用法示例。
在下文中一共展示了Paragraph.setSpacingBefore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.lowagie.text.Paragraph; //导入方法依赖的package包/类
/**
* Demonstrates adding a soft linebreak to a Paragraph
*
*
*/
@Test
public void main() throws Exception {
Document document = new Document();
RtfWriter2.getInstance(document, PdfTestBase.getOutputStream("SoftLineBreak.rtf"));
document.open();
document.add(new Paragraph("This is just a paragraph."));
Paragraph par = new Paragraph();
// Set the spacings just to demonstrate that the soft linebreak
// does not cause spacing before or after
par.setSpacingBefore(10);
par.setSpacingAfter(10);
// Add the contents before the linebreak
par.add("This paragraph contains a soft linebreak");
// Add the soft linebreak
par.add(RtfDirectContent.DIRECT_SOFT_LINEBREAK);
// Add the contents after the linebreak
par.add("just before the just.");
// Add the paragraph to the document
document.add(par);
document.add(new Paragraph("This is just a paragraph."));
document.close();
}