Reputation: 65
I am using officeintegration with my lightswitch app to create a report from a docx template and that works great, but I need to manually copy the template file into my documents and then do this to get a location for the file:
string pathToMyDocs = Environment.CurrentDirectory.ToString();
string filelocation = pathToMyDocs + "\\InvoiceTemplate.docx";
I would rather the file was included with each client, and kept locally. I can 'include' the file, but how do I then get a reference to the current running directory so I can use that file?
string pathToMyDocs = Environment.CurrentDirectory.ToString();
Doesnt seem to work.
Or is there a better way to do this?
Thanks
Upvotes: 0
Views: 164
Reputation: 114
string sourceFile = HttpContext.Current.Server.MapPath("~/DocTemplates/EXH6.docx");
I hope this helps.
Upvotes: 1