繁体   English   中英

exceldna和C#的Web服务

[英]webservice with exceldna and c#

我正在使用Java Web服务。 我使用我使用c#和excel-dna制作的Excel函数来使用它。 问题是每次我调用函数add I get (#valeur)

这是我的C#代码源:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ExcelDna.Integration;
using System.Diagnostics;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace MyLibrary
{
    public class Class1
    {
        [ExcelFunction(Description = "adds two terms")]
        public static int add(int a, int b)
        {

            ServiceReference1.ServerImplClient client =
                new ServiceReference1.ServerImplClient();
            return client.addition(a, b);
        }
    }
}

服务参考已包括在内,dna和xll文件也已包含在内。

逐步调试此步骤。 要从Visual Studio调试Excel DNA方法,您需要:

  • 调出您的Excel; 确保已加载的XLL是bin目录中的XLL
  • 在Visual Studio中“附加”到excel进程(工具->附加到进程或Ctrl-Alt-p)
  • 在函数的开头放置一个断点(如果加载了正确的XLL,则该断点将是一个实心圆;如果未加载,则加载的XLL是一个不同的圆)

如果随后调用函数但未达到断点,则可能传递了错误的参数类型(注意:Excel中的所有数值均为双精度型-您始终可以使用对象参数并检查其中的参数)您的功能)。

如果确实起作用,那么您可以按常规方式浏览客户代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM