Hey Eric – thanks for everything.
I found trying to add a hyperlink relationship for a cell was failing for me – and I’ve determined the following rules and mod to code needed – but I don’t know if it’s a mistake in the openxml.js code or if I’m using it wrong.
1. I have to manually add the ‘Hyperlinks/Hyperlink’ elements to the worksheet XDocument using new XElement methods (working from a BASE64 template which has no hyperlinks already).
2. The Hyperlinks element has to be added before ‘pageMargins’ element which appears by default. I’m assuming this is a schema validation thing and I should probably go check and confirm.
3. I then need to update the relationships part for the according sheet. I tried just using ‘worksheetPart.addRelationship’ and it does create a new part and add the relationship, but it adds it with a ‘rel:’ namespace prefix – this doesn’t seem to be liked by Excel and reports bad file. Manually editing the xlsx and removing the rel: prefix worked so..
4. I changed openxml.js openXml.OpenXmlPart.prototype.addRelationship to add a non-prefix namespace attribute and now Excel is happy.
What do you think? Does the openXml.OpenXmlPart.prototype.addRelationship need this modification to remove ‘rel’ namespace prefix, or am I doing something wrong?
Bit of beginner here, so please forgive me if I’m making an obvious mistake.