Report samples
Métodos
Sección titulada «Métodos»getReports
Sección titulada «getReports»Descripción:
| Método | Valores de retorno | Descripción |
|---|---|---|
| getReports(boolean active) | List |
Devuelve una lista de informes. |
Ejemplo:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;
namespace OKMRest{ public class Program { static void Main(string[] args) { String host = "http://localhost:8080/OpenKM"; String username = "okmAdmin"; String password = "admin"; OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password); try { List<Report> reports = ws.getReports(true); foreach (Report rep in reports) { System.Console.WriteLine(rep); } } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}getReport
Sección titulada «getReport»Descripción:
| Método | Valores de retorno | Descripción |
|---|---|---|
| getReport(long rpId) | Report | Devuelve un informe. |
Ejemplo:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.bean;
namespace OKMRest{ public class Program { static void Main(string[] args) { String host = "http://localhost:8080/OpenKM"; String username = "okmAdmin"; String password = "admin"; OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password); try { Report rep = ws.getReport(12); System.Console.WriteLine(rep); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}executeReport
Sección titulada «executeReport»Descripción:
| Método | Valores de retorno | Descripción |
|---|---|---|
| executeReport(long rpId, Dictionary<String, String> params, String format) | Stream | Devuelve un documento resultante de ejecutar un informe. |
Ejemplo:
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using com.openkm.sdk4csharp;using com.openkm.sdk4csharp.util;
namespace OKMRest{ public class Program { static void Main(string[] args) { String host = "http://localhost:8080/OpenKM"; String username = "okmAdmin"; String password = "admin"; OKMWebservice ws = OKMWebservicesFactory.newInstance(host, username, password); try { Dictionary<String, String> param = new Dictionary<String, String>(); param.Add("from_date", "2016-01-01"); param.Add("to_date", "2016-12-23"); String format = Report.FORMAT_PDF; Stream stream = ws.executeReport(7,format, param);
BeanHelper beanHelper = new BeanHelper(); Byte[] data = beanHelper.ReadToEnd(stream); FileStream fileStream = new FileStream(@"C:\Desktop\out.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite); foreach (byte b in data) { fileStream.WriteByte(b); } fileStream.Close(); } catch (Exception e) { System.Console.WriteLine(e.ToString()); } } }}