Open-XML-SDK
                                
                                 Open-XML-SDK copied to clipboard
                                
                                    Open-XML-SDK copied to clipboard
                            
                            
                            
                        'OpenXmlElementList' does not contain a definition for 'GetItem'
Missing method for getting item from OpenXmlElementList class.
Starting from version: 3.0.0
Working version: 2.20.0
Error CS1061 'OpenXmlElementList' does not contain a definition for 'GetItem' and no accessible extension method 'GetItem' accepting a first argument of type 'OpenXmlElementList' could be found (are you missing a using directive or an assembly reference?)
Can you share your code sample?
Did you try:
OpenXmlElementList list = ....;
var item = list[index];
There were a number of breaking changes from v2.x - not sure if this one got documented, but let me know if it works and I'll make sure the docs are updated.
Tried, seems to work. I was just not finding any breaking change in the docs regarding that method.
@twsouthwick what exactly is needed here? Code change or documentation?
Docs update
Docs update
How to do that??
Can you share your code sample?
Did you try:
OpenXmlElementList list = ....; var item = list[index];There were a number of breaking changes from v2.x - not sure if this one got documented, but let me know if it works and I'll make sure the docs are updated.
Where to write this??
@Babufrik123
https://github.com/OfficeDev/open-xml-docs/blob/main/docs/migration/migrate-v2-to-v3.md
Happy to take a PR to update that or any other doc changes :)
@Babufrik123
https://github.com/OfficeDev/open-xml-docs/blob/main/docs/migration/migrate-v2-to-v3.md
Happy to take a PR to update that or any other doc changes :)
Can u please explain in detail what exactly nedds to be done to use getitem().
OpenXmlElementList list = ....;
var item = list.GetItem(index);
to
OpenXmlElementList list = ....;
var item = list[index];
OpenXmlElementList list = ....; var item = list.GetItem(index);to
OpenXmlElementList list = ....; var item = list[index];
OpenXmlElementList list = ....; var item = list.GetItem(index);to
OpenXmlElementList list = ....; var item = list[index];
Hi twsouthwick, I still didnt unterstand, can u please give a step by step guide. Actually I m reading data from excel to data table using document open xml and there that getitem() is required.But due to latest version I m not able to use that.I m attaching the link of my code please refer that and share what to do.
https://www.aspsnippets.com/Articles/1463/Read-and-Import-Excel-data-to-DataTable-using-OpenXml-in-ASPNet-with-C-and-VBNet/
What I supplied is the only step needed. The call to GetItem needs to be changed to an indexer.
What I supplied is the only step needed. The call to GetItem needs to be changed to an indexer.
doc.WorkbookPart.SharedStringTablePart.SharedStringTable.ChildElements.GetItem(int.Parse(value)).InnerText
How will you rewrite this?
What I supplied is the only step needed. The call to GetItem needs to be changed to an indexer.
doc.WorkbookPart.SharedStringTablePart.SharedStringTable.ChildElements.GetItem(int.Parse(value)).InnerText
Help me rewrite this. U can see getitem here
What I supplied is the only step needed. The call to GetItem needs to be changed to an indexer.
doc.WorkbookPart.SharedStringTablePart.SharedStringTable.ChildElements.GetItem(int.Parse(value)).InnerText
Help me rewrite this. U can see getitem here
doc.WorkbookPart.SharedStringTablePart.SharedStringTable.ChildElements[int.Parse(value)].InnerText
Thanks @BazInTheAZ :) @Babufrik123 I'd recommend taking a look at some of C# specifications so you can understand the syntax here: https://learn.microsoft.com/dotnet/csharp/programming-guide/indexers