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

How to pass a string with value "default" as a parameter? #142

Open
pillowfication opened this issue Oct 21, 2024 · 1 comment
Open

How to pass a string with value "default" as a parameter? #142

pillowfication opened this issue Oct 21, 2024 · 1 comment

Comments

@pillowfication
Copy link

pillowfication commented Oct 21, 2024

Whenever I try to pass a value of "default" into a function, it seems to get ignored.

const winax = require('winax')
const excel = new winax.Object('Excel.Application', { activate: true })

excel.Workbooks.Add()
excel.Workbooks.Item(1).SaveAs('default')
// Instead of saving as "default.xlsx", it saves as the default name of "Book1.xlsx"
// as if `.SaveAs()` was called without parameters.

excel.Workbooks.Add()
excel.Workbooks.Item(2).SaveAs('asdf')
// This saves as "asdf.xlsx" as expected

I've tried the following:

workbook.SaveAs('default')

workbook.SaveAs(new winax.Variant('default', 'string'))

workbook.SaveAs(winax.cast('default', 'string'))
@pillowfication
Copy link
Author

pillowfication commented Oct 21, 2024

Seems like this method is responsible for checking if the value is equal to "default".

inline bool IsDefault() {

If this behavior is necessary, is it possible to change the string to something that wouldn't ever conflict? I really need to pass a string of "default".

// Some very unique string
winax.Default = '{{WINAX_DEFAULT_PARAM}}'
const winax = require('winax')

// This passes a string with value "default"
workbook.SaveAs('default')

// This uses the default value of the parameter
workbook.SaveAs(winax.Default)

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

No branches or pull requests

1 participant