Package org.odftoolkit.simple.table

Examples of org.odftoolkit.simple.table.Cell


       
        @Test
        public void testSettingNullBackgroundOnCell() throws Exception {
            SpreadsheetDocument doc = SpreadsheetDocument.newSpreadsheetDocument();
            Table table = doc.getTableByName("Sheet1");
            Cell cell = table.getCellByPosition(1, 1);
            cell.setCellBackgroundColor((Color) null);
            Assert.assertNull(cell.getStyleHandler().getTableCellPropertiesForRead().getBackgroundColor());
            Assert.assertEquals(Color.WHITE, cell.getCellBackgroundColor());
        }
View Full Code Here


  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);
     
      //validate
      Double fontInPoint = textProperties.getFontSizeInPoint();
      Assert.assertEquals(3.32, fontInPoint);
View Full Code Here

  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);
      //validate
      StyleTypeDefinitions.FontStyle fontStyle = textProperties.getFontStyle();
      Assert.assertEquals(StyleTypeDefinitions.FontStyle.BOLDITALIC, fontStyle);
     
View Full Code Here

  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);
      //validate
      StyleTypeDefinitions.FontStyle fontStyle = textProperties.getFontStyle(Document.ScriptType.WESTERN);
      Assert.assertEquals(StyleTypeDefinitions.FontStyle.BOLDITALIC, fontStyle);
     
View Full Code Here

  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);
View Full Code Here

  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);
     
View Full Code 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"));

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

  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);
View Full Code Here

  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);
View Full Code Here

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