Передача файлов веб-сервису.
От: Аноним  
Дата: 17.10.04 13:11
Оценка:
WebService :

[WebMethod]
public void PutExcelFile(string filename,byte[] b)
{
if (filename!=null && b!=null)
{
using (FileStream fsWrite = new FileStream(@"C:\Dokumente und Einstellungen\xxx\Eigene Dateien\Visual Studio Projects\csharp\office\ExcelWS\"+filename,FileMode.Create,FileAccess.ReadWrite))
{
fsWrite.Write(b,0,b.Length);
fsWrite.Flush();
}
}
}

--------------------------------------------------------------------------

WSClient

protected void ThisWorkbook_BeforeClose(ref bool Cancel)
{
byte[] b = null;
string fullname = thisWorkbook.FullName+".xml";
string shortname = thisWorkbook.Name;
if (fullname!=null && fullname!=string.Empty)
{
this.thisWorkbook.SaveCopyAs(fullname);
FileStream fsRead =null;
try
{
fsRead = new FileStream(fullname,FileMode.Open,FileAccess.Read);
b = new byte[fsRead.Length];
while (fsRead.Read(b,0,b.Length) > 0);
ExcelWS.ExcelWS proxy = new ExcelWS.ExcelWS();
proxy.PutExcelFile(shortname,b);
}
catch(Exception ex)
{
string s = ex.Message+"\n";
s+=ex.StackTrace;
}
finally
{
if (fsRead!=null) fsRead.Close();
}
}
Cancel = false;
}

-- Это всё мое личное мнение которое может не совпадать с Вашим или может быть ошибочным --
.NetCoder


данное сообщение получено с www.gotdotnet.ru
ссылка на оригинальное сообщение
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.