In this article I will explain how to View Word Document using asp.net c#
String sFullPath = String.Empty;
string
Physicalpath = System.IO.Path.Combine(Request.PhysicalApplicationPath,
"Profile\\");
sFullPath
= lblResumePath.Text;
string
strFullpath = Physicalpath + sFullPath;
if
(strFullpath != null &&
strFullpath.Length > 4)
{
try
{
FileInfo
_fileInfo = new FileInfo(strFullpath);
if
(_fileInfo.Exists)
{
object objMissing
= System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word._Application
objWord;
Microsoft.Office.Interop.Word._Document
objDoc;
objWord
= new Microsoft.Office.Interop.Word.Application();
object
fileName = @strFullpath;
objDoc = objWord.Documents.Open(ref fileName,
ref
objMissing, ref objMissing, ref objMissing, ref
objMissing, ref objMissing,
ref
objMissing, ref objMissing, ref objMissing, ref
objMissing, ref objMissing,
ref
objMissing, ref objMissing, ref objMissing, ref
objMissing, ref objMissing);
}
}
catch (Exception ex)
{
}
}
No comments:
Post a Comment