Compatibility with WPS Office et.exe: ensure AppDomain created like excel.exe
Hello Excel-DNA team,
I'm opening this issue to discuss improving compatibility with WPS Office, specifically its spreadsheet component et.exe. Currently, it appears that the Excel-DNA runtime loader does not create an AppDomain when running undering et.exe(the main process for WPS Spreadsheets), where as it does so correctly for Microsoft Excel's excel.exe.
Verification Method and Observations
To pinpoint the root cause of the issue, I conducted a critical test: temporarily renaming the WPS Spreadsheets process et.exe to excel.exe.
1、Test Result: After renaming, the Excel-DNA add-in loaded and ran normally within WPS Office, exhibiting behavior consistent with its operation in Microsoft Excel.
2、Inference: This result strongly suggests that the current Excel-DNA runtime loader determines whether to initialize the AppDomain and related environment by checking the host process's image name. Since et.exe is not on its recognized whitelist, it is ignored, preventing the add-in from functioning properly.
3、Suggested Solution and Questions
Based on the above test, the most straight forward and effective solution would be to modify the function responsible for identifying the host process in the runtime loader (e.g., IsRunningOnClusteror a similar function), adding et.exe to the whitelist.
I noticed a potential function in the code (or similar logic) and suggest modifying its condition as follows:
// Suggested code modification: Add recognition for "et.exe" in the condition
BOOL IsRunningOnCluster()
{
// Our check is to see if the current process is called Excel.exe.
// Hopefully this doen't change soon.
TCHAR hostPathName[MAX_PATH];
DWORD count = GetModuleFileName(NULL, hostPathName, MAX_PATH);
std::wstring hostPath = hostPathName;
StripPath(hostPath);
if (CompareNoCase(hostPath, L"EXCEL.EXE") == 0 || CompareNoCase(hostPath, L"ET.EXE") == 0)
{
return false;
}
return true;
}
What I'd like to confirm with you is: 1.Is this modification technically feasible and reasonable?
2.Could this change introduce any potential compatibility risks or side effects?
3.Are there any other more recommended or elegant approaches to implementation? Thank you for considering this enhancement.
Thank you - that's a reasonable suggestion and I will have a closer look.
Thank you - that's a reasonable suggestion and I will have a closer look.
Thank you very much for your response and the time spent on this issue . We truly appreciate your attention to it. Please keep us posted on any final decisions or conclusions regarding this matter. We are eager to hear about the outcome.
OK - I've incorporated the change. Could you test it from the NuGet package v. 1.9.0-rc6 ? There are some other cases where we check for the Excel process name, but those relate to how the debugger is set up and have some workarounds. I'm going to leave those unchanged for now, but am happy to keep this issue open for future improvements and feedback.
OK - I've incorporated the change. Could you test it from the NuGet package v. 1.9.0-rc6 ? There are some other cases where we check for the Excel process name, but those relate to how the debugger is set up and have some workarounds. I'm going to leave those unchanged for now, but am happy to keep this issue open for future improvements and feedback.
Thanks, we've tested v1.9.0-rc6, and it works perfectly. Happy to keep the conversation going!
https://gitee.com/Charltsing/excel-dna-for-wpspersonal
几年前写的兼容WPS个人版的ExcelDna修改版。 只有中文说明
A few years ago, I wrote a modified version of ExcelDna that is compatible with WPS Personal Edition. Only Chinese instructions are available
WPS个人版在加载com插件的时候采用白名单规则,需要预先在注册表写入插件相关的clsid。由于Exceldna的的Ribbon、CTP等功能采用动态clsid注册,因此原版的ExcelDna无法方便地支持WPS个人版。为了符合WPS个人版的白名单注册机制,并保持注册表的整洁,本项目修改了原版ExcelDna的部分代码,将动态注册改为固定的clsid注册机制,可以方便地在WPS个人版的白名单规则下加载Exceldna开发的xll插件
WPS Personal Edition adopts a whitelist rule when loading com plugins, which requires pre writing the plugin related CLSID in the registry. Due to the use of dynamic CLSID registration for features such as Ribbon and CTP in Excel DNA, the original Excel DNA cannot easily support WPS Personal Edition. In order to comply with the whitelist registration mechanism of WPS Personal Edition and maintain the cleanliness of the registry, this project has modified some code of the original ExcelDna, changing the dynamic registration to a fixed CLSID registration mechanism, which can easily load the XLL plugin developed by ExcelDNA under the whitelist rules of WPS Personal Edition.
我不清楚这几年ExcelDna和WPS有什么新的变化,但是你可以参考我对它的修改来完善对WPS个人版的支持
I'm not sure what new changes ExcelDna and WPS have made in recent years, but you can refer to my modifications to improve its support for WPS Personal Edition
it is code modified code.zip
我不想新开一个issue,因为做完这个工作之后,我就再也没有从事ExcelDna方面的开发。我也没有时间维护它。所以,我把相关信息留在这个帖子里面,以后靠大家把ExcelDna发扬光大了