none
HELP NEEDED! : Worksheet with multiple TableDefinitionParts causes issue due to Uri naming. RRS feed

  • Question

  • Creating a TableDefinitionPart with TableDefinitionPart tdp = worksheetpart.AddNewPart<TableDefinitionPart>() causes tables to be added following the naming convention (table.xml, table2.xml, ..., tablea.xml, etc.).  These Uri paths are created with hex values, though the id in the actual table xml is UInt32 (1,2,3,...,etc.).  It appears if I go over 12 tables then something with the name of the part and ids gets confused inside of Excel.  So two questions:  Is there any way possible to control the name (Uri) of the part when it is created(added).  If not, is there anyway to control how the SDK is choosing to number the tables (i.e. don't use hex).

    If none of those options is viable, can anyone think of any other workaround?

    Thanks in advance.

    Tuesday, December 9, 2014 5:53 PM

All replies

  • Hi,

    Base on my test, in my opinion, we can’t change the table’s name (Uri) through Open XML.

    First, the Uri property of TableDefinitionPart is read-only.

    Secondly, I created a new excel file and add some tables, then check the name, the names are correct. (e.g. table10.xml, table12.xml)

    After that I check the code in Open XML SDK Productivity Tool and copy all the code to a console application, then run it. However I check the name of table, the names are different. It bases on the hex value. (e.g. tablea.xml, tableb.xml)

    So, I think it is based on specification of OpenXML and we can't change it.

    Best Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, December 10, 2014 9:34 AM
    Moderator