Package org.apache.poi.hslf.record

Examples of org.apache.poi.hslf.record.StyleTextPropAtom$AlignmentTextProp


      assertEquals(data_b[i],b[i]);
    }
  }

  public void testLoadWriteB() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    stpb.writeOut(baos);
    byte[] b = baos.toByteArray();

    assertEquals(data_b.length, b.length);
    for(int i=0; i<data_b.length; i++) {
      //System.out.println(i + "\t" + b[i] + "\t" + data_b[i] + "\t" + Integer.toHexString(b[i]) );
View Full Code Here


              if(slwtChildren[k] instanceof TextBytesAtom) {
                lastTextLen = ((TextBytesAtom)slwtChildren[k]).getText().length();
              }

              if(slwtChildren[k] instanceof StyleTextPropAtom) {
                StyleTextPropAtom stpa = (StyleTextPropAtom)slwtChildren[k];
                stpa.setParentTextSize(lastTextLen);
                showStyleTextPropAtom(stpa);
              }
            }
          }
        }
View Full Code Here

  };
  private int data_b_text_len = 0xB3;
 

    public void testRecordType() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    assertEquals(4001l, stpa.getRecordType());
    assertEquals(4001l, stpb.getRecordType());
  }
View Full Code Here

    assertEquals(4001l, stpb.getRecordType());
  }


  public void testCharacterStyleCounts() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);

    // Set for the appropriate text sizes
    stpa.setParentTextSize(data_a_text_len);
    stpb.setParentTextSize(data_b_text_len);

    // In case A, there is a single styling of the characters
    assertEquals(3, stpa.getCharacterStyles().size());
    // In case B, there are 5 different stylings
    assertEquals(5, stpb.getCharacterStyles().size());
  }
View Full Code Here

    // In case B, there are 5 different stylings
    assertEquals(5, stpb.getCharacterStyles().size());
  }

  public void testParagraphStyleCounts() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);

    // Set for the appropriate text sizes
    stpa.setParentTextSize(data_a_text_len);
    stpb.setParentTextSize(data_b_text_len);

    // In case A, all has the same spacing and alignment
    assertEquals(1, stpa.getParagraphStyles().size());
    // In case B, all 4 sets have different alignments
    assertEquals(4, stpb.getParagraphStyles().size());
  }
View Full Code Here

    assertEquals(4, stpb.getParagraphStyles().size());
  }


  public void testCharacterStyleLengths() throws Exception {
    StyleTextPropAtom stpa = new StyleTextPropAtom(data_a,0,data_a.length);
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);

    // Set for the appropriate text sizes
    stpa.setParentTextSize(data_a_text_len);
    stpb.setParentTextSize(data_b_text_len);

    // 54 chars, 21 + 17 + 16
    LinkedList a_ch_l = stpa.getCharacterStyles();
    TextPropCollection a_ch_1 = (TextPropCollection)a_ch_l.get(0);
    TextPropCollection a_ch_2 = (TextPropCollection)a_ch_l.get(1);
    TextPropCollection a_ch_3 = (TextPropCollection)a_ch_l.get(2);
    assertEquals(21, a_ch_1.getCharactersCovered());
    assertEquals(17, a_ch_2.getCharactersCovered());
    assertEquals(16, a_ch_3.getCharactersCovered());

    // 179 chars, 30 + 28 + 25
    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
    assertEquals(30, b_ch_1.getCharactersCovered());
View Full Code Here

    assertEquals(96, b_ch_4.getCharactersCovered());
  }


  public void testCharacterPropOrdering() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
   
View Full Code Here

    assertEquals("font.size", tp_4_3.getName());
    assertEquals(24, tp_4_3.getValue());
  }

  public void testParagraphProps() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);
   
    LinkedList b_p_l = stpb.getParagraphStyles();
    TextPropCollection b_p_1 = (TextPropCollection)b_p_l.get(0);
    TextPropCollection b_p_2 = (TextPropCollection)b_p_l.get(1);
    TextPropCollection b_p_3 = (TextPropCollection)b_p_l.get(2);
    TextPropCollection b_p_4 = (TextPropCollection)b_p_l.get(3);
   
View Full Code Here

    assertEquals(0, tp_4_1.getValue());
    assertEquals(80, tp_4_2.getValue());
  }

  public void testCharacterProps() throws Exception {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
View Full Code Here

    // The value should now be 3
    assertEquals(0x0003, cf_4_1.getValue());
  }
 
  public void testFindAddTextProp() {
    StyleTextPropAtom stpb = new StyleTextPropAtom(data_b,0,data_b.length);
    stpb.setParentTextSize(data_b_text_len);

    LinkedList b_p_l = stpb.getParagraphStyles();
    TextPropCollection b_p_1 = (TextPropCollection)b_p_l.get(0);
    TextPropCollection b_p_2 = (TextPropCollection)b_p_l.get(1);
    TextPropCollection b_p_3 = (TextPropCollection)b_p_l.get(2);
    TextPropCollection b_p_4 = (TextPropCollection)b_p_l.get(3);
   
    LinkedList b_ch_l = stpb.getCharacterStyles();
    TextPropCollection b_ch_1 = (TextPropCollection)b_ch_l.get(0);
    TextPropCollection b_ch_2 = (TextPropCollection)b_ch_l.get(1);
    TextPropCollection b_ch_3 = (TextPropCollection)b_ch_l.get(2);
    TextPropCollection b_ch_4 = (TextPropCollection)b_ch_l.get(3);
View Full Code Here

TOP

Related Classes of org.apache.poi.hslf.record.StyleTextPropAtom$AlignmentTextProp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.