how to show word,rtf,pdf file in asp.net
plz give me code
thnks in advance

Recommended Answers

Use hyperlink.

<a href="file.pdf">PDF</a>
Jump to Post

All 2 Replies

Use hyperlink.

<a href="file.pdf">PDF</a>

At first, read a document as a byte array. Use Response to show the document:
Here is the example of excel shown, for other document formats change ContentType.

<%#
// XLS
// Save Excel Workbook (XLS) to MemoryStream
byte[] bytes = wbook.WriteXLS().ToArray();
 
// Show Excel (XLS) in Browser window without saving on disk
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(bytes);
Response.Flush();
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.