I have a file, the file name contains some special characters, in my case square brackets, the file name is: [my]File.txt
I want to create a file hyperlink in Excel, I got a problem when I tired to link it as SMB address, the square brackets will be coded as %5B and 5%D instead of [], and I also tried to link it as local address, it does not have such problem.
Case 1 with local file, i.e. file saved under C:\[my]File.txt:
File file = new File("c:\\[my]File.txt");
Case 2 with SMB Windows share, i.e. file saved under \\myServer\[my]File.txt:
File file = new File("\\\\myServer\\[my]File.txt");
I create the hyperlink as following:
Hyperlink link = createHelper.createHyperlink(HyperlinkType.FILE);
link.setAddress(file.toURI().toString());
cell.setCellValue("open");
cell.setHyperlink(link);
This is the pop-up info that I got when I hover the mouse onto the hyperlink cell in Excel:
Related
I have an Excel file that contains many Hyperlink who point to a word file on the server.
http://TITANUS/Fra/dif/avengers.docx
What I would like to do is to save content on my hard drive
I am trying to hyperlink all the fields in column B (picture given below) to the respective content in the folder (picture also provided).
I realized its stupid for me to do it manually and it takes a very long time to do so.
Is there a better way to link them automatically or with more ease?.
I realize that I can do it with help of VBA but I have no clue how to do it.
This is how my excel column B looks before hyperlinking:
So this is what I get after manually adding the hyperlinks to
column B.
This is the folder(folder name is 2016) which has subfolders (the one in image) and in each of these
subfolders there is a pdf file and a word file.
I am required to hyperlink the contents in column b (which are not already hyperlinked to the pdf files to their respective subfolders in this folder "2016" (You can see the address bar).
Here are the pdf and word files inside the subfolders of "2016".
So basically you see is that in column B the numbers in the end are in series. I want them hyperlinked to the pdf files inside these subfolders.
If you observe closely , the subfolder have a huge name (including the parenthesis content) , whereas my column B has name of the sub folder excluding the parenthesis part.
So basically its like matching the serial numbers and hyperlinking the pdf file inside the subfolders.
EDIT:
I tried the following by using =HYPERLINK("\\qatargas.com.qa\doc\Admin\Al_Khor_Community\Alwaha_Club_Admin_Office\Comments & Suggestion Response\2017\"&B1512&" ("&C1512&" "&D1512&")\"&B1512&" ("&C1512&E1510" "&D1512&")"&".pdf";B1512) on cell e1512.
I get this error
Insert a new column "C" (or wherever) and enter in (for example) cell C1210:
=HYPERLINK("file://C:\your_base_path\" & B1210 & "\name_of_pdf_file.pdf","Click to view PDF")
For example in the row 1512: you want to have a hyperlink to a pdf (what is the concrete name of this pdf?) in a path "[...]\qatargas.com.qa\doc\Admin[...]\2016\AKC-CS-17-0124 (QG 3739)". Right?
Then write in cell e1512 the following formula (if the name of pdf is always the same):
=HYPERLINK("[...]\qatargas.com.qa\doc\Admin\[...]\2016\"&B1512&" ("&C1512&" "&D1512&")\"&"<nameofyourpdf>";B1512)
You have to use your path (i used [...] to drop part of the path) and you have to use the name of your pdf, which is always the same you said.
or if name of the pdf is like the Name of the folder:
=HYPERLINK("[...]\qatargas.com.qa\doc\Admin\[...]\2016\"&B1512&" ("&C1512&" "&D1512&")\"&B1512&" ("&C1512&" "&D1512&")"&".pdf";B1512)
So, in my software program I need a comma separated file. Hence, I created one using Microsoft excel entering the data. But, my software program gave error saying its not a comma separated. Hence, I just copy pasted some cell in notepad and it came out to be Tab separated.
Right now :
Owner Latitude Longitude LocationInfo
I want :
Owner,Latitude,Longitude,LocationInfo
Excel has its own special proprietary file format.
If you copy and past from an Excel sheet, what you get has no bearing on the format when you click save.
What you need to do is SaveAs and then in the popup where you can browse for a location and edit the file name, there is also a drop down (below the file name text box) where you can select various file extensions. When you pick one of those Excel will intelligently format your file for the chosen extension. Just find the one that is .csv (it may be called CSV).
I have created a hyperlink that connects to the files which exist in the same directory (or subdirectory) as the Excel file. How do I point to the file without setting the full path? The reason I don't want to give the full path is that if I moved the directory which contains other files and the Excel file to a different location, the hyperlinks shouldn't break.
I tried the option below, but the hyperlink only works if I don't move the files.
I want to assign the hyperlink an address like Example\IndexUsage_notes.txt instead of the full path D:\SCRIPTS\ADMIN_SCRIPTS\Example\IndexUsage_notes.txt
After searching online, I found this articles to be useful:
https://www.extendoffice.com/documents/excel/631-excel-file-location.html
This shows you how to get the file path of your workbook and how to isolate the main directory without using Macros.
Then you can insert your main file directory, sub-directory, and filename into the HYPERLINK function.
You can add text to the main directory using TEXT($B$1,0)&TEXT($B$2,0)&......
Dynamic Hyperlink Spreadsheet.png
Once the sub-directories are created and files are in place, you may not be able to move them easily without changing the sub-directory name manually within the spreadsheet or using Macros.
When a formula in Excel refers to a cell in another file, Excel stores a relative pathname so that if you move the files the links don't break. This works as I expect when the files are stored on a network drive, but not when the files are stored in a SharePoint doc library. Any ideas why and how I can fix it?
In more detail ...
Setup 1 (works perfectly)
\\server\UserFiles$\MClarke\My Documents\Folder1\a.xlsx includes the formula ='\\server\UserFiles$\MClarke\My Documents\Folder1\[b.xlsx]Sheet1'!$A$1
Move both files from Folder1 to Folder2
Open \\server\UserFiles$\MClarke\My Documents\Folder2\a.xlsx and the formula automatically changes to ='\\server\UserFiles$\MClarke\My Documents\Folder2\[b.xlsx]Sheet1'!$A$1
Setup 2 (fails)
http://intranet-server/dept/Folder1/a.xlsx includes the formula ='http://intranet-server/dept/Folder1/[b.xlsx]Sheet1'!$A$1
Move both files from Folder1 to Folder2
Open http://intranet-server/dept/Folder2/a.xlsx and the formula (incorrectly) still says ='http://intranet-server/dept/Folder1/[b.xlsx]Sheet1'!$A$1
I have tried moving and opening files in Setup 2 with both a mapped network drive and using SharePoint's "Open with Explorer" function. Both approaches give the same undesired behaviour: the formula in the moved file continues to point to the original location of the file rather than the new location. So why would Excel store an absolute path in that case but a relative path in Setup 1?
I tried many alternatives and eventually found that the only way to update the file references was to do so manually using the Edit Links dialog from the Data ribbon. That works perfectly, but is just a bit annoying.