Skip to content

Suppress COM add-in error popup when running under WPS Office#848

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-com-problem-wps-sheets
Draft

Suppress COM add-in error popup when running under WPS Office#848
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-com-problem-wps-sheets

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 29, 2026

WPS Office (KingSoft Spreadsheets, ET.exe) does not fully support the COM add-in loading mechanism Excel-DNA uses for ribbons and CTPs, causing a misleading error dialog on every load — even though worksheet functions work fine.

Changes

  • ExcelComAddInHelper.cs — Added IsRunningUnderWps() helper that detects the host process is ET.EXE (wrapped in try-catch for restricted environments), and added an else if branch in the catch (Exception ex) handler of LoadComAddIn to downgrade the log level from Error to Info when running under WPS.

This follows the exact same pattern already used for the Excel /K command-line switch:

if (Environment.CommandLine.Contains(" /K"))
{
    Logger.ComAddIn.Info("Load Ribbon/COM Add-In exception with /K in CommandLine \r\n{0}", ex.ToString());
}
else if (IsRunningUnderWps())
{
    Logger.ComAddIn.Info("Load Ribbon/COM Add-In exception under WPS Office \r\n{0}", ex.ToString());
}
else
{
    Logger.ComAddIn.Error(ex, "The Ribbon/COM add-in helper required by add-in {0} could not be registered...", ...);
}

The failure is still logged at Info level, so diagnostics are preserved without surfacing a confusing error dialog to end users.

Copilot AI linked an issue Apr 29, 2026 that may be closed by this pull request
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI changed the title [WIP] Fix COM problem in WPS Sheets Suppress COM add-in error popup when running under WPS Office Apr 29, 2026
Copilot AI requested a review from govert April 29, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COM problem in WPS Sheets

3 participants