Sign In  Sign Up Live-Chat

Adding query params to a hyperlink in excel

Last post 06-27-2008, 1:38 PM by Amjad Sahi. 3 replies.
Sort Posts: Previous Next
  •  06-27-2008, 12:02 PM 133469

    Adding query params to a hyperlink in excel

    Is it possible to add url parameters to a hyperlink in an excel workbook? For example: I want to create a hyperlink to https://mysite.com/index.html?a=1&b=2 on my excel worksheet.

    Thank you!


    This message was posted using Page2Forum from Aspose products - Documentation
     
  •  06-27-2008, 12:57 PM 133478 in reply to 133469

    Re: Adding query params to a hyperlink in excel

    Hi,

    Yes, you can add the url:

    E.g.,

    // Create a Workbook object
       Workbook workbook = new Workbook();
       // Obtain the reference of the first sheet
       Worksheet worksheet = workbook.Worksheets[0];
       // Add a hyperlink to A1 Cell.
       int index = worksheet.Hyperlinks.Add("A1",1,1,"https://mysite.com/index.html?a=1&b=2");
       // Create a Hyperlink object to fetch the existing hyperlink
       Hyperlink hlink = worksheet.Hyperlinks[index];
       // Set the label to display
       hlink.TextToDisplay = "Link";
       // Save the Excel file
       workbook.Save(@"d:\test\linkages.xls");

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  06-27-2008, 1:25 PM 133479 in reply to 133478

    Re: Adding query params to a hyperlink in excel

    Thanks for the quick response Amjad.

    We have an application where we are using the Add function from the Aspose Hyperlink class to add a hyperlink to an Excel Report. However the link when clicked upon opens about.blank for a millisecond and then gets redirected to the login page of the website we want to open. On logging in the url loses the query parameters one of which is the tab information for the tab that should be opened.

    However, when we paste the same link in a new browser window then the user is first directed to login and then to the correct tab (the url parameters are still available.)

    Any suggestions / solutions would be much appreciated.

    Thanks

    Ritika

     
  •  06-27-2008, 1:38 PM 133480 in reply to 133479

    Re: Adding query params to a hyperlink in excel

    Hi Ritika,

    Well, Aspose.Cells follows the MS Excel standards. I am not sure if this the behavior of MS Excel, but, could you insert a hyperlink in MS Excel manually using MS Excel menu options and check the results.

    Thank you. 


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
View as RSS news feed in XML