翻譯|使用教程|編輯:王香|2019-01-14 11:10:01.000|閱讀 574 次
概述:此示例項目顯示如何創(chuàng)建報表shapshot項目。為此,您可以使用reportsnapshots REST命令。作為參數(shù),您需要指定命令縮進,報表快照名稱和報表shapshot說明。這些參數(shù)可以作為請求發(fā)布數(shù)據(jù)傳遞。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
此示例項目顯示如何創(chuàng)建報表shapshot項目。為此,您可以使用reportsnapshots REST命令。作為參數(shù),您需要指定命令縮進,報表快照名稱和報表shapshot說明。這些參數(shù)可以作為請求發(fā)布數(shù)據(jù)傳遞。
#region Create Snapshot url = "//localhost:40010/1/reportsnapshots"; var requestCreateSnapshot = WebRequest.Create(url); requestCreateSnapshot.Method = "POST"; requestCreateSnapshot.ContentType = "application/x-www-form-urlencoded"; requestCreateSnapshot.Headers.Add("x-sti-SessionKey", sessionKey); postData = "{'Ident': 'ReportSnapshotItem', 'Name': 'ReportSnapshot01', 'Description': ''}"; Request(requestCreateSnapshot, postData); // Check Result var s = GetResponseResult(requestCreateSnapshot); json = JObject.Parse(s); var items = ((JArray)json["Items"]); #endregion
您可以使用以下方法向服務(wù)器發(fā)送請求并獲取請求的結(jié)果。
private void Request(WebRequest request, string postData) { var bytesCreateSnapshot = Encoding.GetEncoding(1251).GetBytes(postData); request.ContentLength = bytesCreateSnapshot.Length; using (Stream ws = request.GetRequestStream()) { ws.Write(bytesCreateSnapshot, 0, bytesCreateSnapshot.Length); ws.Flush(); } } private string GetResponseResult(WebRequest request) { var resp = request.GetResponse(); var respStream = resp.GetResponseStream(); if (respStream != null) { using (var stream1 = new StreamReader(respStream)) { var s = stream1.ReadToEnd(); return s; } } return null; }
下面的屏幕截圖中,您可以看到示例代碼的結(jié)果。
購買Stimulsoft正版授權(quán),請點擊“”喲!
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn