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

suggestion - encode_for_xl(x::Any) = "$x" #15

Open
Lincoln-Hannah opened this issue Oct 30, 2023 · 2 comments
Open

suggestion - encode_for_xl(x::Any) = "$x" #15

Lincoln-Hannah opened this issue Oct 30, 2023 · 2 comments

Comments

@Lincoln-Hannah
Copy link

would you consider replacing

encode_for_xl(x::Any) = throw("Cannot encode variable of type $(typeof(x))")

with

encode_for_xl(x::Any) = "$x"

As it is, if there is one cell in a table that isn't one of the 17 or so supported types (lines 277-296), the whole table fails.
With this change - the table will be written. Any cells not of the 17 supported types will use Julia's default string display.

For example, I have code to convert a Struct to tables with 2 columns (Field Name, Field Value) but some of the Struct fields are enum types. This isn't a supported type so causes the table to fail in Excel. With the above change the enum is printed as a string.

@PGS62
Copy link
Owner

PGS62 commented Nov 7, 2023

Hi
I think the way for you to handle this is to import the function JuliaExcel.encode_for_xl and add a method to handle your enumeration. Here's an illustration:

image

@PGS62
Copy link
Owner

PGS62 commented Nov 7, 2023

I just saved that workbook to
https://1drv.ms/x/s!AlVTEdRItFFCqOleXPc2P31Gm3hbvw?e=FTj5of
(best to "Open in Desktop App")

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

2 participants