Editing ASPX page with Microsoft Word having XHTML code - asp.net

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...

Related

How to open and doc file that has spaces between folder names

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.

Reading an e pub file

I have files in e pub format. I have to show their contents to the user. How do I read them in asp.net? Can it be done through javascript?
Authoritative? What could be better then a StackOverflow answer? I started from this question ( https://stackoverflow.com/questions/4870594/is-there-a-c-sharp-epub-library ) and gleaned a few usefull links:
Usefull information on displaying text in a web browser using javascript so it paginates nicely: HTML book-like pagination
A C# open source library for reading ePub files, the sample code on the home page includes how to get the contents as HTML: http://epubreader.codeplex.com/
There are other libraries which may come in handy if the ePub reader library on codeplex doesn't pan out: http://sourceforge.net/projects/epubsharp/, and http://www.aspose.com/categories/.net-components/aspose.words-for-.net/default.aspx
You can't do this with just JavaScript of course, you'll have a server side like a web service or code behind on your asp.net webpage which opens the epub file, extracts the contents as HTML and returns it to the client, but I think there is enough here to get you started.
Just to add then i suggest the steps:
Step 1: unzip the file using C#,.net code having some third party library.
Refer : recommend a library/API to unzip file in C#
Step 2: Check whether in the extracted folder there is only one file or more.
Refer: How do I find out how many files are in a directory?
Step 3 :Read the file using stream reader in c#.net
Refer: http://msdn.microsoft.com/en-us/library/aa328963(v=vs.71).aspx
http://www.dotnetperls.com/streamreader
Epub file is actually a zip archive that contains
xml files for meta data, table of contents etc
xhtml or dtbook (xml) + gif, jpeg, png, svg + css for content
To be able to display epub you will have to be able to handle all of the above. Here Reading ePub format you'll find what you have to do to open epub step by step - it's an example for iphone, but it should be enough.

Removing the byte order mark on asp.net page

I'm really stuck. I'm working on an integration project where I'm creating a html fragment using ASP.NET. This fragment will be included as part of another site. The html fragment is created using a simple ASP.NET page with a minimal code behind file.
Te site that will include this html fragment is running PHP. The developer there is complaining that my code is sending the byte order mark as part of the html fragment and this is making his life difficult.
I'm using Visual Studio 2010 for development. I've saved the relevant aspx and aspx.cs files as UTF-8 without signature. However, this doesn't seem to have made a difference and now I'm pretty much out of ideas. The rest of the site is set to use UTF-8 as standard (defined in web.config).
Where should I be looking to alter the BOM behaviour for my aspx file?
If you save the file in Visual Studio I believe it will keep adding the BOM. You need to use a different editor to remove the marker such as NotePad++.
Actually in the advanced save as dialog in Visual Studio there is also an option to save UTF-8 without signature. Have you tried this?
It's confirmed in this question.
You can also use plain old NotePad to save with a different encoding.
Save As...Encoding DropDown.

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

Using PDF In .Net App

Can someone point me to some code/tutorial on how to upload pdf files and store them, then moreover how to use a pdf reader to display the file as read only in an asp.net application.
Is there a PDF reader already in the visual studio toolbox?
The approach I would use in this situation is to upload the PDF as you would any other file, then use a tool like GhostScript to convert the PDF pages into image files that you can show in ASP .Net.
Here's a tutorial doing that in C# http://www.codeproject.com/KB/cs/GhostScriptUseWithCSharp.aspx
Adobe provides (on acrobat.com) a free service which provides you with the ability to upload pdf (and also other types like doc...) and then embed a nice flash interface for displaying the files on your page.
It's pretty helpful as you can store some 5 gigs of files here.
But if you want to let the users upload their own files then this won't help you.
PDF is a final format file, ie its is read-only for the most part and can be embedded into the page via the <object> tag, except if you mean downloadable by the user.
Displaying PDF is generally done by rasterising to an image format for display (ie as an image on the page or via a richer interface (with zooming etc) through flash/silverlight etc.
You can use [GhostScript][1] to interpret PDF files and convert them to an image.
[1]: http://www.GhostScript .com
Uploading a PDF is just like any other file. Use the ASP.NET file uploader control:
http://www.codeproject.com/KB/aspnet/fileupload.aspx
In order to view the PDF in an ASP.NET application, you could either depend on Acrobat being there or use a PDF Viewer control.
The company I work for, Atalasoft, sells a PDF Reader add-on to our web viewer controls. You can learn more here: http://www.atalasoft.com/products/dotimage/pdf-reader

Resources