Excel 中的 DDE 信息 [英] DDE information in Excel
问题描述
我编写了一个程序来使用 Apache POI 读取 excel 文件,该程序按预期工作.下一部分是实现-拒绝读取包含DDE链接/信息的excel文件.
我通过以下链接阅读了有关 DDE 的信息
- https://en.wikipedia.org/wiki/Dynamic_Data_Exchange
- http://jdde.pretty-tools.com/
https://v8doc.sas.com/sashtml/win/z3ples.htm
我无法获得有关如何
的信息一个带有 DDE 信息的 excel 文件.
识别包含DDE信息的excel文件
如果有人能帮助我理解以上两点就好了.
提前致谢
对于 XSSF
可以得到 ExternalLinksTables 来自 XSSFWorkbook
使用 XSSFWorkbook.getExternalLinksTable.
然后遍历那个List
,得到CTExternalLink 使用 ExternalLinksTable.getCTExternalLink 然后检查是否CTExternalLink.isSetDdeLink 为 true
.如果是这样,我们在那里有一个 DDE
链接.
外部链接,如 ='C:\Users\Paul\Documents\[2014 Budget.xlsx]Details'!$R$7
或 ='http://teamsite.company.com/corporate/[MySpreadsheet.xlsx] Sheet1'!F4
与 DDE
无关.使用此类链接没有危险,因此没有理由拒绝读取包含"此类链接的 excel 文件.DDE
链接在 Excel 中看起来像 =ddeapp|'parameters'!reference
.因此,我们需要将 DDE
链接与其他链接不同,并且仅拒绝读取 excel 文件,如果它包含"真的 DDE
链接.使用 CTExternalLink.isSetDdeLink 我们能够做到这一点.
我怀疑拒绝读取包含 DDE 链接的 excel 文件"的要求是关于避免在 Excel 中使用像 =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
- https://en.wikipedia.org/wiki/Dynamic_Data_Exchange
- http://jdde.pretty-tools.com/
https://v8doc.sas.com/sashtml/win/z3ples.htm
I could not get information on how
an excel file looks like with DDE information.
to identify an excel file that contains DDE information
It would be great if someone can help me in understanding the above two points.
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屋!