private Document GenerateBody(SubmittedGeneralRegistrationForm Form, TimeZoneInfo TimeZone) { List <OpenXmlElement> pageParts = new List <OpenXmlElement>(); // Now add all the generated parts // The code for these parts is in /FormSections pageParts.AddRange(PageTitleSection.GetSection(Form, TimeZone)); pageParts.AddRange(SchoolAndGradeSection.GetSection(Form.Form.School, Form.Form.Grade)); pageParts.AddRange(SubmittedBySection.GetSection(Form.Form.SubmittedBy)); pageParts.AddRange(StudentInfoSection.GetSection(Form.Form.Student, TimeZone)); pageParts.AddRange(EnrolmentDetailsSection.GetSection(Form.Form.EnrollmentDetails)); pageParts.AddRange(SiblingSection.GetSection(Form.Form.Siblings)); pageParts.AddRange(EALSection.GetSection(Form.Form.EALInfo)); pageParts.AddRange(CitizenshipSection.GetSection(Form.Form.Citizenship)); pageParts.AddRange(FirstNationsSection.GetSection(Form.Form.FirstNationsInfo)); pageParts.AddRange(ContactsSection.GetSection(Form.Form.Contacts)); if (Form.Form.StVitalExtraRequirements != null) { pageParts.AddRange(StVitalExtraSection.GetSection(Form.Form.StVitalExtraRequirements)); } pageParts.AddRange(FormEndSection.GetSection(Form, TimeZone)); return(new Document(new Body(pageParts))); }
// For help with how to work with OpenXml documents: // https://docs.microsoft.com/en-us/office/open-xml/how-do-i public void Generate(SubmittedGeneralRegistrationForm Form, TimeZoneInfo TimeZone, string FileName) { if (File.Exists(FileName)) { File.Delete(FileName); } using (WordprocessingDocument document = WordprocessingDocument.Create(FileName, WordprocessingDocumentType.Document)) { // Create the main document part MainDocumentPart mainPart = document.AddMainDocumentPart(); LSSDDocumentStyles.AddStylesToDocument(document); mainPart.Document = GenerateBody(Form, TimeZone); } }
public string GenerateForm(SubmittedGeneralRegistrationForm Form, TimeZoneInfo TimeZone) { if (Form == null) { throw new Exception("Form cannot be null"); } string filename = Path.Combine(_tempDirPath, genFilename(Form)); GeneralRegistrationFormGenerator generator = new GeneralRegistrationFormGenerator(); // Generate the file generator.Generate(Form, TimeZone, filename); // Store the filename in the tracking list _generatedFileNames.Add(filename); // Return the filename return(filename); }
public static IEnumerable <OpenXmlElement> GetSection(SubmittedGeneralRegistrationForm Form, TimeZoneInfo timezone) { return(GetSection(Form, timezone, "LSSD K-12 Registration Form", Form.Id.ToString())); }
public GeneralRegistrationEmailNotification(SubmittedGeneralRegistrationForm Form, FormFactory Factory, TimeZoneInfo TimeZone) { this._form = Form; this._timeZone = TimeZone; this._factory = Factory; }