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

push! entry #13

Closed
rnaldooo opened this issue Dec 2, 2022 · 1 comment
Closed

push! entry #13

rnaldooo opened this issue Dec 2, 2022 · 1 comment

Comments

@rnaldooo
Copy link

rnaldooo commented Dec 2, 2022

im using Clipper when entry push! line return error

using Clipper
polygon = IntPoint[]
push!(polygon, IntPoint(348,257))

┌ Error: Result of type Vector{IntPoint} could not be encoded for return to Excel.
└ @ JuliaExcel C:\Users\reinaldo.julia\packages\JuliaExcel\Y1cgX\src\JuliaExcel.jl:148

@PGS62
Copy link
Owner

PGS62 commented Dec 4, 2022

The problem is that your call to push! returns a Vector{IntPoint} and the relevant function of JuliaExcel (namely encode_for_xl) does not know how to encode that for display in an Excel worksheet. So a solution would be to add a method to encode_for_xl that handles Vector{IntPoint}, by converting the input to Matrix{Int64} and encoding that.

This code achieves that:

import JuliaExcel.encode_for_xl
encode_for_xl(p::Vector{IntPoint}) = encode_for_xl(hcat([p[i].X for i in eachindex(p)],[p[i].Y for i in eachindex(p)]))

image

@PGS62 PGS62 closed this as completed Feb 6, 2023
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