我需要在基于浏览器的Silverlight应用程序中显示Office文档。我现在找到的解决方案包括使用Office自动化将各种Office文档转换为XPS,然后使用Silverlight的FirstFloor文档工具包在Silverlight中显示产生的XPS文件。
这是工作的,但它是缓慢的,并有相当数量的移动部分。最值得注意的是,由于所有已知和明显的原因,Office自动化部分特别不稳定。
我能想到的最好的选择是购买像Aspose.Total这样的东西来处理文档->XPS转换部分。但是Aspose相当昂贵(在我们的场景中至少是8K美元),这很大程度上是因为它附带了很多我并不真正需要的功能。如果有必要的话,我会付钱的,但在此之前,我想看看是否还有其他人有更好的想法。
关于如何做到这一点的建议?基本上,我需要允许用户将Word/Excel/Powerpoint文档上传到服务器,并在基于浏览器的Silverlight应用程序中显示它们(只读很好)。有我错过的解决办法吗?
发布于 2011-07-14 21:38:49
彩虹PDF有2000美元http://rainbowpdf.com/server-based-solutions的服务器解决方案
:)
发布于 2011-10-13 12:02:55
我有这个问题,所以我用编程把Docs这个词转换成PDF格式。我现在需要在浏览器中调用相同的名称PDF文件。(Doc1.docx到Doc1.pdf)您可以使用变量来调用文档。这是C#后端代码,它很好地发挥了作用。还记得添加对Microsoft 12.0对象库的引用。调用此方法或使其成为类。然后再打电话给文档。
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Microsoft.Office.Interop.Word;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ApplicationClass wordApplication = new ApplicationClass();
Document wordDocument = null;
object paramSourceDocPath = @"D:\Websites\Docs\Doc1.docx";
object paramMissing = Type.Missing;
string paramExportFilePath = @"D:\Websites\Docs\Doc1.pdf";
WdExportFormat paramExportFormat = WdExportFormat.wdExportFormatPDF;
bool paramOpenAfterExport = false;
WdExportOptimizeFor paramExportOptimizeFor = WdExportOptimizeFor.wdExportOptimizeForPrint;
WdExportRange paramExportRange = WdExportRange.wdExportAllDocument;
int paramStartPage = 0;
int paramEndPage = 0;
WdExportItem paramExportItem = WdExportItem.wdExportDocumentContent;
bool paramIncludeDocProps = true;
bool paramKeepIRM = true;
WdExportCreateBookmarks paramCreateBookmarks = WdExportCreateBookmarks.wdExportCreateWordBookmarks;
bool paramDocStructureTags = true;
bool paramBitmapMissingFonts = true;
bool paramUseISO19005_1 = false;
try
{
// Open the source document.
wordDocument = wordApplication.Documents.Open(
ref paramSourceDocPath,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing,
ref paramMissing);
// Export it in the specified format.
if (wordDocument != null)
wordDocument.ExportAsFixedFormat(
paramExportFilePath,
paramExportFormat,
paramOpenAfterExport,
paramExportOptimizeFor,
paramExportRange,
paramStartPage,
paramEndPage,
paramExportItem,
paramIncludeDocProps,
paramKeepIRM,
paramCreateBookmarks,
paramDocStructureTags,
paramBitmapMissingFonts,
paramUseISO19005_1,
ref paramMissing);
}
catch (Exception ex)
{
// Respond to the error
}
finally
{
// Close and release the Document object.
if (wordDocument != null)
{
wordDocument.Close(ref paramMissing, ref paramMissing, ref paramMissing);
wordDocument = null;
}
// Quit Word and release the ApplicationClass object.
if (wordApplication != null)
{
wordApplication.Quit(ref paramMissing, ref paramMissing, ref paramMissing);
wordApplication = null;
}
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}https://stackoverflow.com/questions/6697847
复制相似问题