在vsto中唯一的excel工作簿标识符。

时间:2022-02-21 20:43:02

I'm busy with a .net excel vsto addin and came across the issue of the ribbon being "shared" across multiple instances of excel. I got past that by assigning a unique identifier to the custom document properties when the document loads and no key exists. This works fine.

我正忙于使用。net excel vsto插件,遇到了在多个excel实例之间“共享”丝带的问题。通过为自定义文档属性分配唯一标识符(当文档装载时,不存在键),我克服了这个问题。这是很好。

I then use this unique identifier to save / load ribbon settings for the specific workbook. These keys and settings are then saved against the unique identifier in a SQL express localdb. Still fine.

然后,我使用这个唯一标识符为特定的工作簿保存/加载丝带设置。然后根据SQL express localdb中的唯一标识符保存这些键和设置。还好。

The problem is now that in the event of someone duplicating the excel document both these documents obviously then have the same identifier in the document properties which in turn causes updates in both document to update the same settings in the database.

现在的问题是,如果有人复制了excel文档这两个文档,那么很明显,文档属性中的标识符是相同的,这反过来又会导致两个文档中的更新来更新数据库中的相同设置。

I've searched, and it seems the answer is no, but is there any unique key/name/field/code that I can use that is unique between files / workbooks?

我已经搜索过了,看起来答案是否定的,但是在文件/工作簿之间是否有唯一的键/名/字段/代码可以使用?

1 个解决方案

#1


1  

I checked using the Open XML SDK 2.5 Productivity Tool and I think I can safely say that no, there are no such ID.

我使用Open XML SDK 2.5生产率工具进行了检查,我认为我可以放心地说没有,没有这样的ID。

i created an xlsx file, then made a copy, saved the copy, and compared both files with the tool. The only thing that differs between both files is a time stamp (dcterms:modified in /docProps/app.xml)

我创建了一个xlsx文件,然后创建了一个副本,保存了副本,并将两个文件与工具进行了比较。两个文件之间唯一不同的是时间戳(dcterms:在/docProps/app.xml中修改)

The full path suggested by PetLahev is probably the way to go.

佩拉赫夫建议的完整道路可能是前进的道路。

#1


1  

I checked using the Open XML SDK 2.5 Productivity Tool and I think I can safely say that no, there are no such ID.

我使用Open XML SDK 2.5生产率工具进行了检查,我认为我可以放心地说没有,没有这样的ID。

i created an xlsx file, then made a copy, saved the copy, and compared both files with the tool. The only thing that differs between both files is a time stamp (dcterms:modified in /docProps/app.xml)

我创建了一个xlsx文件,然后创建了一个副本,保存了副本,并将两个文件与工具进行了比较。两个文件之间唯一不同的是时间戳(dcterms:在/docProps/app.xml中修改)

The full path suggested by PetLahev is probably the way to go.

佩拉赫夫建议的完整道路可能是前进的道路。