com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class TableAbsorber



  • public class TableAbsorber
    extends Object

    Represents an absorber object of table elements. Performs search and provides access to search results via TableAbsorber.TableList collection.


     The example demonstrates how to find table on the first PDF document page and replace the text in a table cell.
     
            // Open document
            Document doc = new Document("D:\\Tests\\input.pdf");
            // Create TableAbsorber object to find tables
            TableAbsorber absorber = new TableAbsorber();
            // Visit first page with absorber
            absorber.visit(doc.getPages().get_Item(1));
            // Get access to first table on page, their first cell and text fragments in it
            TextFragment fragment = absorber.getTableList().get_Item(0).getRowList().get_Item(0).getCellList().get_Item(0)
                    .getTextFragments().get_Item(1);
            // Change text of the first text fragment in the cell
            fragment.setText("hi world");
            // Save document
            doc.save("D:\\Tests\\output.pdf");
     
    • Constructor Detail

      • TableAbsorber

        public TableAbsorber(TextSearchOptions textSearchOptions)

        Initializes a new instance of the TableAbsorber with text search options.

        Parameters:
        textSearchOptions - Text search options
        Performs searching for tables and provides access to the tables via TableList object.
      • TableAbsorber

        public TableAbsorber()

        Initializes a new instance of the TableAbsorber.


        Performs searching for tables and provides access to the tables via TableList object.
    • Method Detail

      • getTextSearchOptions

        public TextSearchOptions getTextSearchOptions()

        Gets text search options.


        Allows to define several options that will be used during search text containing in tables.
        Returns:
        TextSearchOptions object
      • setTextSearchOptions

        public void setTextSearchOptions(TextSearchOptions value)

        Gets or sets text search options.


        Allows to define several options that will be used during search text containing in tables.
        Parameters:
        value - TextSearchOptions object
      • getTableList

        public com.aspose.ms.System.Collections.Generic.IGenericList<AbsorbedTable> getTableList()

        Returns readonly IList containing tables that were found

        Returns:
        IGenericList<AbsorbedTable> object
      • visit

        public void visit(Page page)

        Extracts tables on the specified page


         The example demonstrates how to extract table on the first PDF document page.
         
         // Open document
         Document doc = new Document(@"D:\Tests\input.pdf");
         // Create TableAbsorber object to find tables
         TableAbsorber absorber = new TableAbsorber();
         // Visit first page with absorber
         absorber.visit(pdfDocument.getPages.get_item(1));
         // Get access to first table on page, their first cell and text fragments in it
         TextFragment fragment = absorber.getTableList().get_item(0).getRowList.get_item(0).getCellList().get_item(0).getTextFragments.get_item(1);
         // Change text of the first text fragment in the cell
         fragment.setText ("hi world");
         // Save document
         doc.save(@"D:\Tests\output.pdf");  
         
        Parameters:
        page - Pdf pocument page object.