Excel中的DDE信息 [英] DDE information in Excel

查看:195
本文介绍了Excel中的DDE信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    我编写了一个程序来使用Apache POI读取excel文件,该程序可以正常工作.下一部分是实现-拒绝读取包含DDE链接/信息的excel文件.

我通过以下链接阅读了有关DDE的信息

    预先感谢

解决方案

对于 XSSF ,可以获取List .apache.org/apidocs/org/apache/poi/xssf/model/ExternalLinksTable.html"rel =" nofollow noreferrer>来自 XSSFWorkbook 的外部链接表,使用 ExternalLinksTable ,每个 1.1/org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExternalLink.java"rel =" nofollow noreferrer> CTExternalLink poi.apache.org/apidocs/org/apache/poi/xssf/model/ExternalLinksTable.html#getCTExternalLink--"rel =" nofollow noreferrer> ExternalLinksTable.getCTExternalLink ,然后检查是否 DDE 链接在Excel中看起来像 = ddeapp |'parameters !! reference .因此,我们需要将 DDE 链接与其他链接区别开来,并且仅拒绝读取excel文件,如果其中包含" 确实 DDE 链接.使用 = ddeapp |'parameters'!reference .如果用户不专心并且是管理员,那么使用这样的公式可能会做真正的坏事和危险的事情.例如: = cmd |'/C control'!anyname .这将在Windows中打开系统控制应用程序,如果用户是管理员,那么它将允许更多...

由于 DDE 是来自IT的新石器时代的古老技术,因此目前尚无以有效方式使用 DDE 的良好示例.您需要一个 ddeapp ,它是一个允许通过 DDE 进行联系并返回值的应用程序.此 youtube视频:DTN IQFeed的DDE链接设置显示了一个示例.

     I wrote a program to read excel files using Apache POI which is working as expected. Next part is to implement - "To reject reading excel file if it contains DDE links/information.

I read about DDE information via below links

     Thanks in Advance

解决方案

For XSSF one could get the List of ExternalLinksTables from the XSSFWorkbook using XSSFWorkbook.getExternalLinksTable.

Then iterate through that List, get CTExternalLink for each ExternalLinksTable using ExternalLinksTable.getCTExternalLink and then check whether CTExternalLink.isSetDdeLink is true. If so, we have a DDE link there.

External links like ='C:\Users\Paul\Documents\[2014 Budget.xlsx]Details'!$R$7 or ='http://teamsite.company.com/corporate/[MySpreadsheet.xlsx]‌​Sheet1'!F4 have nothing to do with DDE. There is no danger while using such links and so no reason to "reject reading excel file if it contains" such links. A DDE link looks like =ddeapp|'parameters'!reference in Excel. So we need to differ DDE links from others and only "reject reading excel file if it contains" really DDE links. Using CTExternalLink.isSetDdeLink we are able to do this differentation.

I suspect the requirement "reject reading excel file if it contains DDE links" is about avoiding cell formulas like =ddeapp|'parameters'!reference in Excel. Using such formulas one could do really bad and dangerous things if the user is not attentively and is administrator. Example: =cmd|'/C control'!anyname. This will open system control application in Windows and if the user is administrator, then it would allow much more...

Since DDE is ancient technology from neolithic of IT, there are currently no good examples for using DDE in a productive way. You need a ddeapp which is a application which allows contact via DDE and returns a value then. This youtube video: DDE Link Setup for DTN IQFeed shows an example.

这篇关于Excel中的DDE信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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