static void Main(string[] args) { // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/JSON - Template.docx"); FileStream output = File.Create("../../../Samples/Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // Connect to our JSON database IReportDataSource data = new JsonDataSourceImpl("http://json.windward.net/Northwind.json", JsonDataSourceImpl.MODE.CONNECTION_STRING); // Run the report process myReport.ProcessSetup(); // The second parameter is "" to tell the process that our data is the default data source myReport.ProcessData(data, ""); myReport.ProcessComplete(); // Close out of our template file and output output.Close(); template.Close(); // Opens the finished report string fullPath = Path.GetFullPath("../../../Samples/Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../../../Data/Samples/Source/WW-Common List.docx"); FileStream output = File.Create("../../../../../Data/Samples/Destination/Xml Common List.docx"); // Create report process Report myReport = new ReportPdf(template, output); // Open an inputfilestream for our data file FileStream Xml = File.OpenRead("../../../../../Data/Data Source/WW-Customers.xml"); // Open a data object to connect to our xml file IReportDataSource data = new XmlDataSourceImpl(Xml, false); // Run the report process myReport.ProcessSetup(); // The second parameter is "" to tell the process that our data is the default data source myReport.ProcessData(data, "Customers"); myReport.ProcessComplete(); // Close out of our template file and output output.Close(); template.Close(); Xml.Close(); // Opens the finished report string fullPath = Path.GetFullPath("../../../../../Data/Samples/Destination/Xml Common List.docx"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/template.docx"); FileStream output = File.Create("../../../Samples/Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // Salesforce data source SFDataSourceImpl data = new SFDataSourceImpl(@"*****@*****.**", @"w1ndw@rd", "BtqoH7pIR6rkR0fwh1YU156Hp", true); //run the report process myReport.ProcessSetup(); //the second parameter is the name of the data source myReport.ProcessData(data, "sfdemo"); myReport.ProcessComplete(); //close out of our template file and output output.Close(); template.Close(); // Open the finished report string fullPath = Path.GetFullPath("../../../Samples/Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/Windward Trucking 2 - Template.docx"); FileStream output = File.Create("../../../Samples/Xml Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // Open a data object to connect to our xml file string url = Path.GetFullPath("../../../Samples/Windward Trucking 2 - Data.xml"); string xsd = null; IReportDataSource data = new SaxonDataSourceImpl(string.Format("Url={0}", url), xsd); // Run the report process myReport.ProcessSetup(); // The second parameter is "" to tell the process that our data is the default data source myReport.ProcessData(data, "sax"); myReport.ProcessComplete(); // Close out of our template file and output data.Close(); output.Close(); template.Close(); // Opens the finished report string fullPath = Path.GetFullPath("../../../Samples/Xml Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { //Initialize the engine Report.Init(); //Open template file and create output file FileStream template = File.OpenRead("../../../Samples/Sharepoint with OData - Template.docx"); FileStream output = File.Create("../../../Samples/Sharepoint Report.pdf"); //Create report process Report myReport = new ReportPdf(template, output); //Run the report process myReport.ProcessSetup(); //Datasource connection code for 'ODataSample' (datasource name inside template) IReportDataSource ODataSampleData = new ODataDataSourceImpl("http://sharepointdemo.windward.net/_vti_bin/listdata.svc/", "windwarddemo\\demo", "demo", FileUtils.CONNECT_MODE.CREDENTIALS, 2); var dataSources = new Dictionary <string, IReportDataSource>() { { "sp", ODataSampleData } }; myReport.ProcessData(dataSources); myReport.ProcessComplete(); //Close out of our template file and output output.Close(); template.Close(); //Open the finished report string fullPath = Path.GetFullPath("../../../Samples/Sharepoint Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
public void MySQLReport() { // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/MySQL - Template.docx"); FileStream output = File.Create("../../../Samples/MySQL Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // MySQL data source string strConn = "server=mysql.windward.net;database=sakila;user id=test;password=test;"; IReportDataSource data = new AdoDataSourceImpl("MySql.Data.MySqlClient", strConn); //run the report process myReport.ProcessSetup(); //the second parameter is the name of the data source myReport.ProcessData(data, "MYSQL"); myReport.ProcessComplete(); //close out of our template file and output output.Close(); template.Close(); string fullPath = Path.GetFullPath("../../../Samples/MySQL Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
protected void Page_Load(object sender, EventArgs e) { string basePath = Request.PhysicalApplicationPath + "\\"; // Initialize the engine. License and configuration settings in web.config. Report.Init(); // Open template file FileStream template = File.OpenRead(basePath + "Oracle - Template.docx"); // Create report process Report myReport = new ReportPdf(template); // SQL data source string strConn = "Data Source=oracle.windward.net:1521;Persist Security Info=True;User ID=HR;Password=HR;"; // you can also use the "Oracle.ManagedDataAccess.Client" connector if installed (.NET 4.0 or later only) IReportDataSource data = new AdoDataSourceImpl("Oracle.DataAccess.Client", strConn); // Run the report process myReport.ProcessSetup(); //the second parameter is the name of the data source myReport.ProcessData(data, "ORACLE"); myReport.ProcessComplete(); // Close out of our template file template.Close(); // Opens the finished report //Response.ContentType = "application/pdf"; // this would have the pdf open in the browser (disable content-disposition:attachment if you want this) Response.ContentType = "application/save"; // this is used with content-disposition to give the proper name of the file Response.AppendHeader("content-disposition", "attachment; filename=\"Report.pdf\""); Response.BinaryWrite(((MemoryStream)myReport.GetReport()).ToArray()); Response.End(); // Must be called for MS Office documents }
public void DB2Report() { // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/Windward Trucking 2 - Template.docx"); FileStream output = File.Create("../../../Samples/Xml Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // Open an inputfilestream for our data file FileStream Xml = File.OpenRead("../../../Samples/Windward Trucking 2 - Data.xml"); // Open a data object to connect to our xml file IReportDataSource data = new XmlDataSourceImpl(Xml, false); // Run the report process myReport.ProcessSetup(); // The second parameter is "" to tell the process that our data is the default data source myReport.ProcessData(data, ""); myReport.ProcessComplete(); // Close out of our template file and output output.Close(); template.Close(); Xml.Close(); // Opens the finished report string fullPath = Path.GetFullPath("../../../Samples/Xml Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { // if connector is not installed, tell user if (!IsOracleDotNetConnectorInstalled) { throw new ApplicationException("Please install the Oracle ADO.NET connector to run this example. Details at http://rpt.me/OracleConnector"); } // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/Oracle - Template.docx"); FileStream output = File.Create("../../../Samples/Oracle Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // Oracle data source string strConn = "Data Source=oracle.windward.net:1521;Persist Security Info=True;User ID=HR;Password=HR;"; // you can also use the "Oracle.ManagedDataAccess.Client" connector if installed (.NET 4.0 or later only) IReportDataSource data = new AdoDataSourceImpl("Oracle.DataAccess.Client", strConn); //run the report process myReport.ProcessSetup(); //the second parameter is the name of the data source myReport.ProcessData(data, "ORACLE"); myReport.ProcessComplete(); //close out of our template file and output output.Close(); template.Close(); // Open the finished report string fullPath = Path.GetFullPath("../../../Samples/Oracle Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { // if connector is not installed, tell user if (!IsDb2DotNetConnectorInstalled) { throw new ApplicationException("Please install the DB2 ADO.NET connector to run this example. Details at http://rpt.me/DB2Connector"); } // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/DB2 - Templates.xlsx"); FileStream output = File.Create("../../../Samples/DB2 Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // DB2 data source string strConn = "server=db2.windward.net;database=Sample;User ID=demo;Password=demo;"; IReportDataSource data = new AdoDataSourceImpl("IBM.Data.DB2", strConn); //run the report process myReport.ProcessSetup(); //the second parameter is the name of the data source myReport.ProcessData(data, "DB2"); myReport.ProcessComplete(); //close out of our template file and output output.Close(); template.Close(); // Open the finished report string fullPath = Path.GetFullPath("../../../Samples/DB2 Report.pdf"); System.Diagnostics.Process.Start(fullPath); }
static void Main(string[] args) { // if connector is not installed, tell user if (!IsMySqlDotNetConnectorInstalled) { throw new ApplicationException("Please install the MySql ADO.NET connector to run this example. Details at http://rpt.me/MySqlConnector"); } // Initialize the engine Report.Init(); // Open template file and create output file FileStream template = File.OpenRead("../../../Samples/MySQL - Template.docx"); FileStream output = File.Create("../../../Samples/MySQL Report.pdf"); // Create report process Report myReport = new ReportPdf(template, output); // MySQL data source string strConn = "server=mysql.windward.net;database=sakila;user id=test;password=test;"; IReportDataSource data = new AdoDataSourceImpl("MySql.Data.MySqlClient", strConn); //run the report process myReport.ProcessSetup(); //the second parameter is the name of the data source myReport.ProcessData(data, "MYSQL"); myReport.ProcessComplete(); //close out of our template file and output output.Close(); template.Close(); // Open the finished report string fullPath = Path.GetFullPath("../../../Samples/MySQL Report.pdf"); System.Diagnostics.Process.Start(fullPath); }