Package org.odftoolkit.simple

Examples of org.odftoolkit.simple.SpreadsheetDocument


 
 
  @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.");
     
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");
     
      //validate
      String lan = textProperties.getLanguage();
      Assert.assertEquals("Chinese", lan);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

 
 
  @Test
  public void testGetSetLanguageParam() {
    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", Document.ScriptType.CJK);
      //validate
      String lan = textProperties.getLanguage(Document.ScriptType.CJK);
      Assert.assertEquals("Chinese", lan);
     
      textProperties.setLanguage("Chinese", Document.ScriptType.CTL);
      //validate
      String lan1 = textProperties.getLanguage(Document.ScriptType.CTL);
      Assert.assertEquals("Chinese", lan1);
     
      textProperties.setLanguage(null, Document.ScriptType.CTL);
      //validate
      String lan2 = textProperties.getLanguage(Document.ScriptType.CTL);
      Assert.assertEquals(null, lan2);
     
      textProperties.setLanguage(null, Document.ScriptType.WESTERN);
      //validate
      String lan3 = textProperties.getLanguage(Document.ScriptType.WESTERN);
      Assert.assertEquals(null, lan3);
     
      textProperties.setLanguage(null, Document.ScriptType.CJK);
      //validate
      String lan4 = textProperties.getLanguage(Document.ScriptType.CJK);
      Assert.assertEquals(null, lan4);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

 
 
  @Test
  public void testGetCountry() {
    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.setCountry("china");
     
      //validate
      String country = textProperties.getCountry();
      Assert.assertEquals("china", country);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

 
 
  @Test
  public void testGetCountryParam() {
    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.setCountry("china", Document.ScriptType.WESTERN);
     
      //validate
      String country = textProperties.getCountry(Document.ScriptType.WESTERN);
      Assert.assertEquals("china", country);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

 
 
  @Test
  public void testGetColor() {
    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.setFontColor(Color.GREEN);
     
      //validate
      Color green = textProperties.getFontColor();
      Assert.assertEquals(Color.GREEN.toString(), green.toString());
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

  }
 
  @Test
  public void testGetSetName() {
    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.setFontName("fontname");
     
      //validate
      String fontName = textProperties.getFontName();
      Assert.assertEquals("fontname", fontName);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

 
 
  @Test
  public void testGetSetNameParam() {
    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.setFontName("fontname", Document.ScriptType.WESTERN);
     
      //validate
      String fontName = textProperties.getFontName(Document.ScriptType.WESTERN);
      Assert.assertEquals("fontname", fontName);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

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

    } catch (Exception e) {
      Logger.getLogger(ImageTest.class.getName()).log(Level.SEVERE, null, e);
View Full Code Here

 
 
  @Test
  public void testSetFont() {
    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.setFont(font);
     
      //validate
      Font font1 = textProperties.getFont();
      Assert.assertEquals(font, font1);
     
      //save
      document.save(ResourceUtilities.newTestOutputFile("testFontOutput1.ods"));
    } catch (Exception e) {
      LOGGER.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.odftoolkit.simple.SpreadsheetDocument

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.