Open Excel Document from Stream

I am getting my excel docs as a byte[] (blobs) and rather than write it out to disk, then open it I was looking for a way to open straight from the stream. Googling brought me several results like http://msdn.microsoft.com/en-us/library/office/ff478410(v=office.14).aspx which is proper as we have office 2010 installed on target machines. First thing I do is go to add a reference to DocumentFor

从流中打开Excel文档

我得到我的Excel文档作为一个字节[](斑点),而不是写出来的磁盘,然后打开它,我正在寻找一种方式直接从流中打开。 谷歌搜索给我带来了几个结果,如http://msdn.microsoft.com/en-us/library/office/ff478410(v=office.14).aspx这是正确的,因为我们已经在目标机器上安装了Office 2010。 我要做的第一件事就是添加一个对DocumentFormat的引用,但它没有列出? 我必须浏览到二进制文件才能添加它吗? 但是严重的Msoft只提

How to call asynchronous method from synchronous method in C#?

I have a public async void Foo() method that I want to call from synchronous method. So far all I have seen from MSDN documentation is calling async methods via async methods, but my whole program is not built with async methods. Is this even possible? Here's one example of calling these methods from an asynchronous method: http://msdn.microsoft.com/en-us/library/hh300224(v=vs.110).aspx

如何在C#中使用同步方法调用异步方法?

我有一个public async void Foo()方法,我想从同步方法调用。 到目前为止,我从MSDN文档中看到的所有方法都是通过异步方法调用异步方法,但是我的整个程序不是使用异步方法构建的。 这甚至有可能吗? 以下是从异步方法调用这些方法的一个示例:http://msdn.microsoft.com/zh-cn/library/hh300224(v=vs.110).aspx 现在我正在考虑从同步方法调用这些异步方法。 异步编程通过代码库“增长”。 它已被比作僵尸病毒。 最好的

Byte Array to Bitmap Image

I made this code to receive an image and convert it to bitmap image but it doesn't work. Here is the code: public void ReceiveImage() { NetworkStream stream = new NetworkStream(socket); byte[] data = new byte[4]; stream.read(data,0,data.length,0) int size = BitConverter.ToInt32(data,0); data = new byte[size]; stream.read(data,0,data.length) MemoryStream imagestr

字节数组到位图图像

我制作了这段代码来接收图像并将其转换为位图图像,但它不起作用。 代码如下: public void ReceiveImage() { NetworkStream stream = new NetworkStream(socket); byte[] data = new byte[4]; stream.read(data,0,data.length,0) int size = BitConverter.ToInt32(data,0); data = new byte[size]; stream.read(data,0,data.length) MemoryStream imagestream = new MemoryStream(data); Bit

data post image and json same time

I'm trying to upload image and json in one request using c# code, but server always returns 400- bad request. Executing same request using fiddler returns status code 200. help... Here is my fiddler code : ------WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="application/json" Content-Type: application/json {"type": "Personal",&quo

数据发布图像和json同一时间

我试图使用C#代码在一个请求中上传图像和json,但服务器总是返回400-错误的请求。 使用fiddler执行相同的请求将返回状态码200. help ... 这是我的提琴手代码: ------ WebKitFormBoundary7MA4YWxkTrZu0gW内容处理:form-data; name =“application / json”Content-Type:application / json { “类型”: “个人”, “注释”:[ “的Lorem”, “存有”]} ------ WebKitFormBoundary7MA4YWxkTrZu0gW--内容处置:形状数据; NAME =

Post File and form data to form c#

I am trying to upload a file to a REST endpoint using .NET C#. I have tried numerous permutations seen here on SO and other forums with no success. The closest I get is a 400 response from the server. I could post the code i've tried, but it's well over 200 lines of garbled mess accumulated over about 8 hours, see links below for what i've tried. The form below is located at http

发布文件和表单数据以形成c#

我正尝试使用.NET C#将文件上载到REST端点。 我尝试过在SO和其他论坛上看到无数排列,但都没有成功。 我得到的最接近的是来自服务器的400响应。 我可以发布我已经尝试过的代码,但它已经累积了大约8个小时的200多行乱码,请参阅下面的链接以了解我所尝试的内容。 下面的表格位于https://domain.com/fileAttachments/formData/ 表单HTML: <form action="https://domain.com/fileAttachments" method="POST" enctype="

data parser in C#

I am just trying to write a multipart parser but things getting complicated and want to ask if anyone knows of a ready parser in C#! Just to make clear, I am writing my own "tiny" http server and need to pars multipart form-data too! Thanks in advance, Gohlool I open-sourced a C# Http form parser here. This is slightly more flexible than the other one mentioned which is on CodeP

数据解析器在C#中

我只是想编写一个多部分分析器,但事情变得复杂,并且想问问任何人是否知道C#中的现成解析器! 为了说清楚,我正在编写自己的“微型”http服务器,并且还需要解析多部分表单数据! 在此先感谢Gohlool 我在这里开源了一个C#Http表单解析器。 这比CodePlex中提到的另一个稍微灵活一些,因为您可以将它用于Multipart和Non-Multipart form-data ,并且还可以为您提供格式化为Dictionary对象的其他表单参数。 这可以使用如

Reading file input from a multipart/form

I'm POSTing a file to a WCF REST service through a HTML form, with enctype set to multipart/form-data and a single component: <input type="file" name="data"> . The resulting stream being read by the server contains the following: ------WebKitFormBoundary Content-Disposition: form-data; name="data"; filename="DSCF0001.JPG" Content-Type: image/jpeg <file bytes>

从多部分/表格读取文件输入

我通过HTML表单将文件发布到WCF REST服务, enctype设置为multipart/form-data和单个组件: <input type="file" name="data"> 。 由服务器读取的结果流包含以下内容: ------WebKitFormBoundary Content-Disposition: form-data; name="data"; filename="DSCF0001.JPG" Content-Type: image/jpeg <file bytes> ------WebKitFormBoundary-- 问题是我不确定如何从流中提取文件字节。 我需要

Find word which was the match

I have this code where I search a string for words from an array: string wordlist = synonymslistbox.Items[q_index].ToString().Split(':')[0].Replace(',', ' '); var pattern = new Regex(@"W"); var qa = pattern.Split(first_sentence).Any(w => wordlist.Contains(w)); Now I would like to achieve two things which I cannot figure out how to do. Find out which word was a match. This code just retu

找到匹配的词

我有这样的代码,我从一个数组中搜索字符串: string wordlist = synonymslistbox.Items[q_index].ToString().Split(':')[0].Replace(',', ' '); var pattern = new Regex(@"W"); var qa = pattern.Split(first_sentence).Any(w => wordlist.Contains(w)); 现在我想实现两件事情,我不知道该怎么做。 找出哪个词是匹配的。 如果找到此代码,则返回true 。 当first_sentences是i like my banjo它不应该在banjo找到字

Left Outer Join lambda expression error

I have the following tables: Table1 { Code //string Desc //string } Table2 { Code //string Value //decimal? } I need to Left Join the tables and for each Table2 Code/Value missing I want to show Code = Table1.Code, Desc = Table1.Desc and Value = null or blank. I tryied the following lambda expression: var result = Table1.GroupJoin( Table2,

左外连接lambda表达式错误

我有以下表格: Table1 { Code //string Desc //string } Table2 { Code //string Value //decimal? } 我需要左加入表和每个表2 Code / Value missing我想要显示Code = Table1.Code,Desc = Table1.Desc和Value = null或空白。 我尝试了下面的lambda表达式: var result = Table1.GroupJoin( Table2, x => x.Code, y => y.Code,

Unable to use use .Except on two List<String>

I am working on an asp.net mvc-5 web applicatio. i have these two model classes:- public class ScanInfo { public TMSServer TMSServer { set; get; } public Resource Resource { set; get; } public List<ScanInfoVM> VMList { set; get; } } public class ScanInfoVM { public TMSVirtualMachine TMSVM { set; get; } public Resource Resource { set;

无法使用use.Except两个List <String>

我正在研究一个asp.net mvc-5 web应用程序。 我有这两个模型类: - public class ScanInfo { public TMSServer TMSServer { set; get; } public Resource Resource { set; get; } public List<ScanInfoVM> VMList { set; get; } } public class ScanInfoVM { public TMSVirtualMachine TMSVM { set; get; } public Resource Resource { set; get; } } 我