需要帮助! :具有多个TableDefinitionParts的工作表导致由于Uri命名而导致问题。 [英] HELP NEEDED! : Worksheet with multiple TableDefinitionParts causes issue due to Uri naming.

查看:94
本文介绍了需要帮助! :具有多个TableDefinitionParts的工作表导致由于Uri命名而导致问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用  TableDefinitionPart创建TableDefinitionPart tdp = worksheetpart.AddNewPart< TableDefinitionPart>()会导致在命名约定(table.xml,table2.xml,...,tablea.xml等)之后添加表。 )。  这些Uri路径使用十六进制值创建
,但实际表xml中的id是UInt32(1,2,3,...等)。  如果我查看了12个表格,那么带有部分名称和ID的内容会在Excel中混淆。  所以有两个问题: 是否有可能
来控制创建(添加)零件的名称(Uri)。  如果没有,无论如何都要控制SDK如何选择对表格进行编号(即不要使用十六进制)。

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?

提前致谢。

推荐答案

根据我的测试,在我看来,我们不能通过Open XML更改表的名称(Uri)。

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

首先,TableDefinitionPart的Uri属性是只读的。

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

其次,我创建了一个新的excel文件并添加了一些表,然后检查名称,名称是否正确。 (例如table10.xml,table12.xml)

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)

之后,我检查Open XML SDK Productivity Tool中的代码,并将所有代码复制到控制台应用程序,然后运行它。但是,我检查表的名称,名称是不同的。它基于十六进制值。 (例如tablea.xml,tableb.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)

所以,我认为它是基于OpenXML的规范而我们无法改变它。

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

最好的问候

Starain


这篇关于需要帮助! :具有多个TableDefinitionParts的工作表导致由于Uri命名而导致问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆