小编Mar*_*ino的帖子

操作失败,由于库未注册,对带有 IID 的接口的 COM 组件的 QueryInterface 调用失败

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using Excel = Microsoft.Office.Interop.Excel;

namespace GridComplete
{
    public partial class Form1 : Form
    {
        private static Excel.Workbook MyBook;
        private static Excel.Application MyApp;
        private static Excel.Worksheet MySheet;

        private void bRun_Click(object sender, EventArgs e)
        {
            MyApp = new Excel.Application();
            MyApp.Visible = false;
            MyBook = MyApp.Workbooks.Open(tbFile1);
            MySheet = (Excel.Worksheet)MyBook.Sheets[1];

        }

    }
}
Run Code Online (Sandbox Code Playgroud)

在将 MyApp.Visible 设置为 false 的行中,我收到以下未处理的异常:

GridComplete.exe 中发生类型为“System.InvalidCastException”的未处理异常

其他信息:无法将类型“Microsoft.Office.Interop.Excel.ApplicationClass”的 COM 对象强制转换为接口类型“Microsoft.Office.Interop.Excel._Application”。此操作失败,因为对 IID …

c# excel

5
推荐指数
1
解决办法
1万
查看次数

从elasticsearch查询返回所有文档

我的问题特定于我正在使用的“gopkg.in/olivere/elastic.v2”包。

我正在尝试返回与我的查询匹配的所有文档:

termQuery := elastic.NewTermQuery("item_id", item_id)
searchResult, err := es.client.Search().
    Index(index).
    Type(SegmentsType). // search segments type
    Query(termQuery).   // specify the query
    Sort("time", true). // sort by "user" field, ascending
    From(0).Size(9).
    Pretty(true). // pretty print request and response JSON
    Do()          // execute
if err != nil {
    // Handle error
    return timeline, err
}
Run Code Online (Sandbox Code Playgroud)

问题是如果我将大小增加到较大的大小,我会收到内部服务器错误。如果我消除了以下内容:

From(0).Size(9).
Run Code Online (Sandbox Code Playgroud)

然后使用默认值(10 个文档)。我怎样才能退回所有文件?

go elasticsearch

1
推荐指数
1
解决办法
3326
查看次数

标签 统计

c# ×1

elasticsearch ×1

excel ×1

go ×1