excelHtml5 formatting excel questions

excelHtml5 formatting excel questions

rogerchin85rogerchin85 Posts: 9Questions: 2Answers: 0

Even after reading some of the documentation on Office and XML, I cannot grasp how to code the jquery part. For example, if concatenating is allowed and how to select a range of cells.

Below is an example taking from the excelHtml5 documenation.

row c[r^="F"]

This selects column F of all rows. Is there a way to select a range of columns of all rows? So that I don't have 10 repeated jquery lines?

What does the ^ represent?

How do I select specific rows? In the Office OpenXML documentation, it states <row r="13"> and so I've tried row[r^="1"] c[r^="F"], but that didn't work.

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin

    What does the ^ represent?

    From the jQuery docs its a starts with selector.

    There is ends with as well ($=) but that's no good for selecting columns of data since 1, 11, 21, etc would match $=1).

    Perhaps the easiest way would be to select the rows and then loop over them, getting the required cell:

    $('row', sheet).each( function () {
      $('c', this).eq( columnIndex ). ... whatever.
    } );
    

    Its just jQuery selectors in the end. Its just that you are traversing an XML document rather than HTML.

    Allan

This discussion has been closed.