Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual weblinks in a cell #89

Closed
nmossvfp opened this issue Jun 14, 2023 · 8 comments
Closed

Individual weblinks in a cell #89

nmossvfp opened this issue Jun 14, 2023 · 8 comments

Comments

@nmossvfp
Copy link

I am trying to populate an Excel column which contains a valid weblink to an invoice document. The link is a direct path to a billing pdf at a cloud location. It is assumed that any user who clicks the link will already have the necessary permissions to view the document or download it.

Excel seems to have some native protection against 'enabling' these links. However, clicking inside any individual cell or placing the cursor in to the cell and then clicking enter does 'activate' the link and it changes colors to the typical blue of a link. Then it works to retreive the document at that location.

My question, is there any way to create the column containing the Invoice pdf link so that all of them are always active? By active I mean that any user double-click on that specific cell will take the expected action?

@ggreen86
Copy link
Owner

ggreen86 commented Jun 14, 2023 via email

@nmossvfp
Copy link
Author

Greg,

Thanks for the quick response. I am creating an Excel and populating the sheet values in a loop via SETCELLVALUE
For example:

.setcellvalue(lnwb, currsheet, currow, 19, m.docnum)
.setcellvalue(lnwb, currsheet, currow, 20, m.doclink)

Where docnum is an invoice and doclink is a formatted URL. Both are ‘Text’.

When the spreadsheet is opened, all of the links in that column look like the example in the top row. They are black and do not have the expected single or double-click action associated with a web link.

Manually inserting your cursor and editing any part of the URL or clicking ENTER at the end of the line 'wakes it up' for lack of a better description and it becomes a clickable web link. I manually did this in the lower 6 rows to demonstrate this for you.

Attached screen capture:
image

Is there an alternate method or a parameter I could use to indicate that the contents although TEXT is actually a LINK ?
That's my question. As I write out this explanation I am wondering now if the observed behavior is the result of utilizing the relay method of link versus a straight up document extension such as .doc or .pdf or .htm ? Unfortunately I don't control that aspect.

Thanks

@ggreen86
Copy link
Owner

ggreen86 commented Jun 14, 2023 via email

@nmossvfp
Copy link
Author

.addHyperLinkFile(1, 2, 2, 20, 2, 20, “https://sample.weblink.validlink.com/232333”)
(note I am trying to populate a single cell in a loop so my start and end are often the same)

This would be perfect except that my attempts to use .AddHyperLinkFile() seem to be failing. It stops on the line IF ADIR(laFile, tcTarget) > 0 probably because the array is not being created from tcTarget.

Does the file you want to link to have to exist as a file? If Yes then the ADIR is looking to get fileinfo from the TcTarget but it’s not a file.

Would it be possible to create an .AddHyperlinkRaw() method that does not do the file check but just passes through the link with no validation?

@ggreen86
Copy link
Owner

ggreen86 commented Jun 14, 2023 via email

@nmossvfp
Copy link
Author

To test, I made my own addhyperlink method and commented out the lines you specified.

This line in the code points to an alias that does not exist named xl_sheet_rels

lnrelid = thisform.vfpxls.GetNextId(tnWB, tnSheet, "xl_sheet_rels")
obviously it fails right there.

@ggreen86
Copy link
Owner

ggreen86 commented Jun 14, 2023 via email

@nmossvfp
Copy link
Author

Ok I modified the lines of code in the class as you suggested to comment out the conditional lines of the addhyperlinkfile()

At first I thought it failed because my entire column of data was blank but then I realized, it wasn't blank after all the hyperlinks were all there underneath just not visible as any text so the columns contents looked blank.

I went back and added in the human readable text of the links themselves. Now it works as expected with the text of the weblink and a single click launches the link. Now that this is working, I am rethinking my process of writing out the web link itself as it is long and seems unecessary. I ran an alternate version of my spreadsheet with the same text in every row of "Click For Invoice" and will consider this for future runs.

Thank You!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants