Package com.aspose.words

Examples of com.aspose.words.Table


    // Load the document.
    Document doc = new Document("data/tableDoc.doc");

    // Get the first and second table in the document.
    // The rows from the second table will be appended to the end of the first table.
    Table firstTable = (Table)doc.getChild(NodeType.TABLE, 0, true);
    Table secondTable = (Table)doc.getChild(NodeType.TABLE, 1, true);

    // Append all rows from the current table to the next.
    // Due to the design of tables even tables with different cell count and widths can be joined into one table.
    while (secondTable.hasChildNodes())
        firstTable.getRows().add(secondTable.getFirstRow());

    // Remove the empty table container.
    secondTable.remove();

    doc.save("data/AsposeJoinTables.doc");
  }
View Full Code Here


  {
    // Load the document.
    Document doc = new Document("data/tableDoc.doc");

    // Get the first table in the document.
    Table firstTable = (Table)doc.getChild(NodeType.TABLE, 0, true);

    // We will split the table at the third row (inclusive).
    Row row = firstTable.getRows().get(2);

    // Create a new container for the split table.
    Table table = (Table)firstTable.deepClone(false);

    // Insert the container after the original.
    firstTable.getParentNode().insertAfter(table, firstTable);

    // Add a buffer paragraph to ensure the tables stay apart.
    firstTable.getParentNode().insertAfter(new Paragraph(doc), firstTable);

    Row currentRow;

    do
    {
        currentRow = firstTable.getLastRow();
        table.prependChild(currentRow);
    }
    while (currentRow != row);

    doc.save("data/AsposeSplitTable.doc");
  }
View Full Code Here

    // Load the document.
    Document doc = new Document("data/tableDoc.doc");

    // Get the first and second table in the document.
    // The rows from the second table will be appended to the end of the first table.
    Table firstTable = (Table)doc.getChild(NodeType.TABLE, 0, true);
    Table secondTable = (Table)doc.getChild(NodeType.TABLE, 1, true);

    // Append all rows from the current table to the next.
    // Due to the design of tables even tables with different cell count and widths can be joined into one table.
    while (secondTable.hasChildNodes())
        firstTable.getRows().add(secondTable.getFirstRow());

    // Remove the empty table container.
    secondTable.remove();

    doc.save("data/AsposeJoinTables.doc");
  }
View Full Code Here

  public static void main(String[] args) throws Exception
  {
    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);

    Table table = builder.startTable();
    builder.insertCell();

    // Set the borders for the entire table.
    table.setBorders(LineStyle.SINGLE, 2.0, Color.BLACK);
    // Set the cell shading for this cell.
    builder.getCellFormat().getShading().setBackgroundPatternColor(Color.DARK_GRAY);
    builder.writeln("Cell #1");

    builder.insertCell();
View Full Code Here

TOP

Related Classes of com.aspose.words.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.