/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentWithTableGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public ChangesReportGenerator(DocumentGenerationInfo generationInfo, String foundryName, String fromDate, String toDate) : base(generationInfo) { this.foundryName = foundryName; this.fromDate = fromDate; this.toDate = toDate; }
/// <summary> /// Refreshes the document using sample doc generator using databinding. /// </summary> private static void RefreshDocumentUsingSampleDocGeneratorUsingDatabinding() { // Test document refresh from template("Test_Template1_Databinding_Out_BeforeRefresh.docx") DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleDocumentGeneratorUsingDatabinding", "1.0", GetDataContextRefresh(GetDataContext()), "Test_Template1_Databinding_Out_BeforeRefresh.docx", true); SampleDocumentGeneratorUsingDatabinding sampleDocumentGeneratorUsingDatabinding = new SampleDocumentGeneratorUsingDatabinding(generationInfo); byte[] result = sampleDocumentGeneratorUsingDatabinding.GenerateDocument(); WriteOutputToFile("Test_Template1_Databinding_Out_AfterRefresh.docx", "Test_Template1_Databinding_Out_BeforeRefresh.docx", result); }
/// <summary> /// Generates the document using sample doc with table generator using databinding. /// </summary> private static void GenerateDocumentUsingSampleDocWithTableGeneratorUsingDatabinding() { // Test document generation with table generation from template("Test_Template - 2.docx") DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleDocumentWithTableGeneratorUsingDatabinding", "1.0", GetDataContextRefresh(GetDataContext()), "Test_Template - 2.docx", true); SampleDocumentWithTableGeneratorUsingDatabinding sampleDocumentWithTableGeneratorUsingDatabinding = new SampleDocumentWithTableGeneratorUsingDatabinding(generationInfo); byte[] result = sampleDocumentWithTableGeneratorUsingDatabinding.GenerateDocument(); WriteOutputToFile("Test_Template2_Databinding_Table_Out.docx", "Test_Template - 2.docx", result); }
/// <summary> /// Refreshes the document using sample refreshable doc generator. /// </summary> private static void RefreshDocumentUsingSampleRefreshableDocGenerator() { // Test refreshable document refresh from template("Test_Template1_BeforeRefresh_Out.docx") DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleRefreshableDocumentGenerator", "1.0", GetDataContextRefresh(GetDataContext()), "Test_Template1_BeforeRefresh_Out.docx", false); SampleRefreshableDocumentGenerator sampleRefreshableDocumentGenerator = new SampleRefreshableDocumentGenerator(generationInfo); byte[] result = sampleRefreshableDocumentGenerator.GenerateDocument(); WriteOutputToFile("Test_Template1_AfterRefresh_Out.docx", "Test_Template1_BeforeRefresh_Out.docx", result); }
/// <summary> /// Generates the document using doc with table generator. /// </summary> private static void GenerateDocumentUsingDocWithTableAndChartsGenerator() { // Test refreshable document with table generation from template("Test_Template - 3.docx") DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleDocumentWithTableAndChartsGenerator", "1.0", GetDataContext(), "Test_Template - 3.docx", false); SampleDocumentWithTableAndChartsGenerator sampleDocumentWithTableAndChartsGenerator = new SampleDocumentWithTableAndChartsGenerator(generationInfo, GetDataForLineChart(), GetDataForScatterChart()); byte[] result = sampleDocumentWithTableAndChartsGenerator.GenerateDocument(); WriteOutputToFile("Test_Template3_Out.docx", "Test_Template - 3.docx", result); }
/// <summary> /// Generates the document using sample doc generator. /// </summary> private static void GenerateDocumentUsingSampleDocGenerator() { // Test document generation from template("Test_Template - 1.docx") DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleDocumentGenerator", "1.0", GetDataContext(), "Test_Template - 1.docx", false); SampleDocumentGenerator sampleDocumentGenerator = new SampleDocumentGenerator(generationInfo); byte[] result = result = sampleDocumentGenerator.GenerateDocument(); WriteOutputToFile("Test_Template1_Out.docx", "Test_Template - 1.docx", result); }
/// <summary> /// Gets the document generation info. /// </summary> /// <param name="docType">Type of the doc.</param> /// <param name="docVersion">The doc version.</param> /// <param name="dataContext">The data context.</param> /// <param name="fileName">Name of the file.</param> /// <param name="useDataBoundControls">if set to <c>true</c> [use data bound controls].</param> /// <returns></returns> private DocumentGenerationInfo GetDocumentGenerationInfo(string docType, string docVersion, object dataContext, string fileName, bool useDataBoundControls) { DocumentGenerationInfo generationInfo = new DocumentGenerationInfo(); generationInfo.Metadata = new DocumentMetadata() { DocumentType = docType, DocumentVersion = docVersion }; generationInfo.DataContext = dataContext; generationInfo.TemplateData = File.ReadAllBytes(Server.MapPath("~/ReportTemplates/" + fileName)); generationInfo.IsDataBoundControls = useDataBoundControls; return(generationInfo); }
/// <summary> /// Gets the document generation info. /// </summary> /// <param name="docType">Type of the doc.</param> /// <param name="docVersion">The doc version.</param> /// <param name="fileName">Name of the file.</param> /// <param name="useDataBoundControls">if set to <c>true</c> [use data bound controls].</param> /// <returns></returns> private static DocumentGenerationInfo GetDocumentGenerationInfo(string docType, string docVersion, string fileName, bool useDataBoundControls) { var generationInfo = new DocumentGenerationInfo(); generationInfo.Metadata = new DocumentMetadata() { DocumentType = docType, DocumentVersion = docVersion }; generationInfo.TemplateData = File.ReadAllBytes(fileName); generationInfo.IsDataBoundControls = useDataBoundControls; return(generationInfo); }
/// <summary> /// Gets the document generation info. /// </summary> /// <param name="docType">Type of the doc.</param> /// <param name="docVersion">The doc version.</param> /// <param name="dataContext">The data context.</param> /// <param name="fileName">Name of the file.</param> /// <param name="useDataBoundControls">if set to <c>true</c> [use data bound controls].</param> /// <returns></returns> private static DocumentGenerationInfo GetDocumentGenerationInfo(string docType, string docVersion, object dataContext, string fileName, bool useDataBoundControls) { DocumentGenerationInfo generationInfo = new DocumentGenerationInfo(); generationInfo.Metadata = new DocumentMetadata() { DocumentType = docType, DocumentVersion = docVersion }; generationInfo.DataContext = dataContext; generationInfo.TemplateData = File.ReadAllBytes(Path.Combine("Sample Templates", fileName)); generationInfo.IsDataBoundControls = useDataBoundControls; return(generationInfo); }
public AsamPpcGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { var excelDoc = SpreadsheetDocument.Open("ASAM PPC Assessment.xlsx", false); //var worksheet = excelDoc.WorkbookPart.Workbook.Sheets.First(); var sheetId = excelDoc.WorkbookPart.Workbook.Descendants <Sheet>().First(s => s.Name == @"Sheet1").Id; var lookupSheetId = excelDoc.WorkbookPart.Workbook.Descendants <Sheet>().First(s => s.Name == @"Sheet2").Id; var worksheet = (WorksheetPart)excelDoc.WorkbookPart.GetPartById(sheetId); var lookupWorkSheet = (WorksheetPart)excelDoc.WorkbookPart.GetPartById(lookupSheetId); _worksheetRows = worksheet.Worksheet.Descendants <Row>(); _lookupRows = lookupWorkSheet.Worksheet.Descendants <Row>(); _sharedStrings = excelDoc.WorkbookPart.SharedStringTablePart.SharedStringTable; }
/// <summary> /// Gets the document generation info. /// </summary> /// <param name="docType">Type of the doc.</param> /// <param name="docVersion">The doc version.</param> /// <param name="dataContext">The data context.</param> /// <param name="fileName">Name of the file.</param> /// <param name="useDataBoundControls">if set to <c>true</c> [use data bound controls].</param> /// <returns>Returns the Document generation Information</returns> private static DocumentGenerationInfo GetDocumentGenerationInfo(string docType, string docVersion, object dataContext, string fileName, bool useDataBoundControls) { DocumentGenerationInfo generationInfo = new DocumentGenerationInfo(); generationInfo.Metadata = new DocumentMetadata() { DocumentType = docType, DocumentVersion = docVersion }; generationInfo.DataContext = dataContext; DirectoryInfo di = new DirectoryInfo(System.Reflection.Assembly.GetExecutingAssembly().Location); generationInfo.TemplateData = File.ReadAllBytes(Path.Combine(di.Parent.FullName, fileName)); generationInfo.IsDataBoundControls = useDataBoundControls; return(generationInfo); }
protected void Page_Load(object sender, EventArgs e) { var reportTemplateName = Request.Params["Template"]; var IsFilmSizeInCms = Convert.ToBoolean(Request.Params["FilmSize"]); if (string.IsNullOrEmpty(reportTemplateName)) { return; } DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("FinalRGReportGenerator", "1.0", GetDataContext(), reportTemplateName, false); FinalRGReportGenerator sampleDocumentGenerator = new FinalRGReportGenerator(generationInfo); sampleDocumentGenerator.IsFilmSizeInCms = IsFilmSizeInCms; byte[] result = result = sampleDocumentGenerator.GenerateDocument(); var filePath = WriteOutputToFile("RadiographyReportTemplate_Out" + DateTime.Now.ToString("SSMIHH") + ".docx", result); using (var wordDocument = WordprocessingDocument.Open(filePath, true)) { wordDocument.ChangeDocumentType(WordprocessingDocumentType.Document); var mainDocumentPart = wordDocument.MainDocumentPart; var document = mainDocumentPart.Document; // Clean up: The user will appreciate a clean document! var helper = new OpenXmlHelper(DocumentGenerationInfo.NamespaceUri); helper.RemoveContentControlsAndKeepContents(document); document.Save(); } //download the file to the user string filename = "RTNo" + Request.Params["RTNo"] + ".docx"; Response.ContentType = "application/ms-word"; Response.AddHeader("content-disposition", "attachment; filename=" + filename); Response.TransmitFile(filePath); Response.Flush(); //clean up the file File.Delete(filePath); Response.End(); }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> /// <param name="placeHolderNameToContentControlXmlMetadataCollection">The place holder name to content control XML metadata collection.</param> /// <param name="isRefreshable">if set to <c>true</c> [is refreshable].</param> public SampleDocumentGeneratorUsingXmlAndDataBinding(DocumentGenerationInfo generationInfo, Dictionary <string, ContentControlXmlMetadata> placeHolderNameToContentControlXmlMetadataCollection, bool isRefreshable) : base(generationInfo) { this.placeHolderNameToContentControlXmlMetadataCollection = placeHolderNameToContentControlXmlMetadataCollection; this.isRefreshable = isRefreshable; }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentWithTableAndChartsGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> /// <param name="lineChartData">The line chart data.</param> /// <param name="scatterChartData">The scatter chart data.</param> public SampleDocumentWithTableAndChartsGenerator(DocumentGenerationInfo generationInfo, LineChartData lineChartData, ScatterChartData scatterChartData) : base(generationInfo) { this.lineChartData = lineChartData; this.scatterChartData = scatterChartData; }
/// <summary> /// Generates the document using sample generic doc generator using XML. /// </summary> private static void GenerateDocumentUsingSampleGenericDocGeneratorUsingXml() { // Test document generation from template("Test_Template - 1.docx") string dataAsXml = "<field>" + "<listFields>" + "<field orderName=\"Test Order\" orderDescription=\"Test Order Description\" id=\"\" contentControlTagREFS=\"PlaceholderNonRecursiveC PlaceholderNonRecursiveD\"/>" + "<field id=\"736d79d9-0689-419e-b27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderContainerA\">" + "<listFields>" + "<field id=\"736d79d9-0689-419e-b17a-1867f613fd80\" contentControlTagREFS=\"PlaceholderRecursiveA\">" + "<listFields>" + "<field vendorName=\"Vendor 1\" id=\"736d79d9-1689-419e-c27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA\"/>" + "<field vendorName=\"Vendor 2\" id=\"736d79d9-0589-419e-c27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA\"/>" + "</listFields>" + "</field>" + "<field id=\"736d79d9-0689-119e-b27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderRecursiveB\">" + "<listFields>" + "<field itemName=\"Item 1\" id=\"736d79d9-0689-419e-c27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 2\" id=\"736d79d9-0689-419e-b27a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "</listFields>" + "</field>" + "</listFields>" + "</field>" + "</listFields>" + "<contentControls>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveC\" refControlValue=\"orderName\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveD\" refControlValue=\"orderDescription\" refTagValue=\"id\"/>" + "<contentControl type=\"4\" tag=\"PlaceholderContainerA\" refTagValue=\"id\"/>" + "<contentControl type=\"1\" tag=\"PlaceholderRecursiveA\" refTagValue=\"id\"/>" + "<contentControl type=\"1\" tag=\"PlaceholderRecursiveB\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveA\" refControlValue=\"vendorName\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveB\" refControlValue=\"itemName\" refTagValue=\"id\"/>" + "</contentControls>" + "</field>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(dataAsXml); DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleGenericDocumentGeneratorUsingXml", "1.0", xmlDoc.DocumentElement, "Test_Template - 1.docx", false); SampleGenericDocumentGeneratorUsingXml sampleGenericDocumentGeneratorUsingXml = new SampleGenericDocumentGeneratorUsingXml(generationInfo); byte[] result = sampleGenericDocumentGeneratorUsingXml.GenerateDocument(); WriteOutputToFile("SampleGenericDocumentGeneratorUsingXml1.docx", "Test_Template - 1.docx", result); // Test document generation from template("Test_Template - 2.docx") dataAsXml = "<field>" + "<listFields>" + "<field orderName=\"Test Order\" orderDescription=\"Test Order Description\" id=\"\" contentControlTagREFS=\"PlaceholderNonRecursiveC PlaceholderNonRecursiveD\"/>" + "<field id=\"736d79d9-0689-419e-b27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderContainerA\">" + "<listFields>" + "<field id=\"736d79d9-0689-419e-b17a-1867f613fd80\" contentControlTagREFS=\"PlaceholderRecursiveA VendorDetailRow\">" + "<listFields>" + "<field vendorName=\"Vendor 1\" id=\"736d79d9-1689-419e-c87a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 2\" id=\"736d79d9-0589-419e-c77a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 3\" id=\"736d79d9-0589-419e-c67a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 4\" id=\"736d79d9-0589-419e-c57a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 5\" id=\"736d79d9-0589-419e-c47a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 6\" id=\"736d79d9-0589-419e-c37a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 7\" id=\"736d79d9-0589-419e-c27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "<field vendorName=\"Vendor 8\" id=\"736d79d9-0589-419e-c17a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveA VendorId VendorName\"/>" + "</listFields>" + "</field>" + "<field id=\"736d79d9-0689-119e-b27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderRecursiveB\">" + "<listFields>" + "<field itemName=\"Item 1\" id=\"736d79d9-0689-419e-c27a-1867f613fd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 2\" id=\"736d79d9-0689-419e-b27a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 3\" id=\"736d79d9-0689-419e-b12a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 4\" id=\"736d79d9-0689-419e-b22a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 5\" id=\"736d79d9-0689-419e-b43a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 6\" id=\"736d79d9-0689-419e-b87a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 7\" id=\"736d79d9-0689-419e-b98a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "<field itemName=\"Item 8\" id=\"736d79d9-0689-419e-b19a-1867f613dd80\" contentControlTagREFS=\"PlaceholderNonRecursiveB\" />" + "</listFields>" + "</field>" + "</listFields>" + "</field>" + "</listFields>" + "<contentControls>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveC\" refControlValue=\"orderName\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveD\" refControlValue=\"orderDescription\" refTagValue=\"id\"/>" + "<contentControl type=\"4\" tag=\"PlaceholderContainerA\" refTagValue=\"id\"/>" + "<contentControl type=\"1\" tag=\"PlaceholderRecursiveA\" refTagValue=\"id\"/>" + "<contentControl type=\"1\" tag=\"PlaceholderRecursiveB\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveA\" refControlValue=\"vendorName\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"PlaceholderNonRecursiveB\" refControlValue=\"itemName\" refTagValue=\"id\"/>" + "<contentControl type=\"1\" tag=\"VendorDetailRow\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"VendorId\" refControlValue=\"id\" refTagValue=\"id\"/>" + "<contentControl type=\"2\" tag=\"VendorName\" refControlValue=\"vendorName\" refTagValue=\"id\"/>" + "</contentControls>" + "</field>"; xmlDoc = new XmlDocument(); xmlDoc.LoadXml(dataAsXml); generationInfo = GetDocumentGenerationInfo("SampleGenericDocumentGeneratorUsingXml", "2.0", xmlDoc.DocumentElement, "Test_Template - 2.docx", false); sampleGenericDocumentGeneratorUsingXml = new SampleGenericDocumentGeneratorUsingXml(generationInfo); result = sampleGenericDocumentGeneratorUsingXml.GenerateDocument(); WriteOutputToFile("SampleGenericDocumentGeneratorUsingXml2.docx", "Test_Template - 2.docx", result); }
/// <summary> /// Generates the document using sample doc generator using XML. /// </summary> private static void GenerateDocumentUsingSampleDocGeneratorUsingXmlAndDatabinding() { // Generate Content Controls using Xml Dictionary <string, ContentControlXmlMetadata> placeHolderTagToContentControlXmlMetadataCollection = new Dictionary <string, ContentControlXmlMetadata>(); // Handle ignore placeholders placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderIgnoreA, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderIgnoreA, Type = PlaceHolderType.Ignore }); placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderIgnoreB, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderIgnoreA, Type = PlaceHolderType.Ignore }); // Handle container placeholders placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderContainerA, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderContainerA, Type = PlaceHolderType.Container, ControlTagXPath = "./Id[1]" }); // Handle recursive placeholders placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderRecursiveA, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderRecursiveA, Type = PlaceHolderType.Recursive, ControlValueXPath = "./vendors[1]" }); placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderRecursiveB, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderRecursiveB, Type = PlaceHolderType.Recursive, ControlValueXPath = "./items[1]" }); // Handle non recursive placeholders placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderNonRecursiveA, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderNonRecursiveA, Type = PlaceHolderType.NonRecursive, ControlTagXPath = "./Id[1]", ControlValueXPath = "/ns0:DocumentRootNode[1]/ns0:DataBoundControlsDataStore[1]/ns0:Data[1]/Order[1]/vendors[1]/Vendor[{0}]/Name[1]" }); placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderNonRecursiveB, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderNonRecursiveB, Type = PlaceHolderType.NonRecursive, ControlTagXPath = "./Id[1]", ControlValueXPath = "/ns0:DocumentRootNode[1]/ns0:DataBoundControlsDataStore[1]/ns0:Data[1]/Order[1]/items[1]/Item[{0}]/Name[1]" }); placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderNonRecursiveC, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderNonRecursiveC, Type = PlaceHolderType.NonRecursive, ControlTagXPath = "./Id[1]", ControlValueXPath = "/ns0:DocumentRootNode[1]/ns0:DataBoundControlsDataStore[1]/ns0:Data[1]/Order[1]/Name[1]" }); placeHolderTagToContentControlXmlMetadataCollection.Add(PlaceholderNonRecursiveD, new ContentControlXmlMetadata() { PlaceHolderName = PlaceholderNonRecursiveD, Type = PlaceHolderType.NonRecursive, ControlTagXPath = "./Id[1]", ControlValueXPath = "/ns0:DocumentRootNode[1]/ns0:DataBoundControlsDataStore[1]/ns0:Data[1]/Order[1]/Description[1]" }); // Test document generation from template("Test_Template - 1.docx") string dataAsXml = "<Order><vendors><Vendor><Id>469c8927-6a68-4f16-b267-acaf38fc2d39</Id><Name>Vendor 1</Name></Vendor><Vendor><Id>48e1f6d0-5060-4725-ae45-51e81b2e89d6</Id><Name>Vendor 2</Name></Vendor><Vendor><Id>b59d289f-93b3-4d03-81f0-e6f49657e611</Id><Name>Vendor 111</Name></Vendor><Vendor><Id>165d4fe3-d445-47ac-b40e-3611a40c4845</Id><Name>Vendor 222</Name></Vendor><Vendor><Id>6d950039-075b-47ea-96f0-6088feca5c9b</Id><Name>Vendor 113</Name></Vendor><Vendor><Id>fe31e8f1-0927-4780-8843-0e166977a505</Id><Name>Vendor 224</Name></Vendor><Vendor><Id>a9edafc3-9117-4499-8820-806ec59a0bc9</Id><Name>Vendor 115</Name></Vendor><Vendor><Id>7eca4fc3-5218-4090-a1cf-10db411b668e</Id><Name>Vendor 226</Name></Vendor><Vendor><Id>8d491555-da72-41a3-ad77-7c001e93b052</Id><Name>Vendor 117</Name></Vendor><Vendor><Id>08654a92-601c-4c38-9218-00a54bc44ec6</Id><Name>Vendor 228</Name></Vendor></vendors><items><Item><Id>81474c98-0094-499d-88d7-678f40581b50</Id><Name>Item 1</Name></Item><Item><Id>60a5d7bc-304a-49fa-be4a-684f91adf6c5</Id><Name>Item 2</Name></Item><Item><Id>bc9d5b75-3861-4bf8-bb26-35689e6b557a</Id><Name>Item 11</Name></Item><Item><Id>72fafb82-179d-4115-a4e7-84bf1a62049d</Id><Name>Item 21</Name></Item></items><Id>736d79d9-0689-419e-b27a-1867f613fd80</Id><Name>Test Order</Name><Description>Test Order Description</Description></Order>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(dataAsXml); xmlDoc.Schemas.Add(null, @"Test Data\TestDataSchema.xsd"); xmlDoc.Validate(ValidationCallBack, xmlDoc.DocumentElement); DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SampleDocumentGeneratorUsingXmlAndDataBinding", "1.0", xmlDoc.DocumentElement, "Test_Template - 1.docx", true); SampleDocumentGeneratorUsingXmlAndDataBinding sampleDocumentGeneratorUsingXmlAndDataBinding = new SampleDocumentGeneratorUsingXmlAndDataBinding(generationInfo, placeHolderTagToContentControlXmlMetadataCollection, false); byte[] result = sampleDocumentGeneratorUsingXmlAndDataBinding.GenerateDocument(); WriteOutputToFile("SampleDocumentGeneratorUsingXmlAndDataBinding.docx", "Test_Template - 1.docx", result); }
public SensitiveDocumentGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { this.generationInfo = generationInfo; }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentWithTableGeneratorUsingDatabinding"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public SampleDocumentWithTableGeneratorUsingDatabinding(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
/// <summary> /// Initializes a new instance of the <see cref="SampleGenericDocumentGeneratorUsingXml"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public SampleGenericDocumentGeneratorUsingXml(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
public BuildNotesDocumentGenerator(DocumentGenerationInfo generationInfo, List <string> exclusions) : base(generationInfo, exclusions) { }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentWithTableGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public SampleDocumentWithTableGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentWithTableGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public DummyAddressStickerGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
public NonSensitiveDocumentGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> /// <param name="placeHolderNameToContentControlXmlMetadataCollection">The place holder name to content control XML metadata collection.</param> public SampleDocumentGeneratorUsingXml(DocumentGenerationInfo generationInfo, Dictionary <string, ContentControlXmlMetadata> placeHolderNameToContentControlXmlMetadataCollection) : base(generationInfo) { this.placeHolderNameToContentControlXmlMetadataCollection = placeHolderNameToContentControlXmlMetadataCollection; }
/// <summary> /// Initializes a new instance of the <see cref="SampleDocumentWithTableGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public RGReportGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
public SensitiveDocumentGeneratorOLD(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
/// <summary> /// Initializes a new instance of the <see cref="SampleRefreshableDocumentGenerator"/> class. /// </summary> /// <param name="generationInfo">The generation info.</param> public SampleRefreshableDocumentGenerator(DocumentGenerationInfo generationInfo) : base(generationInfo) { }
// Content Control Tags //public const string PlaceholderIgnoreA = "PlaceholderIgnoreA"; //public const string PlaceholderIgnoreB = "PlaceholderIgnoreB"; //public const string PlaceholderContainerA = "PlaceholderContainerA"; //public const string PlaceholderRecursiveA = "PlaceholderRecursiveA"; //public const string PlaceholderRecursiveB = "PlaceholderRecursiveB"; //public const string PlaceholderNonRecursiveA = "PlaceholderNonRecursiveA"; //public const string PlaceholderNonRecursiveB = "PlaceholderNonRecursiveB"; //public const string PlaceholderNonRecursiveC = "PlaceholderNonRecursiveC"; //public const string PlaceholderNonRecursiveD = "PlaceholderNonRecursiveD"; //public const string PlaceholderNonRecursiveE = "PlaceholderNonRecursiveE"; //public const string PlaceholderNonRecursiveF = "PlaceholderNonRecursiveF"; //public const string PlaceholderNonRecursiveG = "PlaceholderNonRecursiveG"; //public const string PlaceholderNonRecursiveH = "PlaceholderNonRecursiveH"; //public const string PlaceholderNonRecursiveI = "PlaceholderNonRecursiveI"; //public const string PlaceholderNonRecursiveJ = "PlaceholderNonRecursiveJ"; //public const string PlaceholderNonRecursiveK = "PlaceholderNonRecursiveK"; //public const string PlaceholderNonRecursiveL = "PlaceholderNonRecursiveL"; //public const string PlaceholderNonRecursiveM = "PlaceholderNonRecursiveM"; //public const string PlaceholderNonRecursiveN = "PlaceholderNonRecursiveN"; #endregion //public DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo("SomeDocDocumentGenerator", "1.0", GetDataContext(), "body.docx", false); public MyDocGenerator2(DocumentGenerationInfo generationInfo) : base(generationInfo) { }