It may be assumed that you need to pass separate strings when opening a SPSite / SPWeb / SPFile (leading to all kinds of nasty url string chopping to determine base URL /site URL/ file name) when actually you can do this instead (this may be well known to many, but an experienced SharePoint guy I spoke to recently was not aware of it so I thought it would be worth posting)
Helpfully the SPSite constructor doesn’t care about the library name , filename or the .docx suffix and will just open http://server/site for you. Then use the default constructor for OpenWeb() as we’ve already passed the full URL. Then use SPWeb.GetFile(), which takes the full URL. Easy, and no strings were harmed during the process.