Excel DDE Commands
! https://zhuanlan.zhihu.com/p/635569763Excel DDE Commands
连接参数
Application: Excel
Topic:
System: 整个应用。
指定 worksheet。
我使用的是 .NET 组件 Specshell.NDde
private DdeClient _ddeClient;
public void Init()
{
try
{
_ddeClient = new DdeClient("EXCEL", "System");
_ddeClient.Context.Encoding = System.Text.Encoding.Default;
_ddeClient.Connect();
}
catch (Exception ex)
{
log.Error(ex);
}
}
public void Execute(string cmd, bool needEsc = false)
{
if (needEsc)
{
_ddeClient.TryExecute("", 10);
}
_ddeClient.TryExecute(cmd, 5);
}
public void Dispose()
{
try
{
_ddeClient?.Disconnect();
}
catch { }
}DDE commands
[*]命令大小写不敏感(case insensitivity)
[*]命令可以带括号,也可以不带括号
=
Command说明DescriptionApplication commands激活应用activate the application关闭应用quit the applicationWorkbook commands激活指定的文档activate a workbook新建一个 workbooknew a workbook打开一个 workbookopen a workbook保存文档save as a workbook关闭文档close a workbook关闭文档close a workbookWorksheet commands激活一个 worksheetactivate a worksheet新建一个 worksheetnew a worksheet移动到上一个 worksheetmove to the previous worksheet移动到下一个 worksheetmove to the next worksheet移动一个 worksheetmove a worksheet命名一个 worksheetrename a worksheet删除一个 worksheetdelete a worksheet打开插入对话框open the insert dialogdata commands清除当前选择的值clear selection values复制。copy selection values删除当前选择的单元delete selection values发送一个 Escape 键?send the escape key?插入insert粘贴paste粘贴到指定的单元paste to the cells选择单元select cells选择行select rows:R")]相对位置,选择下一行select a relative row")]相对位置,选择下一行select a relative row设置值set a value设置字体set font设置单元格式set format of cells设置列宽set width of columns隐藏/显示列hide/un-hide columns设置列宽set height of rows隐藏/显示行hide/un-hide rows
[*]: 下方的单元会上移。 ↩︎
[*]: 支持 Range 的粘贴。 ↩︎
来源:https://www.cnblogs.com/steven-yang/archive/2023/06/08/17466313.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!
页:
[1]