Code Monkey home page Code Monkey logo

Comments (6)

Rick-Kirkham avatar Rick-Kirkham commented on July 28, 2024

Thanks, Cindy. We're looking into this. (Wondering why we have both a getById and a getItem.)

from office-js-docs-reference.

cindymeister avatar cindymeister commented on July 28, 2024

Hi Rick - Yes, I was wondering why, as well... Didn't trust myself to ask Juan, though At first, I thought they might be from different api sets, but I see both are 1.1.

from office-js-docs-reference.

Rick-Kirkham avatar Rick-Kirkham commented on July 28, 2024

I'm transferring this to office-js because its a bug in ContentControlCollection.getItem(). It should take the index of the CC in the collection, but instead it takes the ID of the CC. There's already a getByID() method that does this.

from office-js-docs-reference.

JuaneloJuanelo avatar JuaneloJuanelo commented on July 28, 2024

@Rick-Kirkham : @cindymeister is right, the documentation is misleading. This one needs to be modified.

and now to add more details.

  1. the getItem methods in Office.js universally get an item within the collection by ID. This is true in Word and in Excel. In the documentation we INCORRECTLY say its by Index.
  2. The getItemAt methods in Office.js are the ones used for getting an item by its position in the collection. Given that in some conditions for content controls is very confusing in Word to determine order, we did not implemented this method for the contentControls collection.
  3. In the case of Word it was, effectively, not needed since we already have a getByID method on the control collection, at the time we only added this method to be consistent with the rest of the API.
  4. Finally getItem, as Cindy refers DO work with content control IDs, who happen to [ultimately] be numbers. (and read only). They are automatically assigned by Word and cannot be changed programmatically. We handle this different than in the COM API, although there is also a "stringified" number.

Bottom line I am assigning back to Ricky to update the docs!

Thanks @cindymeister !

-Juan.

from office-js-docs-reference.

Rick-Kirkham avatar Rick-Kirkham commented on July 28, 2024

Looks like there was some internal miscommunication about this issue. I've transferred it back to the reference documentation repo.

from office-js-docs-reference.

Rick-Kirkham avatar Rick-Kirkham commented on July 28, 2024

This is fixed in the source file. Several other Collection classes in Word and Excel needed the same fix. The process of publishing a fixed API description for the Rich APIs is longer than for Common APIs, but I believe the fix should be published in the next couple of weeks.

from office-js-docs-reference.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.