Open-XML-SDK
Open-XML-SDK copied to clipboard
OpenXML does not allow special character such as &, ", >, < in hyperlink, it can throw exception when get worksheet instance
Before submitting an issue, please fill this out
Is this a:
- [x] Issue with the OpenXml library
- [x] Question on library usage
If you have answered that this is a question, please ask it on StackOverflow instead of here. This issue tracker is meant to track product issues while StackOverflow excels at answering questions
Description
OpenXML does not allow special character such as &, ", >, < in hyperlink, it can throw exception when get worksheet instance
Observed
OpenXML does not allow special character such as &, ", >, < in hyperlink, it can throw exception when get worksheet instance
Expected Allow special character such
Hi @ttnnphuoc,
Can you be more specific about where the hyperlink is in the file format? Also can you provide an example of Open XML SDK code that demonstrates the problem (i.e. exception when adding or modifying a hyperlink in a worksheet)?
This is a known issue due to the System.Uri
class itself (see https://github.com/OfficeDev/Open-XML-SDK#known-issues). That links provides a mechanism to "sanitize" the document before reading it. It's not ideal, but the best option at this point.
This has become much easier in v3.0 - see #1322. Docs to follow on how to use