如何在asp.net中以web形式显示word文件
我在求职门户网站上工作。在这方面,我有求职者登记表。在求职者上传简历中。我只在数据库中保存简历文件名,在本地文件夹中保存实际简历。在另一个网络表单中,我想在div标签中显示简历,就像在naukri.com的更新/查看配置文件中一样。那么我该如何做到这一点呢? 我可以从数据库中检索简历文件名。 所以,请任何人向我提出任何解决方案。 提前感谢。如何在asp.net中以web形式显示word文件,asp.net,Asp.net,我在求职门户网站上工作。在这方面,我有求职者登记表。在求职者上传简历中。我只在数据库中保存简历文件名,在本地文件夹中保存实际简历。在另一个网络表单中,我想在div标签中显示简历,就像在naukri.com的更新/查看配置文件中一样。那么我该如何做到这一点呢? 我可以从数据库中检索简历文件名。 所以,请任何人向我提出任何解决方案。 提前感谢。//如何:将新包创建为Word文档。 // How to: Create a new package as a Word document. public s
//如何:将新包创建为Word文档。
// How to: Create a new package as a Word document.
public static void CreateNewWordDocument(string document)
{
using (WordprocessingDocument wordDoc = WordprocessingDocument.Create(document, WordprocessingDocumentType.Document))
{
// Set the content of the document so that Word can open it.
MainDocumentPart mainPart = wordDoc.AddMainDocumentPart();
SetMainDocumentContent(mainPart);
}
}
// Set content of MainDocumentPart.
public static void SetMainDocumentContent(MainDocumentPart part)
{
const string docXml =
@"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>
<w:document xmlns:w=""http://schemas.openxmlformats.org/wordprocessingml/2006/main"">
<w:body><w:p><w:r><w:t>Hello world!</w:t></w:r></w:p></w:body>
</w:document>";
using (Stream stream = part.GetStream())
{
byte[] buf = (new UTF8Encoding()).GetBytes(docXml);
stream.Write(buf, 0, buf.Length);
}
}
公共静态void CreateNewWordDocument(字符串文档)
{
使用(WordprocessingDocument wordDoc=WordprocessingDocument.Create(document,WordprocessingDocumentType.document))
{
//设置文档的内容,以便Word可以打开它。
MainDocumentPart mainPart=wordDoc.AddMainDocumentPart();
SetMainDocumentContent(主要部分);
}
}
//设置MainDocumentPart的内容。
公共静态无效SetMainDocumentContent(MainDocumentPart)
{
常量字符串docXml=
@"
你好,世界!
";
使用(Stream=part.GetStream())
{
字节[]buf=(新的UTF8Encoding()).GetBytes(docXml);
stream.Write(buf,0,buf.Length);
}
}
摘自