Skip to content

width % causes parser error #189

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

Open
BeanoKing opened this issue Mar 26, 2023 · 8 comments · May be fixed by #256
Open

width % causes parser error #189

BeanoKing opened this issue Mar 26, 2023 · 8 comments · May be fixed by #256

Comments

@BeanoKing
Copy link

I have a td tag that has a width attribute of 50% which creates this parsing error: InvalidCharacterError: The string contains invalid characters. Invalid XML name: @w

If I remove the % the parsing engine works fine. The exact markup I have that is causing the issue is:

Is this expected behavior and if so is there a workaround?

@mgiraldo
Copy link

i'm having the same problem. did you find out how to address this?

@nicolasiscoding
Copy link
Contributor

Keeping an eye on this- I contributed some of the code to handle the widths and percents is not something I was thinking about calculating since its relative to the page size. But if you know the page size + margins to draw a box, it would adding a function to convert percents into EMUs (I believe) https://stackoverflow.com/questions/20194403/openxml-distance-size-units

@BeanoKing
Copy link
Author

For my scenario it turned out I didn't need the % widths, but since it is valid CSS for a td it would be nice if the parser didn't error. I was fighting with it for a few hours trying to narrow down the issue and finally realized it was the % width causing it to crash.

@abhinovpankaj
Copy link

abhinovpankaj commented Aug 19, 2023

Facing the same, is there any solution to this?.
I removed all the occurances of Width:100% or Width:50% still getting the same error.

@CarlaMck77
Copy link

Try removing the spaces between the style fields. Let us know if it works for you

@maximesahagian
Copy link

Same issue here @BeanoKing , did you find a solution?

@BeanoKing
Copy link
Author

I didn't. Ended up moving to a paid solution instead from Apose

@ad-si ad-si linked a pull request Jan 21, 2025 that will close this issue
@ad-si
Copy link

ad-si commented Jan 21, 2025

@BeanoKing, @mgiraldo, @nicolasiscoding, @abhinovpankaj, @maximesahagian: I opened a PR to fix this at #256

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 a pull request may close this issue.

7 participants