Package org.odftoolkit.simple.table

Examples of org.odftoolkit.simple.table.Table


  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();

      writeProperties.setBreak("before", "page");
      Assert.assertEquals("page", readProperties.getBreakBefore());
View Full Code Here


  public void testGetSetPageNumber() {
    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();

      writeProperties.setBreak("before", "page");
      Assert.assertEquals("page", readProperties.getBreakBefore());
      writeProperties.setPageNumber(3);
View Full Code Here

      Paragraph para = doc.addParagraph("Insert a Label here.");
      Form form2 = doc.createForm("Form2");
      form2.createLabel(para, btnRtg, "Label", "Label");

      Form form3 = doc.createForm("Form3");
      Table table1 = Table.newTable(doc, 2, 2);
      Cell cell = table1.getCellByPosition("A1");
      para = cell.addParagraph("Insert a text box here.");
      form3.createTextBox(para, btnRtg, "Text Box", "TextBox", true);

      Assert.assertNotNull(doc.getFormByName("Form1"));
View Full Code Here

      box.setImage(ResourceUtilities.getURI("image_list_item.png"));
      pDoc.save(ResourceUtilities.newTestOutputFile("imagep.odp"));

      // new image in a table
      TextDocument sDoc = TextDocument.newTextDocument();
      Table table1 = sDoc.addTable(2, 2);
      Cell cell1 = table1.getCellByPosition(0, 0);
      Image image3 = cell1.setImage(ResourceUtilities.getURI("image_list_item.png"));
      image3.setHorizontalPosition(FrameHorizontalPosition.LEFT);
      image3.setHyperlink(new URI("http://odftoolkit.org"));
      Assert.assertEquals("http://odftoolkit.org", image3.getHyperlink().toString());
      sDoc.save(ResourceUtilities.newTestOutputFile("imges.odt"));

      SpreadsheetDocument sheet = SpreadsheetDocument.newSpreadsheetDocument();
      Table table2 = sheet.getTableList().get(0);
      Cell cell2 = table2.getCellByPosition(1, 1);
      Image image4 = cell2.setImage(ResourceUtilities.getURI("image_list_item.png"));
      sheet.save(ResourceUtilities.newTestOutputFile("imgesheet.ods"));
      Image aImage4 = cell2.getImage();
      Assert.assertEquals(image4, aImage4);
View Full Code Here

  @Test
  public void testGetHorizontalPosition() {
    try {
      // new image in a table
      TextDocument sDoc = TextDocument.newTextDocument();
      Table table1 = sDoc.addTable(2, 2);
      Cell cell1 = table1.getCellByPosition(0, 0);
      Image image3 = cell1.setImage(ResourceUtilities.getURI("image_list_item.png"));
      image3.setHorizontalPosition(FrameHorizontalPosition.LEFT);
      Assert.assertEquals(FrameHorizontalPosition.LEFT, image3.getHorizontalPosition());
     
      //save
View Full Code Here

  @Test
  public void testSetVerticalPosition() {
    try {
      // new image in a table
      TextDocument sDoc = TextDocument.newTextDocument();
      Table table1 = sDoc.addTable(2, 2);
      Cell cell1 = table1.getCellByPosition(0, 0);
      Image image3 = cell1.setImage(ResourceUtilities.getURI("image_list_item.png"));
      image3.setVerticalPosition(FrameVerticalPosition.BELOW);
     
      Assert.assertEquals(FrameVerticalPosition.BELOW, image3.getVerticalPosition());
     
View Full Code Here

 
  @Test
  public void testGetFontSizeInPoint() {
    try {
      SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument();
      Table table = document.getTableByName("Sheet1");
      Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH);
      Cell cell = table.getCellByPosition("A1");
      cell.setFont(font);
      cell.setStringValue("testGetFontStyle.");
     
      TextProperties textProperties = cell.getStyleHandler().getTextPropertiesForWrite();
      textProperties.setFontSizeInPoint(3.32);
View Full Code Here

 
  @Test
  public void testGetFontStyle() {
    try {
      SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument();
      Table table = document.getTableByName("Sheet1");
      Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH);
      Cell cell = table.getCellByPosition("A1");
      cell.setFont(font);
      cell.setStringValue("testGetFontStyle.");
     
      TextProperties textProperties = cell.getStyleHandler().getTextPropertiesForWrite();
      textProperties.setFontStyle(StyleTypeDefinitions.FontStyle.BOLDITALIC);
View Full Code Here

 
  @Test
  public void testGetFontStyleParam() {
    try {
      SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument();
      Table table = document.getTableByName("Sheet1");
      Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH);
      Cell cell = table.getCellByPosition("A1");
      cell.setFont(font);
      cell.setStringValue("testGetFontStyle.");
     
      TextProperties textProperties = cell.getStyleHandler().getTextPropertiesForWrite();
      textProperties.setFontStyle(StyleTypeDefinitions.FontStyle.BOLDITALIC, Document.ScriptType.WESTERN);
View Full Code Here

 
  @Test
  public void testGetSetLanguage() {
    try {
      SpreadsheetDocument document = SpreadsheetDocument.newSpreadsheetDocument();
      Table table = document.getTableByName("Sheet1");
      Font font = new Font("Arial", StyleTypeDefinitions.FontStyle.ITALIC, 17.5, Color.GREEN, StyleTypeDefinitions.TextLinePosition.REGULAR, Locale.ENGLISH);
      Cell cell = table.getCellByPosition("A1");
      cell.setFont(font);
      cell.setStringValue("testGetFontStyle.");
     
      TextProperties textProperties = cell.getStyleHandler().getTextPropertiesForWrite();
      textProperties.setLanguage("Chinese");
View Full Code Here

TOP

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

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.