使用 VSTO 识别新的或已知的文档

发布于 2024-11-06 18:39:27 字数 404 浏览 1 评论 0原文

我从未使用过 VSTO,最近阅读了有关它的各种资料。所以我问一个理论问题。我正在尝试制作一个插件,它应该(使用它自己的功能区选项卡中的按钮)将文档上传到我的网站(就像幻灯片共享)。问题是该文件可能已经上传,而用户可能只是尝试更新它。

所以我需要一种方法来判断这个文件是否已经上传。我知道预测不可能 100% 准确,这就是为什么我要通过对话框询问用户,但我需要它相当聪明地提醒用户文件是否已经上传。

这种假设只能是客户端,具有某种数据库(在插件本身中)。 我想记录文件的名称,并据此我可以确定该文件是新的还是已经上传的。

您还有其他想法吗?也许有更聪明的方法来做到这一点?

附言。在 VS 2010 中使用最新版本的 VSTO 来处理 Office 2010。我的主要 .net 语言是 VB,但非常欢迎 C# 示例(如果有的话)。

I've never worked with VSTO and I've recently read all kinds of stuff about it. So I ask a theoretical question. I'm trying to make an addin which should (using buttons in it's own ribbon tab) upload the document to my website (it's like slideshare). The problem is that this file may be already uploaded and the user may be just trying to update it.

So I need a way to tell if this file has already been uploaded. I know the prediction can't be 100% accurate, that's why I'm going to ask the user with a dialog, but I need it to be fairly clever to alert the user if the file MAY BE is already uploaded.

This assumption can be client-side only, with a database of some sort (in the addin itself).
I thought of recording the file's name and based on this I can decide if the file is new or it's already uploaded.

Do you have any other ideas? Maybe there's more clever way to do this?

PS. Working on Office 2010 with the latest version of VSTO in VS 2010. My main .net language is VB but samples in C# are more than welcome (if you have ones).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

糖粟与秋泊 2024-11-13 18:39:27

在这种情况下我可能会做的是添加一个具有 GUID 值的文档变量或文档属性。

然后,当您推送文件时,服务器可以提取该属性,获取 guid 并轻松执行查找以查看该文档是否已经存在。

至少,这是标识文档的另一种方式(除了用户和文件名之外)。

What i'd probably do in that case is add a DOCUMENT VARIABLE or DOCUMENT PROPERTY with a value of a GUID.

Then when you push the file, the server could extract that property, get the guid and easily perform a lookup to see if the doc is already there.

At least, that'd be another way (other than say, user and filename) to id the document.

梦里兽 2024-11-13 18:39:27

您可以使用自定义属性,但在 PPT 中我会使用标签;用户无法看到/干预它们。

中引用了您的演示文稿

With oPres
    .Tags.Add "Uploaded", "YES"
    .Tags.Add "LastUploadDate", "some string you've formatted to taste"
    .Tags.Add "AnythingElse", "You'd like to record"
End With

假设在 oPres和

With oPres
    If .Tags("Uploaded") = "YES" Then
        ' nothing to do
    Else
        ' upload it
    End If
End With

You can use Custom Properties but in PPT I'd use tags instead; the user can't see/meddle with them.

Assuming a reference to your presentation in oPres

With oPres
    .Tags.Add "Uploaded", "YES"
    .Tags.Add "LastUploadDate", "some string you've formatted to taste"
    .Tags.Add "AnythingElse", "You'd like to record"
End With

and

With oPres
    If .Tags("Uploaded") = "YES" Then
        ' nothing to do
    Else
        ' upload it
    End If
End With
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文