public void Client_PostWithTrackErrorsEnabledReturnsListOfErrors() { var dataSources = new Dictionary <string, DataSource>() { { "", new XmlDataSource("Url=http://windwardwebsitestorage.blob.core.windows.net/devtestfiles/web-based-templates/XML/SouthWind.xml;") } }; WebClient web = new WebClient(); using (var template = web.OpenRead("http://windwardwebsitestorage.blob.core.windows.net/devtestfiles/web-based-templates/XML/XML.docx")) { using (var output = new MemoryStream()) { var report = new ReportDocx(uri, template, output); report.TrackErrors = 3; report.Process(dataSources); Assert.AreEqual(3, report.Errors.Count); } } }
public void Client_PostODataSample() { var dataSources = new Dictionary <string, DataSource>() { { "", new ODataDataSource(new Uri("http://odata.windward.net/Northwind/Northwind.svc"), 2) } }; var templateFilePath = SampleTemplatesFolder + @"\ODataSample.docx"; var outputFilePath = SampleTemplatesFolder + @"\ODataOutput.docx"; using (var templateFile = File.OpenRead(templateFilePath)) { using (var outputFile = File.Create(outputFilePath)) { var report = new ReportDocx(uri, templateFile, outputFile); report.Process(dataSources); } } }
public void Client_PostSalesforceSample() { var dataSources = new Dictionary <string, DataSource>() { { "", new SalesforceDataSource("*****@*****.**", "w1ndw@rd", "BtqoH7pIR6rkR0fwh1YU156Hp") } }; var templateFilePath = SampleTemplatesFolder + @"\SalesforceSample.docx"; var outputFilePath = SampleTemplatesFolder + @"\SalesforceOutput.docx"; using (var templateFile = File.OpenRead(templateFilePath)) { using (var outputFile = File.Create(outputFilePath)) { var report = new ReportDocx(uri, templateFile, outputFile); report.Process(dataSources); } } }
public static void Request9() { var dataSources = new Dictionary <string, DataSource>() { { "", new ODataDataSource(new Uri("http://odata.windward.net/Northwind/Northwind.svc"), 2) } }; var templateFilePath = SampleTemplatesFolder + @"\ODataSample.docx"; var outputFilePath = string.Format(@"{0}\ODataOutput{1}.docx", SampleTemplatesFolder, rnd.Next()); using (var templateFile = File.OpenRead(templateFilePath)) { using (var outputFile = File.Create(outputFilePath)) { var report = new ReportDocx(uri, templateFile, outputFile); report.Process(dataSources); } } }
private string PrintDocx(string templateLoc, string outputLoc, string source, string catalog, string autoTagSource, string[] paramFields, string[] paramValues) { try { var ds = new AdoDataSource("System.Data.SqlClient", "Data Source = " + source + "; Integrated Security = True; Initial Catalog = " + catalog); ds.Variables = new List <TemplateVariable>(); for (int i = 0; i < paramFields.Length; i++) { ds.Variables.Add(new TemplateVariable() { Name = paramFields[i], Value = paramValues[i] }); } var dataSources = new Dictionary <string, DataSource>() { { autoTagSource, ds } }; using (var templateFile = File.OpenRead(templateLoc)) { using (var outputFile = File.Create(outputLoc)) { var report = new ReportDocx(MachineEnvironment(), templateFile, outputFile); report.Process(dataSources); } } return("0"); } catch (Exception e) { errorMessage = e.ToString(); return(errorMessage); } }