Getting cell content in HTMLDocument

Hello, could someone tell me how to get the whole content of a cell in a table in a HTMLDocument?
I use the following code but I only get the text, I lose the styles, images...
HTMLDocument htmldocument = (HTMLDocument)jtpMain.getDocument();
Element element = htmldocument.getCharacterElement(jtpMain.getCaretPosition());
if(element == null)
return "";
String ls =element.getName();
while (element.getName() != "td" && element != null) {
element=element.getParentElement();
if(element == null)
return "";
int inic,end;
inic =element.getStartOffset();
end =element.getEndOffset();
String s = "";
int len = end - inic + 1;
if (len > 0)
try
s = htmldocument.getText(inic,len);
catch (Exception e)
e.printStackTrace();
return s;

Hi,
each element has an AttributeSet which contains all the styles directly associated with that element. In addition, certain style attributes might come from parent elements of that element or from a style sheet associated to the HTMLDocument object.
Depending on what you are about to do with the cell content, you either can iterate through the element structure to retrieve some or all style attributes from the elements mentioned above or you could use their HTML code.
Can you be a little more specific about what is the purpose of your inquiry?
Ulrich

Similar Messages

  • How the get the content of selected ALV cell??

    hello expert,
    after click one of the ALV lines, we want to get the cell content of this selected line? how to realize this? thanks/

    hi,
    it is pretty simple,
    in the methosd u declare for the click we use the events of the ALV.
    in that we have an attribute r_param.
    do this to get the value:
    FIELD-SYMBOLS:<l_value> TYPE ANY.
      ASSIGN r_param->index TO <l_value>.
    the clicked value will be in <l_value>.
    madhu.

  • Is it possible to use wildcards to match cell contents in an if statement?

    I need to return a ID along with some other information on a page by page basis, so that the information comes out linked by position.  I use a couple of loops and if statements to navigate through the document.  I am able to use exact matches of cell contents which is fine when the contents doesn't vary.  But the IDs, though they have a similar pattern, are all different. In a menu driven search, I am able to find what I need with '150^9^9^9^9^9-^9^9^9' But when I try putting this (or any number of [0-9], *, ? combinations) it fails.  Is it possible to use wildcards?  The symbol used for the match (==) makes me suspect that it is not possible and that only literal, exact matches will work.  But I wanted to check with the experts before giving up.
    Thanks
    pcbaz

    Thanks for the input.  You're right, a GREP search is much more efficient.  But what I'm trying to do and the circumstances here don't allow me, I think,  to go that route. I am trying to generate a list of values coming from several textframes on a single page and have them come out so that I can tell which values belong together.
    I'm using an inherited document with masters that were created 'manually';  the index numbering for textframes and tables is random. I navigate through the pages, looping through textframe indices asking ' does this textframe exist?' If so, I ask if it is a table -- if no, it is a simple textframe and I ask about the ID, if yes, I ask if the contents of cell (0,0) (invariant position and contents) are equal to the table I want..  I am sending the ID and other pieces of information from the table to one row of a new table on a new page.  So the ID and other information from a single page are linked by being in the same row.
    I know this a little 'off-normal' -- I'm using the search to navigate through the document and find things by location the way you do with a spreadsheet.  I have devised a work-around that helps me get around the fact that the ID is not invariant.  I create a list of the (exact) IDs from another document, equating them to a variable ('a').  I then loop through the list of IDs and ask if the contents of the textframe is equal to 'a'..This works o.k, unless there happens to be an extra space, a different kind of hyphen, etc. It would be so much easier if I could use the wildcards that work in a menu-driven text or GREP search in script just to ask about the contents of the textframe.
    Thanks again
    pcbaz (Peter BIerly)
    P.S. we have since rewritten the masters so this problem will not exist in the future -- we now know exactly which textframe and/or table indices to refer to to get any particular bits of information and don't need to ask questions about the contents.

  • Space in table cell content

    Hi,
    I want to add some space before and after the table cell content. I am using setIntercellSpacing() method to achieve that and I could get the required functionality. But its adding space in the Table Header also which looks odd. Is there any way to set the spacing only for the cell and not for the table header.
    Let me know if anyone has solution for this.
    Thanks and Regards,
    R.Vishnu Varadhan.

    I find this behaviour of setIntercellSpacing() very annoying, too. Why the hell did the Swing developers implement it that way?
    Nevertheless, you can create the desired effect by writing a custom cell renderer, but that is if course more work than that single method call.

  • Problem in cell content of alv grid ...

    hi all,
         i want to get the cell content of alv grid in the handle method of event data_changed of cl_gui_alv_grid,
    i using the following code ...
    METHOD on_data_changed.
    DATA : lv_value(30) TYPE c.
    CALL METHOD ER_DATA_CHANGED->GET_CELL_VALUE
      EXPORTING
        I_ROW_ID    = 3
       I_TABIX     =
        I_FIELDNAME = 'cname'                                                                                "" my column table
      IMPORTING
        E_VALUE     = lv_value.
    MESSAGE lv_value TYPE 'I'.
        ENDMETHOD.
    endclass.           
    but i cant get the value of cell content
    Edited by: parashuram on Oct 21, 2011 3:49 PM

    Try this way
        method handle_data_changed.
          perform handle_data_changed using er_data_changed.
        endmethod.
    form handle_data_changed using p_data_changed type ref to
                                   cl_alv_changed_data_protocol.
      data: ls_mod_cell  type lvc_s_modi,
              lv_value_dni type lvc_value.
      loop at p_data_changed->mt_mod_cells into ls_mod_cell.
        call method p_data_changed->get_cell_value
          exporting
            i_row_id    = ls_mod_cell-row_id
            i_fieldname = 'FINI_SUST' <== Your field
          importing
            e_value     = lv_value_dni .
      endloop.
    endform.

  • TableView auto resize columns based on header text width or cell content

    Is there a method on the tableview or tablecolumn to automatically resize based on the content of the hearder or data?
    If not what approach can used used with JavaFX to calculate the string width based on the current font?

    The table column size is inconsistent, I set the columns in the table view and the items in the initialize method. I execute a service and task from a button action that loads data into the list, if I don't reset the columns in the table view in the succeed method then each column is the same width regardless of the content in the cells. If I do reset the table columns in the succeed method then the columns are resized based on content.
    I don't think it should be a requirement to reset the columns just to get the column widths to set based on the content in the cells. Is there a method on the table column or view that will resize the cells based on the cell content? I would prefer the largest value; column header content or the longest cell content for a column.

  • Command links as column cell content...

    Hi
    I am trying to add command links as cell content. Clicking on one of the links will cause the outputText component located at the bottom to be updated.
    However, I can't differentiate the different links. Since the commandLink is generated for each row of data, the id generated for each commandLink component is the same. That is, I am getting the same ID when I call
    public void commandLinkActionListener(ActionEvent ae) {
    CoreCommandLink ccl = (CoreCommandLink) ae.getSource();
    System.out.println("commandLinkActionListener: " + ccl.getId());
    Is there any way to differentiate or pass unique data to the above action listener?
    The following is the code segment:
    <af:table emptyText="No items were found" value="#{MyTableBean.tableValue}"
    var="row" id="table">
    <af:column sortable="false" headerText="Name" formatType="text"
    id="nameColumn">
    <af:commandLink actionListener="#{MyTableBean.commandLinkActionListener}"
    partialSubmit="false" text="#{row.name}">
    </af:commandLink>
    </af:column>
    </af:table>
    <af:outputText value="Column Trigger: #{MyTableBean.text}" partialTriggers="nameColumn"/>
    Would appreciate any help on this.
    Thanks

    Found the answer from one of Frank's blog.
    public void commandLinkActionListener(ActionEvent ae) {
    CoreTable ct = (CoreTable) ae.getComponent().getParent().getParent();
    Object data = ct.getRowData();
    The data object is the type of object that you add to your List or CollectionModel.
    Note that the commandLink is a child of the column which is a child of the table.

  • ALV editable cell contents - transfer to own comp context without Enter

    Hi,
    Have WD ALV.  Some cells have been made editable.  Cell contents are only passed back to own component once user has pressed Enter.  There is a button with action on the view.  If this button and corresponding action is triggered without the user pressing enter first when maintaining the editable cell, the new cell contents are not available.
    Is there a way to manually trigger the frontend ALV contents to own component context to ensure working with what has been entered on-screen in ALV?  I seem to remember you can trigger a data check but not sure if this is the solution, will check, but grateful for any feedback in meantime.

    Hi there
    IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
    I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
    I'll copy the stuff to the wiki when I've got the browser sorted out.
    Cheers
    jimbp

  • Can InDesing flow cell contents across pages?

    I'm working in InDesign CS5 on a book project that contains a very long table (3 columns by 300+ rows over about 120 pages).  The cell contents is all text and the center columns' cells contain some very long passages (the left column contains dates and the right column is short source citations).  The table was originally created in Word Perfect -- I coverted it to an MS Word document, checked it and saved it, then imported it into ID using the Place command.  All goes along very smoothly until I get to a row where the text in the center cell is very long indeed -- too long to fit on less than one whole page, so ID forces it to the next whole page (see the screen shot below).  Problem is, this is intended to be a continuous table.  In MS Word, the text in the cell happily flows to the next page.  I need to do that in ID, but HOW?  Any advise is gratefully appreicated.  Thanks.  Kirk

    ID will not break a cell across a column or page boundary. About the only thing I can think of to do waht you want would be to add a row to the table, then adjust the height of the tall row manually so the cell goes overset and cut the excess, then paste into the new row.

  • Cell contents selected on focus in JTable

    I'm new to swing and trying to get the contents of a JTable cell to be selected when the cell receives focus. I've looked at the TableCellEditor interface and the like, but I just can't seem to get the hang of how it all fits together. Any hits would be appreciated. Thanks.

    There are several ways to do this, but here is one to get you started:
    First, subclass DefaultCellEditor. Here, I have duplicated all the constructors from DefaultCellEditor but only modified the one used for text.
    I have added a inner class, FocusEventHandler, to capture the focus events. In the focusGained method is the code to do the selectAll. (I use the invokeLater so that the selectAll happens after pending events are complete. A mouse click might be interpreted by the text box to position the cursor, so we want the selectAll to happen after that.)
    Then, in the constructor for text, I save the text box so the focusGained method knows which text box to selectAll for, register the event handler, and (optionally) change the ClickCountToStart.
    public class NewDefaultCellEditor extends javax.swing.DefaultCellEditor {
    javax.swing.JTextField saveTextField = null;
    // Event handler
    public class FocusEventHandler implements java.awt.event.FocusListener {
         public void focusGained(java.awt.event.FocusEvent e) {
              javax.swing.SwingUtilities.invokeLater(new Runnable () {public void run() {saveTextField.selectAll();}});
         public void focusLost(java.awt.event.FocusEvent e) {}
    // Constructors
    public NewDefaultCellEditor(javax.swing.JCheckBox checkBox) {
         super(checkBox);
    public NewDefaultCellEditor(javax.swing.JComboBox comboBox) {
         super(comboBox);
    public NewDefaultCellEditor(javax.swing.JTextField textField) {
         super(textField);
         saveTextField = textField; // save text field for later
         textField.addFocusListener(new FocusEventHandler()); // register event handler
         setClickCountToStart(1); // change # of mouse clicks to begin editing
    }Now you just have to tell the table to use this Cell Editor. One way to do this is:
    MyTable.getColumnModel().getColumn(0).setCellEditor(new NewDefaultCellEditor(new javax.swing.JTextField()));
    (this sets the editor for column 0)

  • Modifying the cell content based on input parameter from variable screen.

    I am trying to modify a cell content in the BEX Web Application Report based on the input parameter from the variable screen.
    I am already aware of how to change the cell content by creating a new ABAP class and inheriting CL_RSR_WWW_MODIFY_TABLE.
    I do not know how to get the input parameter variable from the variable screen in my custom class ZCL_RSR_WWW_MODIFY_TABLE. I am not very familiar with ABAP and would appreciate your help.
    Thanks
    Sowmini

    in the start method
    define a work area like line of n_r_data_set->N_SX_VERSION_20A_1-TXT_SYMBOLS
    loop at n_r_data_set->N_SX_VERSION_20A_1-TXT_SYMBOLS into <wa> ..
    endloop .
    This will have all the filter, variable values entered in the selection.
    Regards
    Raja

  • How can i get the content of JTextArea with out loosing Indentation.

    I am developing one mail sending application. I am getting mailid , from address, mail body from one Swing. In one JTextArea i am typing i have typed some matter. When i call the content of JTextArea using
    jtx.getText() method, i am getting all the content as one paragraph. That means there is no indentation which was there in TextArea.
    Please provide me some solution how can i get the content of JTextArea wiht out loosing indentation.

    And it was you who asked the question!

  • Get all content from iTouch to a new computer.

    My problem is very simple to explain, but I find no solution.
    My old computer is damaged and I cant use it anymore. So I bought a new one and I want to get all my stuff from the iTouch to iTunes on me new computer. After installing iTunes I actived in iTunes my iTouch for iTunes. In iTunes I get the massage that now two computers are actived (5 are possible).
    So I connect my iTouch with the wire to my computer and I get the massage that my iTouch is logical connected with an other iTunes libary. I get the only possibility to delete my iTouch and syncronize it with the content of the new iTunes libary.
    *My question is how can I get my content from the iPod touch to iTunes on my new computer?*

    Hi,
    Welcome to Apple discussions.
    So, in a perfect world, you would restore your library of valuable music from *your backed up files* to the library on your new PC, you know, the ones burnt to DVD/CD or on an external HD.
    This is the way iTunes works, it makes it perfectly clear and actively encourages users to *back up your music*.
    The iPod touch is not a back up device (nor is it advertised as one) it is a music player with a volatile memory that could actually disappear at anytime so it should not be trusted as a store for valuable files.
    To salvage your music you will have to use some 3rd party application on your PC/Mac (you fail to say) such as [Touch Copy|http://www.wideanglesoftware.com/touchcopy/index.html], Google for other options. This is not guaranteed to work but hopefully you will get your music back.
    Then back up.
    Good luck,
    Dud.
    *iPod touch* by the way, this an [ITOUCH|http://en.pasen.it/product_detail.php?id=36]

  • I could not found all music and videos in my laptop in itunes? how can i get all content to my itunes?

    hi i am using iphone 3gs 32gb. i installed itunes in my laptop but i couldnot found all files like music and videos present in my laptop. can anybody tel how to get all content? thanks you

    The songs that you downloaded on the iPad can be transferred to the computer when you sync with iTunes. For the music from your cousins computer - if they were purchased with his Apple ID - you can't sync them to your iTunes account.

  • My computer crashed and my itunes library only has my purchases which is 645 songs instead none of my play lists.  my 60g ipod has 1145 songs and all my playlists.  how do i get this content back to my itunes program

    my computer crashed and i had to reinstall intunes.  i have 1144 songs plus some playlists on my old 60g ipod.  my itunes library on my computer only has the songs that i purchased from itunes and none of playlists.  how do i get this content form my ipod back onto my itunes program on my computer.

    check out this post by Zevoneer.

Maybe you are looking for

  • Files copied from AFP share point are unwriteable by client

    This is the same issue as: http://discussions.apple.com/thread.jspa?messageID=8044984 Has anyone found a fix yet? Basically, when copying files from an AFP server, Leopard is not having the file inherit the permissions of the parent folder. It is inh

  • Adobe Flash Player for Samsung tablet?

    I recently purchased Samsung tablet. I need to take some courses that require Adobe Flash Player.  When I tried downloading the file I received an error message saying my device doesn't support the file.  I tried downloading the app with no luck.  Is

  • Need Info On Flash Output From Encore CS6

    I have CC 2014 and I normally produce videos for YouTube and DVD for my clients. I have no idea what Flash is, but I see that I can create a Flash version of a DVD project that plays just like a DVD. Will someone point me in the right direction on ho

  • Can I make iPhoto metadata keywords viewable for my PC friends?

    When I export JPEGs from iPhoto 7 and burn them to a CD, they keep all the keywords I have assigned to them as long as I read the CD on a Mac, but if I give the CD to someone using a PC, all the keywords are gone. I've read somewhere that Apple doesn

  • How do you install unmatched memory in macbooks?

    I have a early 2008 Black Mack Book.  I am currently running 2X2 ddr2 sdram 667 for a total of 4g memory. Ready through it the apple blogs say it will can actually use 6g?  How do you install this in a mac and were can I find that memory?