
现在的百度文库,是用什么来技术实现的吗? 若用ASP.NET能否实现呢?有思路不?最好是有源代码啦. 10
现在的百度文库,是用什么来技术实现的吗?若用ASP.NET能否实现呢?有思路不?最好是有源代码啦.我主要是想做到百度文库预览文件的效果!现在看到百度文库,的word都可以...
现在的百度文库,是用什么来技术实现的吗?
若用ASP.NET能否实现呢?有思路不?最好是有源代码啦.
我主要是想做到百度文库预览文件的效果!现在看到百度文库,的word都可以直接拷贝文字,而且还不是转为swf的。 展开
若用ASP.NET能否实现呢?有思路不?最好是有源代码啦.
我主要是想做到百度文库预览文件的效果!现在看到百度文库,的word都可以直接拷贝文字,而且还不是转为swf的。 展开
3个回答
展开全部
我现在知道一种方式,拱你参考下:
思路:下载功能直接是下载doc文件或者打包文件
在线预览可以先把doc转换成html,再呈现出来。
asp.net 是自带的是可以将doc文件转为html的,都转换为html的,当然就能在想要它展现的地方进行线预览了!
部分代码参考如下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Word = Microsoft.Office.Interop.Word;
namespace WebWordToHtml
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string filename = WordToHtml("d:\\test.doc");
StreamReader fread = new StreamReader(filename, System.Text.Encoding.GetEncoding("gb2312"));
string ss = fread.ReadToEnd();
Response.Write(ss);
fread.Close();
fread.Dispose();
}
/// <summary>
/// word转成html
/// </summary>
/// <param name="wordFileName"></param>
private string WordToHtml(object wordFileName)
{
//在此处放置用户代码以初始化页面
Word.Application word = new Word.Application();
Type wordType = word.GetType();
Word.Documents docs = word.Documents;
//打开文件
Type docsType = docs.GetType();
Word.Document doc = (Word.Document)docsType.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, docs, new Object[] { wordFileName, true, true });
//转换格式,另存为
Type docType = doc.GetType();
string wordSaveFileName = wordFileName.ToString();
string strSaveFileName = wordSaveFileName.Substring(0, wordSaveFileName.Length - 3) + "html";
object saveFileName = (object)strSaveFileName;
docType.InvokeMember("SaveAs", System.Reflection.BindingFlags.InvokeMethod, null, doc, new object[] { saveFileName, Word.WdSaveFormat.wdFormatFilteredHTML });
docType.InvokeMember("Close", System.Reflection.BindingFlags.InvokeMethod, null, doc, null);
//退出 Word
wordType.InvokeMember("Quit", System.Reflection.BindingFlags.InvokeMethod, null, word, null);
return saveFileName.ToString();
}
}
}
展开全部
比百度文库更好的方案是用PageOffice,能够在线只读浏览word、excel、ppt、pdf,可禁止复制粘贴、下载。支持IE、chrome、firefox、搜狗、遨游、360等所有流行的浏览器。相比百度文库,PageOffice在显示word时可以做到100%的原样呈现,没有任何走样,用户认可度高。
唯一的缺点是:用户的电脑必须安装有Office或wps
唯一的缺点是:用户的电脑必须安装有Office或wps
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你参考下PageOffice吧。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询