Package org.odftoolkit.simple

Examples of org.odftoolkit.simple.TextDocument.addParagraph()


    try {
      TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(TEST_DOCUMENT));

      // declare simple variable
      VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_con_variable");
      Paragraph varParagraph = doc.addParagraph("test_con_variable:");
      simpleVariableField.updateField("true", varParagraph.getOdfElement());

      // test condition field
      Paragraph newParagraph = doc.addParagraph("Condition Field Test:");
      ConditionField conditionField = Fields.createConditionField(newParagraph.getOdfElement(), "test_con_variable == \"true\"",
View Full Code Here


      VariableField simpleVariableField = Fields.createSimpleVariableField(doc, "test_con_variable");
      Paragraph varParagraph = doc.addParagraph("test_con_variable:");
      simpleVariableField.updateField("true", varParagraph.getOdfElement());

      // test condition field
      Paragraph newParagraph = doc.addParagraph("Condition Field Test:");
      ConditionField conditionField = Fields.createConditionField(newParagraph.getOdfElement(), "test_con_variable == \"true\"",
          "trueText", "falseText");
      Assert.assertNotNull(conditionField);
     
      FieldType fieldType = conditionField.getFieldType();
View Full Code Here

     
      FieldType fieldType = conditionField.getFieldType();
      Assert.assertEquals(FieldType.CONDITION_FIELD, fieldType);

      // test hide field
      newParagraph = doc.addParagraph("Hide Text Field Test:");
      conditionField = Fields.createHiddenTextField(newParagraph.getOdfElement(), "test_con_variable == \"true\"", "hiddenText");
      FieldType fieldType1 = conditionField.getFieldType();
      Assert.assertEquals(FieldType.HIDDEN_TEXT_FIELD, fieldType1);
    } catch (Exception e) {
      Logger.getLogger(ConditionFieldTest.class.getName()).log(Level.SEVERE, null, e);
View Full Code Here

   */
  @Test
  public void testReplacewithField() throws Exception {
    doc = (TextDocument) Document.loadDocument(ResourceUtilities.getAbsolutePath(TEXT_FILE));
    TextDocument sourcedoc = TextDocument.newTextDocument();
    sourcedoc.addParagraph("Hello1 from SIMPLE source document!");
    sourcedoc.addParagraph("Hello2 from source document!");
    sourcedoc.addParagraph("Hello3 from source document!");
    VariableField variableField = Fields.createUserVariableField(sourcedoc, "test_simple_variable","testReplacewithField");
    Assert.assertNotNull(variableField);
    TextSpanElement newTextSpanElement = sourcedoc.newParagraph("Update Variable Field:").newTextSpanElement();
View Full Code Here

  @Test
  public void testReplacewithField() throws Exception {
    doc = (TextDocument) Document.loadDocument(ResourceUtilities.getAbsolutePath(TEXT_FILE));
    TextDocument sourcedoc = TextDocument.newTextDocument();
    sourcedoc.addParagraph("Hello1 from SIMPLE source document!");
    sourcedoc.addParagraph("Hello2 from source document!");
    sourcedoc.addParagraph("Hello3 from source document!");
    VariableField variableField = Fields.createUserVariableField(sourcedoc, "test_simple_variable","testReplacewithField");
    Assert.assertNotNull(variableField);
    TextSpanElement newTextSpanElement = sourcedoc.newParagraph("Update Variable Field:").newTextSpanElement();
    variableField.updateField("simple variable content", newTextSpanElement);
View Full Code Here

  public void testReplacewithField() throws Exception {
    doc = (TextDocument) Document.loadDocument(ResourceUtilities.getAbsolutePath(TEXT_FILE));
    TextDocument sourcedoc = TextDocument.newTextDocument();
    sourcedoc.addParagraph("Hello1 from SIMPLE source document!");
    sourcedoc.addParagraph("Hello2 from source document!");
    sourcedoc.addParagraph("Hello3 from source document!");
    VariableField variableField = Fields.createUserVariableField(sourcedoc, "test_simple_variable","testReplacewithField");
    Assert.assertNotNull(variableField);
    TextSpanElement newTextSpanElement = sourcedoc.newParagraph("Update Variable Field:").newTextSpanElement();
    variableField.updateField("simple variable content", newTextSpanElement);
    newTextSpanElement = sourcedoc.newParagraph("Show Variable Field:").newTextSpanElement();
View Full Code Here

   */
  @Test
  public void testReplacewithTextDocument() throws Exception {
    doc = (TextDocument) Document.loadDocument(ResourceUtilities.getAbsolutePath(TEXT_FILE));
    TextDocument sourcedoc = TextDocument.newTextDocument();
    sourcedoc.addParagraph("Hello1 from SIMPLE source document!");
    sourcedoc.addParagraph("Hello2 from source document!");
    sourcedoc.addParagraph("Hello3 from source document!");
    search = null;
    // 6 Simple, at the middle of original Paragraph, split original
    // Paragraph, insert before the second Paragraph.
View Full Code Here

  @Test
  public void testReplacewithTextDocument() throws Exception {
    doc = (TextDocument) Document.loadDocument(ResourceUtilities.getAbsolutePath(TEXT_FILE));
    TextDocument sourcedoc = TextDocument.newTextDocument();
    sourcedoc.addParagraph("Hello1 from SIMPLE source document!");
    sourcedoc.addParagraph("Hello2 from source document!");
    sourcedoc.addParagraph("Hello3 from source document!");
    search = null;
    // 6 Simple, at the middle of original Paragraph, split original
    // Paragraph, insert before the second Paragraph.
    // Note: you need cache the nextSelection item because after you replace
View Full Code Here

  public void testReplacewithTextDocument() throws Exception {
    doc = (TextDocument) Document.loadDocument(ResourceUtilities.getAbsolutePath(TEXT_FILE));
    TextDocument sourcedoc = TextDocument.newTextDocument();
    sourcedoc.addParagraph("Hello1 from SIMPLE source document!");
    sourcedoc.addParagraph("Hello2 from source document!");
    sourcedoc.addParagraph("Hello3 from source document!");
    search = null;
    // 6 Simple, at the middle of original Paragraph, split original
    // Paragraph, insert before the second Paragraph.
    // Note: you need cache the nextSelection item because after you replace
    // currtenItem with TextDocument, TextNavigation.nextSelection will
View Full Code Here

  @Test
  public void testGetSetPageBreak() {
    try {

      TextDocument doc = TextDocument.newTextDocument();
      doc.addParagraph("This is the first paragraph.");
      Table table = doc.addTable();
      TableProperties writeProperties = table.getStyleHandler()
          .getTablePropertiesForWrite();
      TableProperties readProperties = table.getStyleHandler()
          .getTablePropertiesForRead();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.