using OfficeIMO.Word; namespace OfficeIMO.Examples.Showcase.Workflows { /// Creates an editable managed service renewal with a decision, supporting table and named next actions. internal static class RenewalProposal { internal static void Create(string folder) { using var document = WordDocument.Create(Path.Combine(folder, "example.docx")); document.Settings.FontSize = global::OfficeIMO.OfficeLength.Points(11); document.Properties.Title = "Managed service renewal"; document.AddParagraph("Managed service renewal").Style = WordParagraphStyles.Heading1; document.AddParagraph("NORTHWIND / RENEWAL 2027 / DRAFT COMMERCIAL TERMS"); document.AddParagraph("Review the service commitments before renewing. This proposal keeps scope, price and the acceptance decision together."); document.AddParagraph("Service commitments").Style = WordParagraphStyles.Heading2; string[][] rows = { new[] { "Service", "Coverage", "Monthly fee", "Review evidence" }, new[] { "Request desk", "Business hours", "EUR 2,400", "Response-time report" }, new[] { "Platform care", "Weekly review", "EUR 1,100", "Change and incident log" }, new[] { "Recovery exercise", "Quarterly", "EUR 600", "Observed restore record" } }; var table = document.AddTable(rows.Length, 4, WordTableStyle.TableGrid); table.SetWidthPercentage(100); table.SetColumnWidthsPercentage(25, 20, 30, 25); for (int row = 0; row < rows.Length; row++) { for (int column = 0; column < 4; column++) { var cell = table.Rows[row].Cells[column]; cell.MarginTop = global::OfficeIMO.OfficeLength.Centimeters(0.14D); cell.MarginBottom = global::OfficeIMO.OfficeLength.Centimeters(0.14D); cell.MarginLeft = global::OfficeIMO.OfficeLength.Centimeters(0.16D); cell.MarginRight = global::OfficeIMO.OfficeLength.Centimeters(0.16D); cell.ShadingFillColor = OfficeColor.Parse(row == 0 ? "17365D" : row % 2 == 0 ? "F1F5F9" : "FFFFFF"); var paragraph = cell.Paragraphs[0]; paragraph.Text = rows[row][column]; paragraph.Bold = row == 0; paragraph.Color = OfficeColor.Parse(row == 0 ? "FFFFFF" : "243247"); paragraph.FontSize = global::OfficeIMO.OfficeLength.Points(10); paragraph.LineSpacingAfter = global::OfficeIMO.OfficeLength.Points(2D); } } document.AddParagraph("Term and exclusions").Style = WordParagraphStyles.Heading2; document.AddParagraph("Proposed term: 1 January to 31 December 2027. Fees are illustrative, exclude tax and are subject to an agreed statement of work. Project delivery, emergency cover and third-party licence costs are excluded."); document.AddParagraph("Next actions").Style = WordParagraphStyles.Heading2; var actions = document.AddList(WordListStyle.Bulleted); actions.AddItem("Service owner: confirm coverage hours and escalation contacts."); actions.AddItem("Procurement: review the renewal and notice periods."); actions.AddItem("Sponsor: record acceptance or request a revised scope."); foreach (var paragraph in document.Paragraphs) { bool title = paragraph.Style == WordParagraphStyles.Heading1; bool heading = paragraph.Style == WordParagraphStyles.Heading2; paragraph.FontSize = global::OfficeIMO.OfficeLength.Points(title ? 26 : heading ? 15 : 11); paragraph.LineSpacingBefore = global::OfficeIMO.OfficeLength.Points(heading ? 14 : 0); paragraph.LineSpacingAfter = global::OfficeIMO.OfficeLength.Points(title ? 14 : heading ? 8 : 7); if (title || heading) { paragraph.Color = OfficeColor.Parse("17365D"); paragraph.Bold = true; paragraph.KeepWithNext = true; } } WorkflowFooter.Add(document, "Managed service renewal"); document.Save(); } } }