下载Stimulsoft Reports Flex最新版本

此示例项目显示如何创建报表shapshot项目。为此,您可以使用reportsnapshots REST命令。作为参数,您需要指定命令缩进,报表快照名称和报表shapshot说明。这些参数可以作为请求发布数据传递。

#region Create Snapshot
url = "http://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

您可以使用以下方法向服务器发送请求并获取请求的结果。

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;
}

下面的屏幕截图中,您可以看到示例代码的结果。

【Stimulsoft Reports Server教程】创建报表快照

【Stimulsoft Reports Server教程】创建报表快照

下载示例

【Stimulsoft Reports Server教程】创建报表快照

相关文章:

  • 2022-01-07
  • 2021-04-19
  • 2022-01-17
  • 2021-08-02
  • 2021-04-15
  • 2021-11-16
  • 2022-01-01
  • 2021-05-29
猜你喜欢
  • 2021-11-19
  • 2021-07-24
  • 2021-04-02
  • 2021-05-17
  • 2021-04-23
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案