Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support future function call with "_xlfn." prefix in formula for compatibility #4815

Open
2 tasks done
catssay opened this issue Mar 12, 2025 · 2 comments
Open
2 tasks done
Labels
backlog We are not actively seeing into this.

Comments

@catssay
Copy link

catssay commented Mar 12, 2025

Initial checklist

  • Is this really a problem?
  • I have searched the Github Issues for similar issues, but did not find anything.

Problem

Univer does not correctly recognize the "_xlfn." prefix in formulas, even when the corresponding function exists in Univer. For example, in the formula "_xlfn.STDEV.S(Returns!C3:C253)", the function "STDEV.S" is already available in Univer. The "_xlfn." prefix indicates that the formula originates from a newer version of Excel and that the function may not exist in the current version. However, since the function is present in Univer, the prefix should be handled appropriately.

For more info about "_xlfn.":
https://libxlsxwriter.github.io/working_with_formulas.html
https://learn.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/5d1b6d44-6fc1-4ecd-8fef-0b27406cc2bf?redirectedfrom=MSDN

@jikkai
Copy link
Member

jikkai commented Mar 12, 2025

This is a relatively low-priority task with no plans for implementation in the short term. We will add it to the backlog.

@jikkai jikkai added the backlog We are not actively seeing into this. label Mar 12, 2025
@catssay
Copy link
Author

catssay commented Mar 12, 2025

Sure.

If anyone encounters this issue, they can register functions with the same name in unver using the prefix "_XLFN" (ensure it's uppercase) for compatibility.

For example, to register the function "_XLFN.STDEV.S", set its function body to use StdevS, which is available in the engine-formula package:

Using UniverSheetsCorePreset

presets: [
    UniverSheetsCorePreset({
        formula: {
            function: [[StdevS, "_XLFN.STDEV.S"]],
        }
    })
]

Using UniverFormulaEnginePlugin directly

univer.registerPlugin(UniverFormulaEnginePlugin, {
    function: [[StdevS, "_XLFN.STDEV.S"]]
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We are not actively seeing into this.
Projects
None yet
Development

No branches or pull requests

2 participants