Examples of TableBuilder


Examples of org.odftoolkit.simple.table.Table.TableBuilder

      //TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      TextDocument doc = TextDocument.newTextDocument();
      Footer footer = doc.getFooter();
      //Table tab = footer.addTable();
     
      TableBuilder tb = footer.getTableBuilder();
      Table tab = tb.newTable();
     
      Assert.assertNotNull(tab);
      Assert.assertTrue(2 == tab.getRowCount());
      Assert.assertTrue(5 == tab.getColumnCount());
     
View Full Code Here

Examples of org.odftoolkit.simple.table.Table.TableBuilder

      //TextDocument doc = TextDocument.loadDocument(ResourceUtilities.getTestResourceAsStream("headerFooterHidden.odt"));
      TextDocument doc = TextDocument.newTextDocument();
      Footer footer = doc.getFooter();
      OdfElement odfEle = footer.getVariableContainerElement();
     
      TableBuilder tb = footer.getTableBuilder();
      Table tab = tb.newTable();
     
      Assert.assertNotNull(tab);
      Assert.assertTrue(2 == tab.getRowCount());
      Assert.assertTrue(5 == tab.getColumnCount());
     
View Full Code Here

Examples of org.qi4j.library.rest.common.table.TableBuilder

         try
         {
            JSONObject jsonObject = new JSONObject(jsonValue);

            JSONObject table = jsonObject.getJSONObject( "table" );
            TableBuilder builder = new TableBuilder(module);

            JSONArray cols = table.getJSONArray( "cols" );
            for (int i = 0; i < cols.length(); i++)
            {
               JSONObject col = cols.getJSONObject( i );
               builder.column( col.optString( "id" ),  col.getString( "label" ), col.getString( "type" ));
            }

            JSONArray rows = table.getJSONArray( "rows" );
            for (int i = 0; i < rows.length(); i++)
            {
               builder.row();
               JSONObject row = rows.getJSONObject( i );
               JSONArray cells = row.getJSONArray( "c" );
               for (int j = 0; j < cells.length(); j++)
               {
                  JSONObject cell = cells.getJSONObject( j );
                  Object value = cell.opt( "v" );
                  String formatted = cell.optString("f");

                  if (cols.getJSONObject( j ).getString( "type" ).equals("datetime") && value != null)
                     value = Dates.fromString( value.toString() );
                  else if (cols.getJSONObject( j ).getString( "type" ).equals("date") && value != null)
                     try
                     {
                        value = new SimpleDateFormat( "yyyy-MM-dd").parse( value.toString() );
                     } catch (ParseException e)
                     {
                        throw new ResourceException(e);
                     }
                  else if (cols.getJSONObject( j ).getString( "type" ).equals("timeofday") && value != null)
                     try
                     {
                        value = new SimpleDateFormat( "HH:mm:ss").parse( value.toString() );
                     } catch (ParseException e)
                     {
                        throw new ResourceException(e);
                     }

                  builder.cell( value, formatted );
               }
               builder.endRow();
            }

            return builder.newTable();
         } catch (JSONException e)
         {
            throw new ResourceException( Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY, e);
         }
      }
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.