using OfficeIMO.Word; namespace OfficeIMO.Examples.Showcase.Workflows; /// Creates a short policy brief with reusable heading structure and bullet lists. internal static class PolicyBrief { internal static void Create(string folder) { using WordDocument document = WordDocument.Create(Path.Combine(folder, "example.docx")); document.Settings.FontSize = global::OfficeIMO.OfficeLength.Points(11); document.Properties.Title = "Shared workspace guide"; document.Properties.Subject = "Working agreements"; document.AddParagraph("Shared workspace guide").Style = WordParagraphStyles.Heading1; document.AddParagraph("Version 1.0 | Owner: Workplace team | Review: March 2027"); document.AddParagraph("A concise working agreement for reserving shared desks and meeting spaces."); Section("Who this applies to", "Everyone using the shared office, including visitors and project teams."); Section("Reserve the space", "Book the desk or room you need. Include setup time and release unused bookings so another team can use the space."); document.AddParagraph("Rules at a glance").Style = WordParagraphStyles.Heading2; string[][] rules = { new[] { "Space", "Book ahead", "Release by" }, new[] { "Desk", "Same day", "10:00 if unused" }, new[] { "Meeting room", "Up to 4 weeks", "15 minutes before the start" }, new[] { "Project room", "Up to 3 months", "Weekly with the Workplace team" } }; WordTable table = document.AddTable(rules.Length, 3, WordTableStyle.TableGrid); table.SetWidthPercentage(100); for (int row = 0; row < rules.Length; row++) { for (int column = 0; column < 3; column++) { WordTableCell cell = table.Rows[row].Cells[column]; cell.Paragraphs[0].Text = rules[row][column]; if (row == 0) { cell.ShadingFillColor = OfficeColor.Parse("2F5597"); cell.Paragraphs[0].Bold = true; cell.Paragraphs[0].SetColor(OfficeColor.Parse("FFFFFF")); } } } WordParagraph reminder = document.AddParagraph("Release a booking as soon as plans change. Unused space is returned to the pool automatically after the release time."); reminder.LineSpacingBefore = global::OfficeIMO.OfficeLength.Points(10D); reminder.ShadingFillColor = OfficeColor.Parse("EAF1FB"); reminder.Borders.LeftStyle = WordBorderStyle.Single; reminder.Borders.LeftColor = OfficeColor.Parse("2F5597"); reminder.Borders.LeftSize = OfficeLength.Points(3); document.AddParagraph("Leave it ready for the next person").Style = WordParagraphStyles.Heading2; WordList actions = document.AddList(WordListStyle.Bulleted); actions.AddItem("Remove personal items and dispose of waste."); actions.AddItem("Return adapters and equipment to the labelled storage area."); actions.AddItem("Report damaged equipment to the Workplace team."); Section("Exceptions", "Contact the Workplace team for accessible equipment, recurring project space, or a visitor group."); Section("Questions and review", "The Workplace team records feedback and reviews the agreement every six months."); foreach (WordParagraph paragraph in document.Paragraphs) { paragraph.FontSize = global::OfficeIMO.OfficeLength.Points(11); paragraph.LineSpacingAfter = global::OfficeIMO.OfficeLength.Points(7D); if (paragraph.Style == WordParagraphStyles.Heading1) { paragraph.FontSize = global::OfficeIMO.OfficeLength.Points(26); paragraph.Bold = true; paragraph.LineSpacingAfter = global::OfficeIMO.OfficeLength.Points(12D); } else if (paragraph.Style == WordParagraphStyles.Heading2) { paragraph.FontSize = global::OfficeIMO.OfficeLength.Points(15); paragraph.Bold = true; paragraph.LineSpacingBefore = global::OfficeIMO.OfficeLength.Points(12D); paragraph.LineSpacingAfter = global::OfficeIMO.OfficeLength.Points(6D); } } WorkflowFooter.Add(document, "Shared workspace guide"); document.Save(); void Section(string heading, string body) { document.AddParagraph(heading).Style = WordParagraphStyles.Heading2; document.AddParagraph(body); } } }