/*
i-net software provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties
of merchantability and/or fitness for a particular purpose. This programming example
assumes that you are familiar with the programming language being demonstrated and
the tools used to create and debug procedures. i-net software support professionals
can help explain the functionality of a particular procedure, but they will not modify
these examples to provide added functionality or construct procedures to meet your
specific needs.
� i-net software 1998-2013
*/
using System.Collections.Generic;
using System;
using Inet.Viewer.Data;
namespace Inet.Viewer
{
///
/// This enum defines the different available search options. This enum is build so the different
/// options can be used at the same time.
///
///
public enum SearchOption
{
///
/// By default there are no search options
///
None = 0,
///
/// searches the word in its entirety, not parts of the word
WholeWord = 1,
///
/// Distinguishes upper and lower cases in the search. E.g. "Search" != "search"
CaseSensitive = 2,
///
/// The search phrase is to be handled as a regular expression (using Java's Regex methods for the search)
RegularExpression = 4
}
///
/// This is the interface used by ReportViews to fetch the report data.
/// In order to create a working ReportView and add it to the ReportViewer, an instance of
/// ReportData must be given, which will then be used to fetch the report's render data.
///
/// Notes for implementing
/// - Implementations of this interface must be thread safe except for the methods
///
getExportChunkCount
and getNextExportChunk
.
/// - Note that each ReportView can have its own instance of ReportData, so the ReportData methods
/// may be called simultaneously for different ReportViews and different ReportData instances.
/// - Note that getCopy() should be implemented if extending from another ReportData, since
/// it otherwise will create an instance of the superclass rather than your own ReportData.
///
/// Implements ICloneable:
/// "Clones" this ReportData object with all its properties and returns the copy. Useful for deriving from existing
/// ReportData objects by copying them and adding or changing properties. This method is called by the viewer for drilling down,
/// for example - the drilldown property is set on the copy while all other properties remain the same, and the copy is used to
/// open a new report view.
public interface IRenderData : ICloneable
{
///
/// Sets the title of the report. This title is what would be typically displayed in a title bar, e.g. "Employee Report 2005".
/// Note that if this is not manually set, the title will be whatever the report has set as its title.
/// If a title is set, it overrides the "actual" report title.
/// Title of the report as simple string.
string ReportTitle { set; get; }
///
/// Sets the location of the report which this ReportData is to obtain its data for.
/// Any properties can be attached to the end using "=" for separating property name and value, and "&" for
/// separating the various properties, e.g. "...&init=pdf&promptABC=test..." The location may not be null.
/// The location at which the report can be found. May not be null. *
string ReportLocation { set; get; }
///
/// Returns the binary data of one page for the .NET Viewer. If refresh is false a cached version will be returned. with refresh set to true
/// the report will be enforced to be rerendered.
///
/// The page number. The first page is 1, the second is 2, ... .
/// If the page number is bigger than the page count the data from the last page will be returned.
///
/// If set to true enforces the whole report to be re-rendered on server side and returns the refreshed binary data. This
/// page is rendered anew rather than possibly taking a cached version.
/// /// The binary data of the page for the .NET Viewer, or possibly null if page number is not valid.
///
/// If an exception is returned from the server, it is wrapped in a ViewerException.
byte[] GetPageData(int page, bool refresh);
///
/// Returns the number of pages in the report.
/// This method blocks until the rendering process is finished. This is useful if you use i-net Clear Reports with
/// external result sets or connections and you want to know when the rendering process is finished and you can close
/// these external result sets or connections - once this method returns, the rendering process is finished.
/// Note that this method is thread-safe, that is, two or more threads concurrently calling
/// this method and the other thread-safe methods in ReportData should cause no problems.
///
/// number of pages (1-based)
/// If there are rendering problems, etc.
///
int GetPageCount();
///
/// Check if the rendering of the report ran into a page limit. This means does not all possible pages exist.
///
/// true, if there is a limit
/// If there are rendering problems, etc.
bool IsPageLimitExceeded { get; }
///
/// Returns the next chunk of the exported report if there is at least one more chunk available.
/// It is required that getExportChunkCount(Properties) has been called once for this report.
/// This method blocks until the rendering process of the requested chunk or the complete report is finished.
/// Next chunk of the report, or null if the export is finished.
///
/// If there are connection problems or other issues while fetching the data
byte[] NextExportChunk();
///
/// Returns the total number of export "chunks" for the report for the specified export format.
/// A "chunk" is a unit of export data which can be retrieved using getNextExportChunk().
/// This method blocks until the rendering process is finished on the server. Note that this method is
/// thread-safe, that is, two or more threads concurrently calling this method and the other
/// thread-safe methods in ReportData should cause no problems.
/// In case of gzip compression, the number of chunks can not be determined and "0" is returned.
/// The chunks can be retrieved in a loop until GetNextExportChunk() returns NULL.
///
/// Parameter to be appended to the current report Parameter for this export.
/// The Parameter should contain at least the export format with the key "export_fmt". The following
/// formats are valid:
/// "pdf" - pdf file
/// "rtf" - rtf file
/// "xls" - xls file
/// "csv" - csv file
/// "ps" - ps file
/// "xml" -xml file
/// "htm" - html files, The file name is the base filename, because there are more files with links.
/// For a complete list of report URL properties see the documentation.
///
/// Total number of export "chunks" (i.e. units) which can be fetched using getNextExportChunk()
///
///
/// If there are connection problems or other issues while fetching the data
int GetExportChunkCount(Dictionary exportParameter);
///
/// Returns the group tree which can be sent to the java viewer as a byte array.
/// Note that this method is thread-safe, that is, two or more threads concurrently calling this method and the other
/// thread-safe methods in ReportData should cause no problems.
/// byte[] Group Tree as byte array, encoded by i-net Clear Reports.
/// If there are connection problems or other issues while fetching the data
byte[] GetGrouptreeData();
///
/// Set or get the chosen URL parameter value which has been set either via setReportProperty or otherwise.
/// See report url parameters
/// for a list of possible properties to set here and what they mean.
/// Setting null as the value will cause the removal of the property. If a prompt property is
/// to be explicitly set to the value "null", simply set the string "formula:null" as the value.
///
/// Name of property to get value for
/// Value of property with the given name
string this[string key] { get; set; }
///
/// Sets the property "promptOnRefresh", that is, whether prompts are to be shown whenever the report is refreshed, that is,
/// whenever new data is fetched from the server.
/// Value to set for this property
bool PromptOnRefresh { set; get; }
///
/// Stops and cancels the rendering process if one is running. This command ends up
/// being passed through to i-net Clear Reports rendering engine and running Engine.stop.
///
void Stop();
///
/// Searches the given phrase in the report, starting at a certain page and using
/// the search options given in the flags. The flags
/// be combined with the OR operator "|". So, for example, to search with the flags WholeWord and CaseSensitive, use
/// "SearchOption.WholeWord | SearchOption.CaseSensitive" as option.
///
/// Note that phrases going over more than one page will not be found, nor will text
/// parts with formatting inside the word itself, such as this word.
/// Note that this method is thread-safe, that is, two or more threads concurrently calling
/// this method and the other thread-safe methods in ReportData should cause no problems.
///
/// Word or phrase to search. Should be a regular expression if this flag is set.
/// Page to start searching on (1-based)
/// Desired search options
/// Search result by the server, encoded in the i-net Clear Reports protocol.
byte[] Search(string phrase, int startPage, SearchOption flags);
///
/// Returns the byte array of the embedded font at the specified fontId,
/// which is encoded in the Viewer's protocol. You need not and should not call this method yourself - rather the Viewer
/// will call this method on its own when an embedded font needs to be fetched for the report.
/// The fontID is 1-based. null
will be returned if there are no fonts embedded for the
/// report of this Engine. If fontID is greater than the number of embedded
/// fonts available it will return the last font available. This method is the mirror method to com.inet.report.Engine.getFontData(int),
/// so implementations can either call that if an engine is available, or a running i-net Clear Reports server
/// also returns the font data with an HTTP request of the form
/// "http://server:9000/?report=report.rpt&export_fmt=font&page=FONTID&cmd=get_pg" where FONTID is replaced with the given font ID.
/// Note that this method is thread-safe, that is, two or more threads concurrently calling
/// this method and the other thread-safe methods in ReportData should cause no problems.
/// ID of font as specified in the i-net Clear Reports protocol
/// Partial or whole font with the ID, and with the most current version of this font known to the server.
byte[] GetFontData(int fontID);
///
/// Notifies the server that the report with the currently set properties is
/// still being viewed and therefore should not be removed from the cache yet
/// if there is one. This method does NOT cause the report to be re-rendered under
/// any circumstance, rather it resets the cache timeout on the server if there
/// is one.
/// This method will be called in regular intervals (default is every 5 minutes)
/// by its corresponding ReportView(s).
/// if resetting the cache timeout is not supported by the ReportData
/// implementation. This will cause the viewer to stop calling this method in regular intervals.
/// The state of this report on the server, or null if this is not supported (requires version 13.1)
ReportState Ping();
}
}