Package org.odftoolkit.simple.table

Examples of org.odftoolkit.simple.table.Cell


          .getTestResourceAsStream(filename));
      Table table = doc.getTableByName("A");
      //setWidth
      borderbase.setWidth(0.056);
     
      Cell cell = table.getCellByPosition("A14");
      cell.setBorders(CellBordersType.LEFT, borderbase);
      cell.setBorders(CellBordersType.TOP, borderbase);

      //verification
      Border thisBorder = cell.getBorder(CellBordersType.LEFT);
      thisBorder = cell.getBorder(CellBordersType.TOP);
      Assert.assertEquals(0.056, thisBorder.getWidth());
      //save
      //doc.save(ResourceUtilities.newTestOutputFile("testSetWidth.ods"));

    } catch (Exception e) {
View Full Code Here


          .getTestResourceAsStream(filename));
      Table table = doc.getTableByName("A");
      //setWidth
      borderbase.setInnerLineWidth(0.0156);
     
      Cell cell = table.getCellByPosition("A14");
      cell.setBorders(CellBordersType.LEFT, borderbase);
      cell.setBorders(CellBordersType.TOP, borderbase);

      //verification
      Border thisBorder = cell.getBorder(CellBordersType.LEFT);
      thisBorder = cell.getBorder(CellBordersType.TOP);
      Assert.assertEquals(0.0156, thisBorder.getInnerLineWidth());
      //save
      //doc.save(ResourceUtilities.newTestOutputFile("testSetWidth.ods"));

    } catch (Exception e) {
View Full Code Here

      Table table = doc.getTableByName("A");
      //setWidth
    //  borderbase.setInnerLineWidth(0.0156);
      borderbase.setDistance(0.123);
     
      Cell cell = table.getCellByPosition("A14");
      cell.setBorders(CellBordersType.LEFT, borderbase);
      cell.setBorders(CellBordersType.TOP, borderbase);

      //verification
      Border thisBorder = cell.getBorder(CellBordersType.LEFT);
      thisBorder = cell.getBorder(CellBordersType.TOP);
      Assert.assertEquals(0.123, thisBorder.getDistance());
      //save
      //doc.save(ResourceUtilities.newTestOutputFile("testSetWidth.ods"));

    } catch (Exception e) {
View Full Code Here

     
      System.out.println(borderbase.getOuterLineWidth());
      borderbase.setOuterLineWidth(0.125);
      System.out.println(borderbase.getOuterLineWidth());     
     
      Cell cell = table.getCellByPosition("A14");
      cell.setBorders(CellBordersType.LEFT, borderbase);
      cell.setBorders(CellBordersType.TOP, borderbase);

      //verification
      Border thisBorder = cell.getBorder(CellBordersType.LEFT);
      thisBorder = cell.getBorder(CellBordersType.TOP);
      Assert.assertEquals(0.125, thisBorder.getOuterLineWidth());
      //save
      //doc.save(ResourceUtilities.newTestOutputFile("testSetWidth.ods"));

    } catch (Exception e) {
View Full Code Here

          "CheckBox 3", "CheckBox 3", "3");
      checkbox.setCurrentState(FormCheckboxState.CHECKED);
      checkbox.setAnchorType(AnchorType.AS_CHARACTER);

      Table table1 = Table.newTable(doc, 2, 2);
      Cell cell = table1.getCellByPosition("B1");
      para = cell.addParagraph("Insert a check box here.");
      form.createCheckBox(para, checkBoxRtg, "CheckBox 4", "CheckBox 4",
          "4");
      doc.save(ResourceUtilities
          .newTestOutputFile("TestCreateCheckbox.odt"));
View Full Code Here

          .getTestResourceAsStream(filename));
      Table table = doc.getTableByName("A");
     
      borderbase.setLinearMeasure(StyleTypeDefinitions.SupportedLinearMeasure.CM);
     
      Cell cell = table.getCellByPosition("A14");
      cell.setBorders(CellBordersType.LEFT, borderbase);
      cell.setBorders(CellBordersType.TOP, borderbase);

      //verification
      Border thisBorder = cell.getBorder(CellBordersType.LEFT);
      thisBorder = cell.getBorder(CellBordersType.TOP);
      Assert.assertEquals(StyleTypeDefinitions.SupportedLinearMeasure.CM, thisBorder.getLinearMeasure());
      //save
      //doc.save(ResourceUtilities.newTestOutputFile("testSetWidth.ods"));

    } catch (Exception e) {
View Full Code Here

      Paragraph para = doc.addParagraph("Insert a button here.");
      form.createButton(para, btnRtg, "Button3", "Push Button 3");

      Table table1 = Table.newTable(doc, 2, 2);
      Cell cell = table1.getCellByPosition("A1");
      para = cell.addParagraph("Insert a button here:");
      form.createButton(para, btnRtg, "Button4", "Push Button 4");

      doc.save(ResourceUtilities
          .newTestOutputFile("TestCreateButton.odt"));
View Full Code Here

   
    while (search.hasNext()) {
        TextSelection item = (TextSelection) search.nextSelection();
        TableSelection nextTableSelection=new TableSelection(item);
        Table table=sourcedoc.getTableByName("Table1");
        Cell cell = table.getCellByPosition(0, 0);
        cell.setStringValue("SIMPLE");
        Table newtable = nextTableSelection.replaceWithTable(table);
        Assert.assertNotNull(newtable);
        Assert.assertEquals(1, newtable.getHeaderColumnCount());
        Assert.assertEquals(1, newtable.getHeaderRowCount());
        Assert.assertEquals(7 + 1, newtable.getRowCount());
        Assert.assertEquals(5 + 1, newtable.getColumnCount());
        cell = newtable.getCellByPosition(1, 1);
        Assert.assertEquals("string", cell.getValueType());
    }
 
   
    //2 Task1, #1 at the start of original Paragraph, #2 replace original Paragraph 
        search = new TextNavigation("Task1", doc);
        
        while (search.hasNext()) {
            TextSelection item = (TextSelection) search.nextSelection();
            TableSelection nextTableSelection=new TableSelection(item);
            Table table=sourcedoc.getTableByName("Table2");
            Table newtable = nextTableSelection.replaceWithTable(table);
            Cell cell = newtable.getCellByPosition(0, 0);
            cell.setStringValue("From Source Table2");
            Assert.assertNotNull(newtable);
            Assert.assertEquals(1, newtable.getHeaderColumnCount());
            Assert.assertEquals(1, newtable.getHeaderRowCount());
            Assert.assertEquals(10 + 1, newtable.getRowCount());
            Assert.assertEquals(4 + 1, newtable.getColumnCount());
           
            cell = newtable.getCellByPosition(1, 1);
            Assert.assertEquals("float", cell.getValueType());
        }   
        //1 RESS%>, #1 at the end of original Paragraph,
        search = new TextNavigation("RESS%>", doc);

        while (search.hasNext()) {
            TextSelection item = (TextSelection) search.nextSelection();
            TableSelection nextTableSelection=new TableSelection(item);
            Table table=sourcedoc.getTableByName("Table3");
            Table newtable = nextTableSelection.replaceWithTable(table);
            Cell cell = newtable.getCellByPosition(0, 0);
            cell.setStringValue("From Source Table3");
            Assert.assertNotNull(newtable);
            Assert.assertEquals(5, newtable.getRowCount());
            Assert.assertEquals(3, newtable.getColumnCount());

        }       
View Full Code Here

      ((ComboBox) comboBox).setDataField("Author");
      comboBox.setAnchorType(AnchorType.AS_CHARACTER);

      Table table = Table.newTable(doc, 2, 2);
      table.setTableName("Table");
      Cell cell = table.getCellByPosition("B1");
      para = cell.addParagraph("Insert a combo box here.");
      form.createComboBox(para, comboRtg, "combo3", "default text", true);

      doc.save(ResourceUtilities
          .newTestOutputFile("TestCreateComboBox.odt"));
View Full Code Here

      SpreadsheetDocument odsdoc = SpreadsheetDocument.loadDocument(ResourceUtilities
          .getTestResourceAsStream("TestSpreadsheetTable.ods"));
   
      int columnindex = 0, rowindex = 3;
      Table table = odsdoc.getTableByName("Sheet1");
      Cell fcell = table.getCellByPosition(columnindex, rowindex);
 
      System.out.println(fcell.getStringValue());
     
      StyleTypeDefinitions.VerticalAlignmentType align = fcell.getVerticalAlignmentType();
      Assert.assertEquals(StyleTypeDefinitions.VerticalAlignmentType.TOP, align);
     
      VerticalAlignmentType vertType = VerticalAlignmentType.enumValueOf("top");
      Assert.assertEquals(VerticalAlignmentType.TOP, vertType);
      Assert.assertEquals("top", vertType.toString());
View Full Code Here

TOP

Related Classes of org.odftoolkit.simple.table.Cell

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.