How to set Hyperlink Base programmatically in OpenXML C# in Excel?
Manually way:
Open the document in which you want to use an absolute hyperlink.
On the File menu, click Info.
Click the Properties dropdown under the document window.
Click Advanced Properties.
Click the Summary tab.
In the Hyperlink Base box, type x.
Click OK.
How to set programmatically?
Thanks for your help in advance.

Amit MohantyRank #112 · 20K reputationPosted Jul 3, 2023, 6:19 AM EDT
Try this once
using DocumentFormat.OpenXml; using DocumentFormat.OpenXml.ExtendedProperties; using DocumentFormat.OpenXml.Packaging; public static void SetHyperlinkBase(string filePath, string hyperlinkBase) { using (var document = SpreadsheetDocument.Open(filePath, true)) { var extendedFilePropertiesPart = document.ExtendedFilePropertiesPart; if (extendedFilePropertiesPart == null) { extendedFilePropertiesPart = document.AddNewPart("rId3"); extendedFilePropertiesPart.Properties = new Properties(); } var documentProperties = extendedFilePropertiesPart.Properties; if (documentProperties.HyperlinkBase == null) { documentProperties.HyperlinkBase = new HyperlinkBase(); } documentProperties.HyperlinkBase.Text = hyperlinkBase; extendedFilePropertiesPart.Properties.Save(); } } // how to use string filePath = "path_to_your_excel_file.xlsx"; string hyperlinkBase = "x"; SetHyperlinkBase(filePath, hyperlinkBase);Mohamed Azarudeen ZRank #297 · 8.5K reputationPosted Jul 3, 2023, 6:16 AM EDT
guess you have ur ansewer
Karthik S37 reputationPosted Jul 4, 2023, 1:11 AM EDT
Working as expected. Thank you.