How to open and doc file that has spaces between folder names - asp.net

I have a file that will open perfect when the link is copied to a web browser but will fail when trying to open the link from the web page in asp.net. I noticed its because of the spaces. How can I get my application to read this space in between. The app fails to read Shared Documents due to the spacing and also Microsoft Word Test.docx. What can I add in-between the words that will read those spaces in asp.net so that I can open the docx file. Thanks in advance!
http://sharepoint/Shared Documents/Microsoft Word Test.docx

You can URL-encode the space character:
http://sharepoint/Shared%20Documents/Microsoft%20Word%20Test.docx
To do this dynamically in ASP.NET you'd likely use either HttpUtility.UrlEncode or WebUtility.UrlEncode.

Related

Editing ASPX page with Microsoft Word having XHTML code

I have a xml file which has all the data from my Web based application. Now I am using XSLT 1.0 file to read the data from XML and my application then displays this in aspx page in my internet explorer.
I want to edit the content in Microsoft Word and then save it in word file (doc, docx). When I use File-->"Edit with Microsoft Word" option, I see blank MS Word and no data. I dont know what to do.
Please help and advise.
Open it with notepad, then copy all the content, the paste it in a newly created word document.
That's how straightforward things tend to get with office...

Opening an Excel .xlsx file in IE and following its embedded hyperlinks back to file server

I have an intranet site that lets users open files in the browser (by prompting for download). One of these files is an .xlsx workbook that contains hyperlinks which point to different locations of files (.pdfs, .docs) on the file server in which the .xlsx workbook is located.
It seems the file server path to the workbook is replaced by a "Temporary Internet Files/Content.IE5/" path, leading to the warning "cannot open the specified file" in Excel.
I tried downloading the Excel document first and then following the links, but they're still opening in the temp internet location
EDIT:
For instance, when hovering over the hyperlinks in excel they read: "file:///C:\Documents And Settings\%username%\Local Settings\Temporary Internet files\Content.IE5\40WSS3CB\" + filename
when they should read: "file:///\servername\Departments\Read\" + filename
How can I still open the excel file in the browser and retain the hyperlinks inside and have them not be replaced by the temporary internet files path?
can someone point me in the right direction ? Thanks!
I did some testing, and it almost comes from the way you store links. If you browse through the dialog of Insert hyperlink, then you will end with relative urls. That is, the common base is stored as a reference to the current xlsx file path, and the remainder is stored and displayed as link.
You are totally in the issue Richard Hare mentions, so following the procedure from the microsoft support site should help. It did the trick on my test at least.
UPDATE to sum up down.with.the.bass comments :
One option to solve this, if doable, is to open xlsx file from its network share location and not through the website. If it is forbidden for whatever reason, you may be able to update the links using a macro.
Do you have an option like "Update links on save" enabled?
In an earlier version of Excel it was set in Tools, Options, General-tab, Web Options-button, Files-tab.
Try unchecking it and resaving the document.
I just did in my server the same task (the one I understood):
Uploaded the hyperlink to some asp.net webpage.
<p>
test<br />
</p>
The "book1.xlsx" file has inside a cell which refers (hyperlinks) to some share directory (i.e \\NHSTXX1\TEST\MS OFFICE EXCEL - \\SERVERNAME\FOLDER\OTHER FOLDER )
And when clicked the hyperlinked cell, it opened the share directory I was looking for.
I tried with Firefox.
hope this help
Hyperlinks shouldn't just mysteriously change. I saved an excel file with a hyperlink in it - opened it with html - saved it - open it in excel again - and the link stays the same. So I'm not sure how this could be happening to you(if I understand your situation correctly).

HtmlEncode Local resources

I have a web site that uses local resources. The main text (so not the labels, etc.) on de default page is stored in a file. This file is added to my local resources file default.aspx.fi-FI.resx and is named text-defaultPage. It's a regular text file with tags etc.
The problem is however, that the text is Finnish in other words it uses a lot of characters having umlaut (รค) and other special characters.
The person for whom the web site is wants to edit this text himself but he doesn't know anything about programming, html entities etc.
Is there a way to make it so that those characters are encoded with say htmlEncode?
in my Global.asax I check for the selected language and the page gets reload with that language.
Edit
Never mind, I made the files Unicode text files.
Solution to the problem is make the files unicode.

Display Word Document inside ASP.Net page

I want to display a word Document, which is sitting on my IIS. I want to display the whole document as is, inside a iFrame on my aspx page.
I know I can use MS Word Libs, but I cannot install Word on Server where application will be hosted, (Correct me if I am wrong: I cannot use just dlls without installing MS Word on Server).
How can I display the word document in my iFrame?
Probably the easiest way would be to include the Google Docs Viewer.
Other ways could be to use Aspose.Words (commercial) to convert Word to PDF and then use Aspose.Pdf.Kit to convert PDF to images and then display the images online.
PowerTools for Open XML contains an open source, free implementation of a conversion from DOCX to HTML formatted with CSS. The module HtmlConverter.cs supports all paragraph, character, and table styles, fonts and text formatting, numbered and bulleted lists, images, and more. See http://bit.ly/1bclyg9

How to stop server-generated Word .DOCs from saving with "_files" folders?

I have a Word .DOCument that's being generated by a (classic ASP) server. It's an HTML file that's being output as a .DOC using the application/msword content type. The document is generated fine, saves fine, opens up fine in Word, and is fully editable...
The problem occurs on the next document save in Word. A folder is created in the document's directory with the name "<filename>_files" -- just as if you were saving a web page in IE. Inside this folder are three files: colorschememapping.xml, filelist.xml and themedata.thmx. This happens when originally generating the document using IE or Firefox.
-> How can I prevent these _files folders from being created when saving in Microsoft Word?
(flow: users clicks link in browser, Save (.doc) As..., open .doc in MS Word, edit, save -> "_files" folder)
It doesn't only happen generating file from Firefox/IE.
Microsoft Word 2007 does it when editing any HTML file and saving.
The issue is that if you delete the directory, the HTML file get deleted too.
My workaround:
Edit the file in Word usual
Save the file
Close the file (exit Word, or just
close it)
Right click on file in Explorer
Select "Open With"->Notepad.
Delete the file in Explorer
Go back to Notepad and Save
You now only have a HTML file an no _files directory.
If your output isn't too complicated try using RTF. I've had a decent amount of success by outputting RTF files with a .doc extension.
Word 2007 and 2010 default to multi file HTML documents, linking the document to the content files. This is the default behavior for HTML based documents.
The only way around it, that I've found, is to create a real Word Doc without basing it on HTML, or the user has the select "Single File Web Page" when they do a Save As.
Delete to recycle bin. This deletes both the word doc and the unwanted folder. Restore the word doc and then empty the bin.

Resources