Link to home
Start Free TrialLog in
Avatar of Easwaran Paramasivam
Easwaran ParamasivamFlag for India

asked on

How to show Sharepoint document in ASPX page?

Hi Experts,

  There is a requirement for me. I've sharepoint site. In the document library, some documents are loaded.

  The documents full searchable path is loaded as hyperlink in my ASPX page. This is achieved.

  Upon clicking the link, what I would like to do is that I would get the content and write in an ASPX page. How to achieve this? Please guide me.
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Hello,

whilst it is possible to upload all kinds of documents to a document library, whether or not the content of these documents can be displayed in a browser is a completely different subject.

What document types does the library contain? SharePoint has some built-in functionality to display certain file types out of the box. For example Excel files can be shown with Excel Services, if they adhere to certain constraints. Similarly, Visio files can be shown in a web part. Office web apps can be used to show other Office documents. PDFs can be shown in the browser as well,

Other file types are not so easy to integrate, for example AutoCAD drawings.

Reading the contents of a file and displaying it in an ASPX page sounds like a major undertaking that very much depends on what type of file you want to open.

Can you elaborate on that?

cheers, teylyn
Avatar of Easwaran Paramasivam

ASKER

Thanks.

We have docx, pdf and html files.

Please explain how to handle each of them.
The browser will be able to display PDFs (any browser has a PDF plug-in) and HTML goes without saying. Word documents can open in Word. Why do you want to re-invent the wheel?

Just let the files be opened with the tools that are made to handle them.
Thanks.

My question is how to get content of the specified file (by passing file path) from sharepoint.
Can you explain the bigger picture? Word, PDF and HTML are three completely different file formats, so need to be treated differently. Why do you want to "read" the content of the files if you can just open them in the browser?
Well. Why I need to read the content is that say for example the document stored in Sharepoint is DOC or DOCX file. There is an option that I need to provide, I would like to show the Document content in HTML format (The para content will be shown with in <p></p> tag). If I read the content only I could do some manipulation on it.

Please let me know if you need further details.
Well, all these document types can be displayed in the browser.  Why re-invent the wheel? For Word documents just set the library to open documents in the browser instead of the client. HTML and PDFs are already taken care of.
In web application it is OK. What about in case of windows application as Client. Say for example, in a Rich text box I would like to shown the content of a sharepoint document. In this case I could able to read the sharepoint document content. Right?

Please direct me how to achieve that.

Thanks.
There is no such thing as a "SharePoint document". SharePoint is not a file type. SharePoint document libraries can store all kinds of files. The file type is not tied to SharePoint but inherent in the file and any method to show the file content in a different setting is independent of SharePoint.
The Sharepoint document I meant is the document stored in sharepoint. You are right. There should be some method in .NET to fetch the document by some means connecting with Sharepoint. I would like to know that. Please share with me your thoughts/ideas/suggestions.

Please let me know if you need further details.
ASKER CERTIFIED SOLUTION
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your response. I got your point.
Can you please explain the B grade? This is the second time you assigned a B grade to one of my answers. My answers are valid. You can't assign a B simply because you don't like how things work.