示例#1
0
 public static void createParagraph(Paragraph p, ChainedProperties props) {
   String value = props.getProperty("align");
   if (value != null) {
     if (value.equalsIgnoreCase("center")) p.setAlignment(Element.ALIGN_CENTER);
     else if (value.equalsIgnoreCase("right")) p.setAlignment(Element.ALIGN_RIGHT);
     else if (value.equalsIgnoreCase("justify")) p.setAlignment(Element.ALIGN_JUSTIFIED);
   }
   setParagraphLeading(p, props.getProperty("leading"));
   value = props.getProperty("before");
   if (value != null) {
     try {
       p.setSpacingBefore(Float.valueOf(value).floatValue());
     } catch (Exception e) {
     }
   }
   value = props.getProperty("after");
   if (value != null) {
     try {
       p.setSpacingAfter(Float.valueOf(value).floatValue());
     } catch (Exception e) {
     }
   }
   value = props.getProperty("extraparaspace");
   if (value != null) {
     try {
       p.setExtraParagraphSpace(Float.valueOf(value).floatValue());
     } catch (Exception e) {
     }
   }
 }
示例#2
0
 public static Paragraph createParagraph(HashMap props) {
   Paragraph p = new Paragraph();
   String value = (String) props.get("align");
   if (value != null) {
     if (value.equalsIgnoreCase("center")) p.setAlignment(Element.ALIGN_CENTER);
     else if (value.equalsIgnoreCase("right")) p.setAlignment(Element.ALIGN_RIGHT);
     else if (value.equalsIgnoreCase("justify")) p.setAlignment(Element.ALIGN_JUSTIFIED);
   }
   setParagraphLeading(p, (String) props.get("leading"));
   return p;
 }