none
Windows Server 2008 上用 ASP.NET 利用 Microsoft.Office.Interop.Word 下的类打开 Word 文档时报“内存不足”错误 RRS feed

  • 问题

  • Windows Server 2008 上用 ASP.NET 利用 Microsoft.Office.Interop.Word 下的类打开 Word 文档时报“内存不足”错误,
    同样代码在 Windows Server 2003 上不会出现,苦思二天没有答案,烦请各位帮忙了。

    代码如下:

    ApplicationClass wordApp = new ApplicationClass();
    wordApp.DisplayAlerts = WdAlertLevel.wdAlertsNone;
    object fileName = docFileName;
    object missing = Type.Missing;
    Document doc = wordApp.Documents.Open(ref fileName, ref missing, ref missing, ref missing,
                                          ref missing, ref missing, ref missing, ref missing,
                                          ref missing, ref missing, ref missing, ref missing,
                                          ref missing, ref missing, ref missing, ref missing);

    Dialog dlgPrintSetup = wordApp.Dialogs[WdWordDialog.wdDialogFilePrintSetup];
    InvokeHelper(dlgPrintSetup, "Printer", EWorkPageBase.PDFFactoryPrinterName);
    InvokeHelper(dlgPrintSetup, "DoNotSetAsSysDefault", 1);
    dlgPrintSetup.Execute();
    object flag = false;
    doc.PrintOut(ref flag, ref missing, ref missing, ref missing, ref missing, ref missing,
                 ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                 ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);

    ((_Document)doc).Close(ref flag, ref missing, ref missing);
    wordApp.Quit(ref flag, ref missing, ref missing);

    2009年10月10日 5:38

全部回复