Addig hyperlinks to Column 3 in Excel export


i have required to add hyperlink to a column data which is retrieved from database using C#. can you tell me please how to add Hyperlinks to data of specific columns that is retrieved from the database.

when we click that link it should go to the respective link like how we get in MicrosoftWord.

Please help as soon as possible. i have been attaching an example sheet. in that i need to put Hyperlink to URL Column to go to that respective site...

This message was posted using Page2Forum (attachment)

Thanks for considering Aspose.

Yes, you can do it quite easily using Aspose.Cells APIs.

May the following code help you for your need:

Workbook workbook = new Workbook();
// Open the template file.
// Get the first worksheet in the workbook.
Worksheet worksheet = workbook.Worksheets[0];
// Eliminate the existing text in the cell.
// Add hyperlinks to Cells D2:D15.
int index;
for (int i = 1; i<=worksheet.Cells.MaxDataRowInColumn(3); i++)
index = worksheet.Hyperlinks.Add(i,3,1,1,worksheet.Cells[i,3].StringValue);
Aspose.Cells.Hyperlink hlink = worksheet.Hyperlinks[index];
hlink.ScreenTip = "Click to go to respective site";
worksheet.Cells[i,3].Style.Font.Color= Color.Blue;

// Save the Excel file

For further reference, please check:

Thank you.