@nguyenphp/antigravity-marketing 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -78
- package/package.json +4 -3
- package/templates/.agent/skills/marketing-report-expert/SKILL.md +70 -0
- package/templates/.agent/skills/minimax-docx/LICENSE +21 -0
- package/templates/.agent/skills/minimax-docx/SKILL.md +274 -0
- package/templates/.agent/skills/minimax-docx/assets/styles/academic_styles.xml +250 -0
- package/templates/.agent/skills/minimax-docx/assets/styles/corporate_styles.xml +284 -0
- package/templates/.agent/skills/minimax-docx/assets/styles/default_styles.xml +449 -0
- package/templates/.agent/skills/minimax-docx/assets/xsd/aesthetic-rules.xsd +470 -0
- package/templates/.agent/skills/minimax-docx/assets/xsd/business-rules.xsd +130 -0
- package/templates/.agent/skills/minimax-docx/assets/xsd/common-types.xsd +159 -0
- package/templates/.agent/skills/minimax-docx/assets/xsd/wml-subset.xsd +589 -0
- package/templates/.agent/skills/minimax-docx/references/cjk_typography.md +357 -0
- package/templates/.agent/skills/minimax-docx/references/cjk_university_template_guide.md +184 -0
- package/templates/.agent/skills/minimax-docx/references/comments_guide.md +191 -0
- package/templates/.agent/skills/minimax-docx/references/design_good_bad_examples.md +829 -0
- package/templates/.agent/skills/minimax-docx/references/design_principles.md +819 -0
- package/templates/.agent/skills/minimax-docx/references/openxml_element_order.md +308 -0
- package/templates/.agent/skills/minimax-docx/references/openxml_encyclopedia_part1.md +4061 -0
- package/templates/.agent/skills/minimax-docx/references/openxml_encyclopedia_part2.md +2820 -0
- package/templates/.agent/skills/minimax-docx/references/openxml_encyclopedia_part3.md +3381 -0
- package/templates/.agent/skills/minimax-docx/references/openxml_namespaces.md +82 -0
- package/templates/.agent/skills/minimax-docx/references/openxml_units.md +72 -0
- package/templates/.agent/skills/minimax-docx/references/scenario_a_create.md +284 -0
- package/templates/.agent/skills/minimax-docx/references/scenario_b_edit_content.md +295 -0
- package/templates/.agent/skills/minimax-docx/references/scenario_c_apply_template.md +456 -0
- package/templates/.agent/skills/minimax-docx/references/track_changes_guide.md +200 -0
- package/templates/.agent/skills/minimax-docx/references/troubleshooting.md +506 -0
- package/templates/.agent/skills/minimax-docx/references/typography_guide.md +294 -0
- package/templates/.agent/skills/minimax-docx/references/xsd_validation_guide.md +158 -0
- package/templates/.agent/skills/minimax-docx/scripts/doc_to_docx.sh +40 -0
- package/templates/.agent/skills/minimax-docx/scripts/docx_preview.sh +37 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Cli/MiniMaxAIDocx.Cli.csproj +19 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Cli/Program.cs +18 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/AnalyzeCommand.cs +147 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/ApplyTemplateCommand.cs +322 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/CreateCommand.cs +324 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/DiffCommand.cs +155 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/EditContentCommand.cs +487 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/FixOrderCommand.cs +108 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/MergeRunsCommand.cs +122 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/ValidateCommand.cs +107 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/MiniMaxAIDocx.Core.csproj +15 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/CommentSynchronizer.cs +169 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/ElementOrder.cs +80 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/NamespaceConstants.cs +42 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/RunMerger.cs +81 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/StyleAnalyzer.cs +81 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/TrackChangesHelper.cs +99 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/UnitConverter.cs +23 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples.cs +1832 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch1.cs +910 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch2.cs +999 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch3.cs +1048 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch4.cs +1038 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/CharacterFormattingSamples.cs +1020 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/DocumentCreationSamples.cs +1121 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/FieldAndTocSamples.cs +624 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/FootnoteAndCommentSamples.cs +675 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/HeaderFooterSamples.cs +838 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ImageSamples.cs +917 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ListAndNumberingSamples.cs +826 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ParagraphFormattingSamples.cs +1199 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/StyleSystemSamples.cs +1487 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/TableSamples.cs +1163 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/TrackChangesSamples.cs +595 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/CjkHelper.cs +39 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/FontDefaults.cs +24 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/PageSizes.cs +20 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/BusinessRuleValidator.cs +224 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/GateCheckValidator.cs +148 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/ValidationResult.cs +23 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/XsdValidator.cs +69 -0
- package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.slnx +4 -0
- package/templates/.agent/skills/minimax-docx/scripts/env_check.sh +196 -0
- package/templates/.agent/skills/minimax-docx/scripts/setup.ps1 +274 -0
- package/templates/.agent/skills/minimax-docx/scripts/setup.sh +504 -0
- package/templates/.agent/skills/minimax-multimodal-toolkit/SKILL.md +359 -0
- package/templates/.agent/skills/minimax-pdf/README.md +222 -0
- package/templates/.agent/skills/minimax-pdf/SKILL.md +201 -0
- package/templates/.agent/skills/minimax-pdf/design/design.md +381 -0
- package/templates/.agent/skills/minimax-pdf/scripts/cover.py +1579 -0
- package/templates/.agent/skills/minimax-pdf/scripts/fill_inspect.py +200 -0
- package/templates/.agent/skills/minimax-pdf/scripts/fill_write.py +242 -0
- package/templates/.agent/skills/minimax-pdf/scripts/make.sh +491 -0
- package/templates/.agent/skills/minimax-pdf/scripts/merge.py +112 -0
- package/templates/.agent/skills/minimax-pdf/scripts/palette.py +559 -0
- package/templates/.agent/skills/minimax-pdf/scripts/reformat_parse.py +374 -0
- package/templates/.agent/skills/minimax-pdf/scripts/render_body.py +1055 -0
- package/templates/.agent/skills/minimax-pdf/scripts/render_cover.cjs +111 -0
- package/templates/.agent/skills/minimax-xlsx/SKILL.md +138 -0
- package/templates/.agent/skills/minimax-xlsx/references/create.md +691 -0
- package/templates/.agent/skills/minimax-xlsx/references/edit.md +684 -0
- package/templates/.agent/skills/minimax-xlsx/references/fix.md +37 -0
- package/templates/.agent/skills/minimax-xlsx/references/format.md +768 -0
- package/templates/.agent/skills/minimax-xlsx/references/ooxml-cheatsheet.md +231 -0
- package/templates/.agent/skills/minimax-xlsx/references/read-analyze.md +97 -0
- package/templates/.agent/skills/minimax-xlsx/references/validate.md +772 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/formula_check.py +422 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/libreoffice_recalc.py +248 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/shared_strings_builder.py +163 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/style_audit.py +575 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_add_column.py +395 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_insert_row.py +274 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_pack.py +87 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_reader.py +362 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_shift_rows.py +396 -0
- package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_unpack.py +130 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/[Content_Types].xml +9 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/_rels/.rels +6 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/_rels/workbook.xml.rels +19 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/sharedStrings.xml +33 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/styles.xml +160 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/workbook.xml +30 -0
- package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/worksheets/sheet1.xml +70 -0
- package/templates/.agent/skills/pptx-generator/SKILL.md +249 -0
- package/templates/.agent/skills/pptx-generator/references/design-system.md +392 -0
- package/templates/.agent/skills/pptx-generator/references/editing.md +162 -0
- package/templates/.agent/skills/pptx-generator/references/pitfalls.md +112 -0
- package/templates/.agent/skills/pptx-generator/references/pptxgenjs.md +420 -0
- package/templates/.agent/skills/pptx-generator/references/slide-types.md +413 -0
- package/templates/.agent/skills/tutorial-video-expert/SKILL.md +88 -0
- package/templates/.agent/skills/ui-ux-pro-max/SKILL.md +170 -585
- package/templates/.agent/skills/vision-analysis/SKILL.md +174 -0
- package/templates/.agent/workflows/analyze.md +3 -0
- package/templates/.agent/workflows/brand-report.md +44 -0
- package/templates/.agent/workflows/report.md +49 -0
- package/templates/.agent/agents/backend-specialist.md +0 -263
- package/templates/.agent/agents/database-architect.md +0 -226
- package/templates/.agent/agents/debugger.md +0 -225
- package/templates/.agent/agents/devops-engineer.md +0 -242
- package/templates/.agent/agents/frontend-specialist.md +0 -527
- package/templates/.agent/agents/game-developer.md +0 -162
- package/templates/.agent/agents/mobile-developer.md +0 -377
- package/templates/.agent/agents/penetration-tester.md +0 -188
- package/templates/.agent/agents/security-auditor.md +0 -170
- package/templates/.agent/agents/test-engineer.md +0 -158
- package/templates/.agent/skills/api-patterns/SKILL.md +0 -81
- package/templates/.agent/skills/api-patterns/api-style.md +0 -42
- package/templates/.agent/skills/api-patterns/auth.md +0 -24
- package/templates/.agent/skills/api-patterns/documentation.md +0 -26
- package/templates/.agent/skills/api-patterns/graphql.md +0 -41
- package/templates/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/templates/.agent/skills/api-patterns/response.md +0 -37
- package/templates/.agent/skills/api-patterns/rest.md +0 -40
- package/templates/.agent/skills/api-patterns/scripts/api_validator.py +0 -211
- package/templates/.agent/skills/api-patterns/security-testing.md +0 -122
- package/templates/.agent/skills/api-patterns/trpc.md +0 -41
- package/templates/.agent/skills/api-patterns/versioning.md +0 -22
- package/templates/.agent/skills/app-builder/SKILL.md +0 -75
- package/templates/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/templates/.agent/skills/app-builder/feature-building.md +0 -53
- package/templates/.agent/skills/app-builder/project-detection.md +0 -34
- package/templates/.agent/skills/app-builder/scaffolding.md +0 -118
- package/templates/.agent/skills/app-builder/tech-stack.md +0 -40
- package/templates/.agent/skills/app-builder/templates/SKILL.md +0 -39
- package/templates/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +0 -76
- package/templates/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +0 -92
- package/templates/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +0 -88
- package/templates/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +0 -88
- package/templates/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +0 -83
- package/templates/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +0 -90
- package/templates/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -90
- package/templates/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -82
- package/templates/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -100
- package/templates/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +0 -106
- package/templates/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +0 -101
- package/templates/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +0 -83
- package/templates/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +0 -93
- package/templates/.agent/skills/architecture/SKILL.md +0 -55
- package/templates/.agent/skills/architecture/context-discovery.md +0 -43
- package/templates/.agent/skills/architecture/examples.md +0 -94
- package/templates/.agent/skills/architecture/pattern-selection.md +0 -68
- package/templates/.agent/skills/architecture/patterns-reference.md +0 -50
- package/templates/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/templates/.agent/skills/bash-linux/SKILL.md +0 -199
- package/templates/.agent/skills/behavioral-modes/SKILL.md +0 -242
- package/templates/.agent/skills/clean-code/SKILL.md +0 -201
- package/templates/.agent/skills/code-review-checklist/SKILL.md +0 -109
- package/templates/.agent/skills/database-design/SKILL.md +0 -52
- package/templates/.agent/skills/database-design/database-selection.md +0 -43
- package/templates/.agent/skills/database-design/indexing.md +0 -39
- package/templates/.agent/skills/database-design/migrations.md +0 -48
- package/templates/.agent/skills/database-design/optimization.md +0 -36
- package/templates/.agent/skills/database-design/orm-selection.md +0 -30
- package/templates/.agent/skills/database-design/schema-design.md +0 -56
- package/templates/.agent/skills/database-design/scripts/schema_validator.py +0 -172
- package/templates/.agent/skills/deployment-procedures/SKILL.md +0 -241
- package/templates/.agent/skills/docker-expert/SKILL.md +0 -409
- package/templates/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/templates/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/templates/.agent/skills/game-development/SKILL.md +0 -167
- package/templates/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/templates/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/templates/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/templates/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/templates/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/templates/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/templates/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/templates/.agent/skills/game-development/web-games/SKILL.md +0 -150
- package/templates/.agent/skills/lint-and-validate/SKILL.md +0 -45
- package/templates/.agent/skills/lint-and-validate/scripts/lint_runner.py +0 -172
- package/templates/.agent/skills/lint-and-validate/scripts/type_coverage.py +0 -173
- package/templates/.agent/skills/mcp-builder/SKILL.md +0 -176
- package/templates/.agent/skills/nestjs-expert/SKILL.md +0 -552
- package/templates/.agent/skills/nextjs-best-practices/SKILL.md +0 -203
- package/templates/.agent/skills/nodejs-best-practices/SKILL.md +0 -333
- package/templates/.agent/skills/parallel-agents/SKILL.md +0 -175
- package/templates/.agent/skills/performance-profiling/SKILL.md +0 -143
- package/templates/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +0 -76
- package/templates/.agent/skills/powershell-windows/SKILL.md +0 -167
- package/templates/.agent/skills/prisma-expert/SKILL.md +0 -355
- package/templates/.agent/skills/python-patterns/SKILL.md +0 -441
- package/templates/.agent/skills/react-patterns/SKILL.md +0 -198
- package/templates/.agent/skills/red-team-tactics/SKILL.md +0 -199
- package/templates/.agent/skills/server-management/SKILL.md +0 -161
- package/templates/.agent/skills/systematic-debugging/SKILL.md +0 -109
- package/templates/.agent/skills/tdd-workflow/SKILL.md +0 -149
- package/templates/.agent/skills/testing-patterns/SKILL.md +0 -178
- package/templates/.agent/skills/testing-patterns/scripts/test_runner.py +0 -219
- package/templates/.agent/skills/typescript-expert/SKILL.md +0 -429
- package/templates/.agent/skills/vue-expert/SKILL.md +0 -374
- package/templates/.agent/skills/vulnerability-scanner/SKILL.md +0 -276
- package/templates/.agent/skills/vulnerability-scanner/checklists.md +0 -121
- package/templates/.agent/skills/vulnerability-scanner/scripts/security_scan.py +0 -458
- package/templates/.agent/skills/webapp-testing/SKILL.md +0 -187
- package/templates/.agent/skills/webapp-testing/scripts/playwright_runner.py +0 -173
- package/templates/.agent/workflows/debug.md +0 -103
- package/templates/.agent/workflows/deploy.md +0 -176
- package/templates/.agent/workflows/enhance.md +0 -63
- package/templates/.agent/workflows/test.md +0 -144
|
@@ -0,0 +1,999 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// AestheticRecipeSamples_Batch2.cs — Academic citation style recipes (APA 7, MLA 9)
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Recipes 8-9: Strict compliance with academic citation style guides.
|
|
5
|
+
// These are NOT aesthetic "design" choices — they are codified standards
|
|
6
|
+
// mandated by publishers, universities, and professional organizations.
|
|
7
|
+
//
|
|
8
|
+
// UNIT REFERENCE:
|
|
9
|
+
// Font size: half-points (22 = 11pt, 24 = 12pt, 32 = 16pt)
|
|
10
|
+
// Spacing: DXA = twentieths of a point (1440 DXA = 1 inch)
|
|
11
|
+
// Borders: eighth-points (4 = 0.5pt, 8 = 1pt, 12 = 1.5pt)
|
|
12
|
+
// Line spacing "line": 240ths of single spacing (240 = 1.0x, 480 = 2.0x)
|
|
13
|
+
// ============================================================================
|
|
14
|
+
|
|
15
|
+
using DocumentFormat.OpenXml;
|
|
16
|
+
using DocumentFormat.OpenXml.Packaging;
|
|
17
|
+
using DocumentFormat.OpenXml.Wordprocessing;
|
|
18
|
+
|
|
19
|
+
using WpPageSize = DocumentFormat.OpenXml.Wordprocessing.PageSize;
|
|
20
|
+
|
|
21
|
+
namespace MiniMaxAIDocx.Core.Samples;
|
|
22
|
+
|
|
23
|
+
public static partial class AestheticRecipeSamples
|
|
24
|
+
{
|
|
25
|
+
// ════════════════════════════════════════════════════════════════════════
|
|
26
|
+
// RECIPE 8: APA 7TH EDITION (PROFESSIONAL PAPER)
|
|
27
|
+
// ════════════════════════════════════════════════════════════════════════
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
/// Recipe: APA 7th Edition — Professional Paper
|
|
31
|
+
/// Source: Publication Manual of the American Psychological Association,
|
|
32
|
+
/// 7th edition (2020), Chapters 2 (Paper Elements) and 6 (Mechanics of Style).
|
|
33
|
+
///
|
|
34
|
+
/// Key APA 7 specifications:
|
|
35
|
+
/// - Font: 12pt Times New Roman (Section 2.19). Also acceptable: 11pt Calibri,
|
|
36
|
+
/// 11pt Arial, 10pt Lucida Sans Unicode, or 11pt Georgia.
|
|
37
|
+
/// - Margins: 1 inch on all sides (Section 2.22).
|
|
38
|
+
/// - Line spacing: Double-spaced throughout, including title page and references (Section 2.21).
|
|
39
|
+
/// - Paragraph indent: 0.5 inch first-line indent for body paragraphs (Section 2.24).
|
|
40
|
+
/// - Heading levels (Section 2.27):
|
|
41
|
+
/// Level 1: Centered, Bold, Title Case Heading
|
|
42
|
+
/// Level 2: Flush Left, Bold, Title Case Heading
|
|
43
|
+
/// Level 3: Flush Left, Bold Italic, Title Case Heading
|
|
44
|
+
/// Level 4: Indented, Bold, Title Case Heading, Ending With a Period. (run-in)
|
|
45
|
+
/// Level 5: Indented, Bold Italic, Title Case Heading, Ending With a Period. (run-in)
|
|
46
|
+
/// All headings are 12pt — hierarchy through format, NOT size.
|
|
47
|
+
/// - Page numbers: top right corner on every page including title page (Section 2.18).
|
|
48
|
+
/// - Running head: flush left, ALL CAPS, for professional papers only (Section 2.18).
|
|
49
|
+
/// - Abstract: "Abstract" centered bold; single paragraph, not indented (Section 2.9).
|
|
50
|
+
/// - No numbered headings (APA does not use section numbers).
|
|
51
|
+
///
|
|
52
|
+
/// Design rationale:
|
|
53
|
+
/// - Every parameter is dictated by the style guide, not aesthetic preference.
|
|
54
|
+
/// - Double spacing with first-line indent (no paragraph spacing) is the
|
|
55
|
+
/// traditional academic convention — it provides annotation room and
|
|
56
|
+
/// clear paragraph boundaries without wasting vertical space.
|
|
57
|
+
/// - Uniform 12pt headings ensure the text content is primary; headings
|
|
58
|
+
/// serve as navigational aids, not visual statements.
|
|
59
|
+
/// </summary>
|
|
60
|
+
public static void CreateAPA7Document(string outputPath)
|
|
61
|
+
{
|
|
62
|
+
using var doc = WordprocessingDocument.Create(outputPath, WordprocessingDocumentType.Document);
|
|
63
|
+
|
|
64
|
+
var mainPart = doc.AddMainDocumentPart();
|
|
65
|
+
mainPart.Document = new Document(new Body());
|
|
66
|
+
var body = mainPart.Document.Body!;
|
|
67
|
+
|
|
68
|
+
// ── Styles ──
|
|
69
|
+
var stylesPart = mainPart.AddNewPart<StyleDefinitionsPart>();
|
|
70
|
+
stylesPart.Styles = new Styles();
|
|
71
|
+
var styles = stylesPart.Styles;
|
|
72
|
+
|
|
73
|
+
// DocDefaults: 12pt Times New Roman, double spacing, 0.5in first-line indent
|
|
74
|
+
// NOTE: 11pt Calibri and 11pt Arial are also acceptable per APA 7 Section 2.19
|
|
75
|
+
styles.Append(new DocDefaults(
|
|
76
|
+
new RunPropertiesDefault(
|
|
77
|
+
new RunPropertiesBaseStyle(
|
|
78
|
+
new RunFonts
|
|
79
|
+
{
|
|
80
|
+
Ascii = "Times New Roman",
|
|
81
|
+
HighAnsi = "Times New Roman",
|
|
82
|
+
EastAsia = "SimSun",
|
|
83
|
+
ComplexScript = "Times New Roman"
|
|
84
|
+
},
|
|
85
|
+
new FontSize { Val = "24" }, // 12pt (half-points)
|
|
86
|
+
new FontSizeComplexScript { Val = "24" },
|
|
87
|
+
new Color { Val = "000000" }, // Pure black
|
|
88
|
+
new Languages { Val = "en-US", EastAsia = "zh-CN" }
|
|
89
|
+
)
|
|
90
|
+
),
|
|
91
|
+
new ParagraphPropertiesDefault(
|
|
92
|
+
new ParagraphPropertiesBaseStyle(
|
|
93
|
+
new SpacingBetweenLines
|
|
94
|
+
{
|
|
95
|
+
// Double spacing throughout (APA 7, Section 2.21)
|
|
96
|
+
// 480 = 2.0x (240 = single spacing)
|
|
97
|
+
Line = "480",
|
|
98
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
99
|
+
After = "0" // No paragraph spacing — APA uses indent, not space
|
|
100
|
+
},
|
|
101
|
+
// First-line indent 0.5in = 720 DXA (APA 7, Section 2.24)
|
|
102
|
+
new Indentation { FirstLine = "720" }
|
|
103
|
+
)
|
|
104
|
+
)
|
|
105
|
+
));
|
|
106
|
+
|
|
107
|
+
// ── Normal style ──
|
|
108
|
+
styles.Append(CreateParagraphStyle(
|
|
109
|
+
styleId: "Normal",
|
|
110
|
+
styleName: "Normal",
|
|
111
|
+
isDefault: true,
|
|
112
|
+
uiPriority: 0
|
|
113
|
+
));
|
|
114
|
+
|
|
115
|
+
// ── APA Level 1: Centered, Bold, Title Case ──
|
|
116
|
+
// Same 12pt as body — hierarchy via format, NOT size (APA 7, Section 2.27)
|
|
117
|
+
styles.Append(CreateAcademicHeadingStyle(
|
|
118
|
+
level: 1,
|
|
119
|
+
sizeHalfPts: "24", // 12pt — same as body
|
|
120
|
+
bold: true,
|
|
121
|
+
italic: false,
|
|
122
|
+
centered: true,
|
|
123
|
+
spaceBefore: "480", // One double-spaced blank line before
|
|
124
|
+
spaceAfter: "0"
|
|
125
|
+
));
|
|
126
|
+
|
|
127
|
+
// ── APA Level 2: Flush Left, Bold, Title Case ──
|
|
128
|
+
styles.Append(CreateAcademicHeadingStyle(
|
|
129
|
+
level: 2,
|
|
130
|
+
sizeHalfPts: "24", // 12pt — same as body
|
|
131
|
+
bold: true,
|
|
132
|
+
italic: false,
|
|
133
|
+
centered: false,
|
|
134
|
+
spaceBefore: "480",
|
|
135
|
+
spaceAfter: "0"
|
|
136
|
+
));
|
|
137
|
+
|
|
138
|
+
// ── APA Level 3: Flush Left, Bold Italic, Title Case ──
|
|
139
|
+
styles.Append(CreateAcademicHeadingStyle(
|
|
140
|
+
level: 3,
|
|
141
|
+
sizeHalfPts: "24", // 12pt — same as body
|
|
142
|
+
bold: true,
|
|
143
|
+
italic: true,
|
|
144
|
+
centered: false,
|
|
145
|
+
spaceBefore: "480",
|
|
146
|
+
spaceAfter: "0"
|
|
147
|
+
));
|
|
148
|
+
|
|
149
|
+
// ── APA Level 4: Indented 0.5in, Bold, Title Case, Ending With Period. ──
|
|
150
|
+
// This is a "run-in" heading in APA — the heading text runs into the paragraph.
|
|
151
|
+
// In OpenXML we approximate by creating an indented bold paragraph.
|
|
152
|
+
styles.Append(CreateAPA7RunInHeadingStyle(
|
|
153
|
+
level: 4,
|
|
154
|
+
bold: true,
|
|
155
|
+
italic: false
|
|
156
|
+
));
|
|
157
|
+
|
|
158
|
+
// ── APA Level 5: Indented 0.5in, Bold Italic, Title Case, Ending With Period. ──
|
|
159
|
+
styles.Append(CreateAPA7RunInHeadingStyle(
|
|
160
|
+
level: 5,
|
|
161
|
+
bold: true,
|
|
162
|
+
italic: true
|
|
163
|
+
));
|
|
164
|
+
|
|
165
|
+
// ── "Abstract" label style: centered, bold, no indent ──
|
|
166
|
+
styles.Append(CreateAPA7NoIndentCenteredStyle(
|
|
167
|
+
styleId: "APAAbstractLabel",
|
|
168
|
+
styleName: "APA Abstract Label",
|
|
169
|
+
bold: true
|
|
170
|
+
));
|
|
171
|
+
|
|
172
|
+
// ── Abstract body style: no first-line indent ──
|
|
173
|
+
styles.Append(CreateAPA7NoIndentStyle(
|
|
174
|
+
styleId: "APAAbstractBody",
|
|
175
|
+
styleName: "APA Abstract Body"
|
|
176
|
+
));
|
|
177
|
+
|
|
178
|
+
// ── Title page style: centered, bold, no indent ──
|
|
179
|
+
styles.Append(CreateAPA7NoIndentCenteredStyle(
|
|
180
|
+
styleId: "APATitlePageTitle",
|
|
181
|
+
styleName: "APA Title Page Title",
|
|
182
|
+
bold: true
|
|
183
|
+
));
|
|
184
|
+
|
|
185
|
+
// ── Title page author/affiliation: centered, no indent, not bold ──
|
|
186
|
+
styles.Append(CreateAPA7NoIndentCenteredStyle(
|
|
187
|
+
styleId: "APATitlePageInfo",
|
|
188
|
+
styleName: "APA Title Page Info",
|
|
189
|
+
bold: false
|
|
190
|
+
));
|
|
191
|
+
|
|
192
|
+
// ── Page setup: US Letter, 1in all sides (APA 7, Section 2.22) ──
|
|
193
|
+
var sectPr = new SectionProperties(
|
|
194
|
+
new WpPageSize { Width = 12240U, Height = 15840U }, // 8.5" x 11"
|
|
195
|
+
new PageMargin
|
|
196
|
+
{
|
|
197
|
+
Top = 1440, Bottom = 1440,
|
|
198
|
+
Left = 1440U, Right = 1440U,
|
|
199
|
+
Header = 720U, Footer = 720U, Gutter = 0U
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// ── Running head + page number in header ──
|
|
204
|
+
// Professional papers: running head flush left (ALL CAPS), page number flush right
|
|
205
|
+
// Both in the same header (APA 7, Section 2.18)
|
|
206
|
+
AddAPA7Header(mainPart, sectPr, "COGNITIVE EFFECTS OF SLEEP DEPRIVATION");
|
|
207
|
+
|
|
208
|
+
// ══════════════════════════════════════════════════════════════════
|
|
209
|
+
// SAMPLE CONTENT: Title Page, Abstract, Body with all 5 heading levels
|
|
210
|
+
// ══════════════════════════════════════════════════════════════════
|
|
211
|
+
|
|
212
|
+
// ── Title page ──
|
|
213
|
+
// Title: centered, bold, upper half of page (3-4 blank lines before)
|
|
214
|
+
AddAPA7TitlePage(body,
|
|
215
|
+
title: "Cognitive Effects of Sleep Deprivation on Working Memory Performance",
|
|
216
|
+
authorName: "Sarah J. Mitchell",
|
|
217
|
+
affiliation: "Department of Psychology, University of Washington",
|
|
218
|
+
courseLine: "PSY 401: Advanced Cognitive Psychology",
|
|
219
|
+
instructorLine: "Dr. Robert Chen",
|
|
220
|
+
dateLine: "October 15, 2024"
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
// ── Abstract page ──
|
|
224
|
+
AddSampleParagraph(body, "Abstract", "APAAbstractLabel");
|
|
225
|
+
|
|
226
|
+
body.Append(new Paragraph(
|
|
227
|
+
new ParagraphProperties(
|
|
228
|
+
new ParagraphStyleId { Val = "APAAbstractBody" }
|
|
229
|
+
),
|
|
230
|
+
new Run(new Text(
|
|
231
|
+
"This study examined the effects of acute sleep deprivation on working memory "
|
|
232
|
+
+ "performance in college-aged adults. Participants (N = 48) were randomly assigned "
|
|
233
|
+
+ "to either a sleep deprivation condition (24 hours without sleep) or a control "
|
|
234
|
+
+ "condition (normal sleep). Working memory was assessed using a dual n-back task. "
|
|
235
|
+
+ "Results indicated that sleep-deprived participants showed significantly lower "
|
|
236
|
+
+ "accuracy (M = 72.3%, SD = 8.1) compared to controls (M = 89.7%, SD = 5.4), "
|
|
237
|
+
+ "t(46) = 9.12, p < .001, d = 2.52. These findings suggest that even a single "
|
|
238
|
+
+ "night of sleep deprivation substantially impairs working memory capacity."
|
|
239
|
+
))
|
|
240
|
+
));
|
|
241
|
+
|
|
242
|
+
// ── Body: Level 1 heading ──
|
|
243
|
+
AddSampleParagraph(body, "Cognitive Effects of Sleep Deprivation on Working Memory Performance", "Heading1");
|
|
244
|
+
|
|
245
|
+
AddSampleParagraph(body,
|
|
246
|
+
"Sleep deprivation is increasingly prevalent among college students, with approximately "
|
|
247
|
+
+ "50% reporting insufficient sleep on a regular basis (Hershner & Chervin, 2014). The "
|
|
248
|
+
+ "consequences of inadequate sleep extend beyond daytime drowsiness, affecting core "
|
|
249
|
+
+ "cognitive processes including attention, executive function, and working memory.",
|
|
250
|
+
"Normal");
|
|
251
|
+
|
|
252
|
+
// ── Level 2 heading ──
|
|
253
|
+
AddSampleParagraph(body, "Theoretical Framework", "Heading2");
|
|
254
|
+
|
|
255
|
+
AddSampleParagraph(body,
|
|
256
|
+
"Working memory, as conceptualized by Baddeley and Hitch (1974), comprises a central "
|
|
257
|
+
+ "executive system supported by the phonological loop and visuospatial sketchpad. Sleep "
|
|
258
|
+
+ "deprivation has been hypothesized to primarily affect the central executive component, "
|
|
259
|
+
+ "which governs attentional control and task coordination.",
|
|
260
|
+
"Normal");
|
|
261
|
+
|
|
262
|
+
// ── Level 3 heading ──
|
|
263
|
+
AddSampleParagraph(body, "Neural Mechanisms of Sleep-Related Cognitive Decline", "Heading3");
|
|
264
|
+
|
|
265
|
+
AddSampleParagraph(body,
|
|
266
|
+
"Neuroimaging studies have demonstrated that sleep deprivation is associated with "
|
|
267
|
+
+ "reduced activation in the prefrontal cortex, the neural substrate most closely linked "
|
|
268
|
+
+ "to working memory function (Chee & Chuah, 2007). Additionally, thalamic deactivation "
|
|
269
|
+
+ "may impair the relay of sensory information necessary for memory encoding.",
|
|
270
|
+
"Normal");
|
|
271
|
+
|
|
272
|
+
// ── Level 4 heading (run-in, bold, ends with period) ──
|
|
273
|
+
// APA Level 4 is a run-in heading: the heading text and paragraph text
|
|
274
|
+
// share the same line. We approximate with a bold indented paragraph.
|
|
275
|
+
body.Append(CreateAPA7RunInParagraph(
|
|
276
|
+
headingText: "Prefrontal Cortex Involvement.",
|
|
277
|
+
bodyText: " The dorsolateral prefrontal cortex (DLPFC) shows the greatest "
|
|
278
|
+
+ "susceptibility to sleep loss. Functional MRI studies reveal a dose-dependent "
|
|
279
|
+
+ "relationship between hours of wakefulness and DLPFC activation levels during "
|
|
280
|
+
+ "working memory tasks.",
|
|
281
|
+
bold: true,
|
|
282
|
+
italic: false
|
|
283
|
+
));
|
|
284
|
+
|
|
285
|
+
// ── Level 5 heading (run-in, bold italic, ends with period) ──
|
|
286
|
+
body.Append(CreateAPA7RunInParagraph(
|
|
287
|
+
headingText: "Glutamatergic Pathways.",
|
|
288
|
+
bodyText: " Recent research has identified glutamatergic signaling in the "
|
|
289
|
+
+ "prefrontal cortex as a key mediator of sleep deprivation effects on working "
|
|
290
|
+
+ "memory. Antagonism of NMDA receptors produces cognitive deficits similar to "
|
|
291
|
+
+ "those observed following 24 hours of sleep loss.",
|
|
292
|
+
bold: true,
|
|
293
|
+
italic: true
|
|
294
|
+
));
|
|
295
|
+
|
|
296
|
+
// ── Level 2: Method section ──
|
|
297
|
+
AddSampleParagraph(body, "Method", "Heading2");
|
|
298
|
+
|
|
299
|
+
AddSampleParagraph(body,
|
|
300
|
+
"This experiment used a between-subjects design with sleep condition (deprived vs. "
|
|
301
|
+
+ "control) as the independent variable and working memory accuracy as the dependent "
|
|
302
|
+
+ "variable. All procedures were approved by the University of Washington Institutional "
|
|
303
|
+
+ "Review Board (Protocol #2024-0847).",
|
|
304
|
+
"Normal");
|
|
305
|
+
|
|
306
|
+
// ── Level 2: Results ──
|
|
307
|
+
AddSampleParagraph(body, "Results", "Heading2");
|
|
308
|
+
|
|
309
|
+
AddSampleParagraph(body,
|
|
310
|
+
"An independent-samples t test revealed a statistically significant difference in "
|
|
311
|
+
+ "working memory accuracy between the sleep-deprived group (M = 72.3%, SD = 8.1) "
|
|
312
|
+
+ "and the control group (M = 89.7%, SD = 5.4), t(46) = 9.12, p < .001. The effect "
|
|
313
|
+
+ "size was large (Cohen's d = 2.52), indicating a substantial practical difference.",
|
|
314
|
+
"Normal");
|
|
315
|
+
|
|
316
|
+
// ── Level 2: Discussion ──
|
|
317
|
+
AddSampleParagraph(body, "Discussion", "Heading2");
|
|
318
|
+
|
|
319
|
+
AddSampleParagraph(body,
|
|
320
|
+
"The findings of this study are consistent with previous research demonstrating the "
|
|
321
|
+
+ "deleterious effects of sleep deprivation on cognitive performance. The magnitude of "
|
|
322
|
+
+ "the effect observed here exceeds that reported in meta-analytic reviews, possibly "
|
|
323
|
+
+ "due to the use of a more demanding dual n-back paradigm that places greater demands "
|
|
324
|
+
+ "on executive control processes.",
|
|
325
|
+
"Normal");
|
|
326
|
+
|
|
327
|
+
// Section properties must be last child of body
|
|
328
|
+
body.Append(sectPr);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/// <summary>
|
|
332
|
+
/// Creates an APA 7 "run-in" heading style (Levels 4 and 5).
|
|
333
|
+
/// These headings are indented 0.5in and end with a period;
|
|
334
|
+
/// the paragraph text runs in on the same line as the heading.
|
|
335
|
+
/// In OpenXML, we create a paragraph style with the appropriate formatting.
|
|
336
|
+
/// </summary>
|
|
337
|
+
private static Style CreateAPA7RunInHeadingStyle(int level, bool bold, bool italic)
|
|
338
|
+
{
|
|
339
|
+
var rPr = new StyleRunProperties(
|
|
340
|
+
new RunFonts
|
|
341
|
+
{
|
|
342
|
+
Ascii = "Times New Roman",
|
|
343
|
+
HighAnsi = "Times New Roman",
|
|
344
|
+
EastAsia = "SimSun",
|
|
345
|
+
ComplexScript = "Times New Roman"
|
|
346
|
+
},
|
|
347
|
+
new FontSize { Val = "24" }, // 12pt — same as body
|
|
348
|
+
new FontSizeComplexScript { Val = "24" },
|
|
349
|
+
new Color { Val = "000000" }
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
if (bold)
|
|
353
|
+
rPr.Append(new Bold());
|
|
354
|
+
if (italic)
|
|
355
|
+
rPr.Append(new Italic());
|
|
356
|
+
|
|
357
|
+
var pPr = new StyleParagraphProperties(
|
|
358
|
+
new KeepNext(),
|
|
359
|
+
new KeepLines(),
|
|
360
|
+
new SpacingBetweenLines
|
|
361
|
+
{
|
|
362
|
+
Before = "480",
|
|
363
|
+
After = "0",
|
|
364
|
+
Line = "480",
|
|
365
|
+
LineRule = LineSpacingRuleValues.Auto
|
|
366
|
+
},
|
|
367
|
+
// Indented 0.5in = 720 DXA (APA 7 Levels 4-5)
|
|
368
|
+
new Indentation { FirstLine = "720" },
|
|
369
|
+
new OutlineLevel { Val = level - 1 }
|
|
370
|
+
);
|
|
371
|
+
|
|
372
|
+
return new Style(
|
|
373
|
+
new StyleName { Val = $"heading {level}" },
|
|
374
|
+
new BasedOn { Val = "Normal" },
|
|
375
|
+
new NextParagraphStyle { Val = "Normal" },
|
|
376
|
+
new UIPriority { Val = 9 },
|
|
377
|
+
new PrimaryStyle(),
|
|
378
|
+
pPr,
|
|
379
|
+
rPr
|
|
380
|
+
)
|
|
381
|
+
{
|
|
382
|
+
Type = StyleValues.Paragraph,
|
|
383
|
+
StyleId = $"Heading{level}",
|
|
384
|
+
Default = false
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/// <summary>
|
|
389
|
+
/// Creates a centered, optionally bold paragraph style with no first-line indent.
|
|
390
|
+
/// Used for APA title page elements and the "Abstract" label.
|
|
391
|
+
/// </summary>
|
|
392
|
+
private static Style CreateAPA7NoIndentCenteredStyle(string styleId, string styleName, bool bold)
|
|
393
|
+
{
|
|
394
|
+
var rPr = new StyleRunProperties(
|
|
395
|
+
new FontSize { Val = "24" },
|
|
396
|
+
new FontSizeComplexScript { Val = "24" }
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
if (bold)
|
|
400
|
+
rPr.Append(new Bold());
|
|
401
|
+
|
|
402
|
+
return new Style(
|
|
403
|
+
new StyleName { Val = styleName },
|
|
404
|
+
new BasedOn { Val = "Normal" },
|
|
405
|
+
new UIPriority { Val = 1 },
|
|
406
|
+
new StyleParagraphProperties(
|
|
407
|
+
new Justification { Val = JustificationValues.Center },
|
|
408
|
+
new Indentation { FirstLine = "0" },
|
|
409
|
+
new SpacingBetweenLines
|
|
410
|
+
{
|
|
411
|
+
Line = "480",
|
|
412
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
413
|
+
After = "0"
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
rPr
|
|
417
|
+
)
|
|
418
|
+
{
|
|
419
|
+
Type = StyleValues.Paragraph,
|
|
420
|
+
StyleId = styleId,
|
|
421
|
+
Default = false
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/// <summary>
|
|
426
|
+
/// Creates a left-aligned paragraph style with no first-line indent.
|
|
427
|
+
/// Used for the abstract body text (APA 7 specifies no indent for abstract).
|
|
428
|
+
/// </summary>
|
|
429
|
+
private static Style CreateAPA7NoIndentStyle(string styleId, string styleName)
|
|
430
|
+
{
|
|
431
|
+
return new Style(
|
|
432
|
+
new StyleName { Val = styleName },
|
|
433
|
+
new BasedOn { Val = "Normal" },
|
|
434
|
+
new UIPriority { Val = 1 },
|
|
435
|
+
new StyleParagraphProperties(
|
|
436
|
+
new Indentation { FirstLine = "0" },
|
|
437
|
+
new SpacingBetweenLines
|
|
438
|
+
{
|
|
439
|
+
Line = "480",
|
|
440
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
441
|
+
After = "0"
|
|
442
|
+
}
|
|
443
|
+
)
|
|
444
|
+
)
|
|
445
|
+
{
|
|
446
|
+
Type = StyleValues.Paragraph,
|
|
447
|
+
StyleId = styleId,
|
|
448
|
+
Default = false
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/// <summary>
|
|
453
|
+
/// Adds the APA 7 professional paper header: running head flush left (ALL CAPS)
|
|
454
|
+
/// and page number flush right, both in the same header line.
|
|
455
|
+
/// Per APA 7, Section 2.18: the running head appears on every page.
|
|
456
|
+
/// </summary>
|
|
457
|
+
private static void AddAPA7Header(MainDocumentPart mainPart, SectionProperties sectPr, string runningHeadText)
|
|
458
|
+
{
|
|
459
|
+
// Use a tab stop at the right margin to position the page number flush right
|
|
460
|
+
// Right margin position: page width (12240) - left margin (1440) - right margin (1440) = 9360 DXA
|
|
461
|
+
var headerParagraph = new Paragraph(
|
|
462
|
+
new ParagraphProperties(
|
|
463
|
+
new ParagraphStyleId { Val = "Normal" },
|
|
464
|
+
new Indentation { FirstLine = "0" },
|
|
465
|
+
new SpacingBetweenLines { Line = "240", LineRule = LineSpacingRuleValues.Auto, After = "0" },
|
|
466
|
+
new Tabs(
|
|
467
|
+
new TabStop
|
|
468
|
+
{
|
|
469
|
+
Val = TabStopValues.Right,
|
|
470
|
+
Position = 9360 // Flush right at the text area edge
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
),
|
|
474
|
+
// Running head text (flush left, ALL CAPS)
|
|
475
|
+
new Run(
|
|
476
|
+
new RunProperties(
|
|
477
|
+
new RunFonts
|
|
478
|
+
{
|
|
479
|
+
Ascii = "Times New Roman",
|
|
480
|
+
HighAnsi = "Times New Roman"
|
|
481
|
+
},
|
|
482
|
+
new FontSize { Val = "24" },
|
|
483
|
+
new FontSizeComplexScript { Val = "24" }
|
|
484
|
+
),
|
|
485
|
+
new Text(runningHeadText) { Space = SpaceProcessingModeValues.Preserve }
|
|
486
|
+
),
|
|
487
|
+
// Tab to move to right-aligned position
|
|
488
|
+
new Run(
|
|
489
|
+
new RunProperties(
|
|
490
|
+
new RunFonts
|
|
491
|
+
{
|
|
492
|
+
Ascii = "Times New Roman",
|
|
493
|
+
HighAnsi = "Times New Roman"
|
|
494
|
+
},
|
|
495
|
+
new FontSize { Val = "24" },
|
|
496
|
+
new FontSizeComplexScript { Val = "24" }
|
|
497
|
+
),
|
|
498
|
+
new TabChar()
|
|
499
|
+
),
|
|
500
|
+
// Page number (flush right)
|
|
501
|
+
new SimpleField(
|
|
502
|
+
new Run(
|
|
503
|
+
new RunProperties(
|
|
504
|
+
new RunFonts
|
|
505
|
+
{
|
|
506
|
+
Ascii = "Times New Roman",
|
|
507
|
+
HighAnsi = "Times New Roman"
|
|
508
|
+
},
|
|
509
|
+
new FontSize { Val = "24" },
|
|
510
|
+
new FontSizeComplexScript { Val = "24" }
|
|
511
|
+
),
|
|
512
|
+
new Text("1")
|
|
513
|
+
)
|
|
514
|
+
)
|
|
515
|
+
{ Instruction = " PAGE " }
|
|
516
|
+
);
|
|
517
|
+
|
|
518
|
+
var headerPart = mainPart.AddNewPart<HeaderPart>();
|
|
519
|
+
headerPart.Header = new Header(headerParagraph);
|
|
520
|
+
headerPart.Header.Save();
|
|
521
|
+
|
|
522
|
+
string headerPartId = mainPart.GetIdOfPart(headerPart);
|
|
523
|
+
sectPr.Append(new HeaderReference
|
|
524
|
+
{
|
|
525
|
+
Type = HeaderFooterValues.Default,
|
|
526
|
+
Id = headerPartId
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/// <summary>
|
|
531
|
+
/// Adds the APA 7 title page content: title, author, affiliation,
|
|
532
|
+
/// course, instructor, and date — all centered and double-spaced.
|
|
533
|
+
/// Per APA 7, Section 2.3: title should be bold, centered, in upper half of page.
|
|
534
|
+
/// </summary>
|
|
535
|
+
private static void AddAPA7TitlePage(Body body,
|
|
536
|
+
string title, string authorName, string affiliation,
|
|
537
|
+
string courseLine, string instructorLine, string dateLine)
|
|
538
|
+
{
|
|
539
|
+
// Add some blank lines to position title in upper half of page
|
|
540
|
+
for (int i = 0; i < 3; i++)
|
|
541
|
+
{
|
|
542
|
+
body.Append(new Paragraph(
|
|
543
|
+
new ParagraphProperties(
|
|
544
|
+
new ParagraphStyleId { Val = "APATitlePageInfo" }
|
|
545
|
+
)
|
|
546
|
+
));
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Title: centered, bold
|
|
550
|
+
AddSampleParagraph(body, title, "APATitlePageTitle");
|
|
551
|
+
|
|
552
|
+
// Author name
|
|
553
|
+
AddSampleParagraph(body, authorName, "APATitlePageInfo");
|
|
554
|
+
|
|
555
|
+
// Affiliation
|
|
556
|
+
AddSampleParagraph(body, affiliation, "APATitlePageInfo");
|
|
557
|
+
|
|
558
|
+
// Course
|
|
559
|
+
AddSampleParagraph(body, courseLine, "APATitlePageInfo");
|
|
560
|
+
|
|
561
|
+
// Instructor
|
|
562
|
+
AddSampleParagraph(body, instructorLine, "APATitlePageInfo");
|
|
563
|
+
|
|
564
|
+
// Date
|
|
565
|
+
AddSampleParagraph(body, dateLine, "APATitlePageInfo");
|
|
566
|
+
|
|
567
|
+
// Page break after title page
|
|
568
|
+
body.Append(new Paragraph(
|
|
569
|
+
new ParagraphProperties(
|
|
570
|
+
new ParagraphStyleId { Val = "APATitlePageInfo" }
|
|
571
|
+
),
|
|
572
|
+
new Run(new Break { Type = BreakValues.Page })
|
|
573
|
+
));
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/// <summary>
|
|
577
|
+
/// Creates an APA Level 4 or 5 "run-in" paragraph where the heading text
|
|
578
|
+
/// (bold or bold italic) is followed by the body text on the same line.
|
|
579
|
+
/// The heading ends with a period per APA 7 convention.
|
|
580
|
+
/// </summary>
|
|
581
|
+
private static Paragraph CreateAPA7RunInParagraph(
|
|
582
|
+
string headingText, string bodyText, bool bold, bool italic)
|
|
583
|
+
{
|
|
584
|
+
var headingRunProps = new RunProperties(
|
|
585
|
+
new RunFonts
|
|
586
|
+
{
|
|
587
|
+
Ascii = "Times New Roman",
|
|
588
|
+
HighAnsi = "Times New Roman",
|
|
589
|
+
ComplexScript = "Times New Roman"
|
|
590
|
+
},
|
|
591
|
+
new FontSize { Val = "24" },
|
|
592
|
+
new FontSizeComplexScript { Val = "24" }
|
|
593
|
+
);
|
|
594
|
+
|
|
595
|
+
if (bold)
|
|
596
|
+
headingRunProps.Append(new Bold());
|
|
597
|
+
if (italic)
|
|
598
|
+
headingRunProps.Append(new Italic());
|
|
599
|
+
|
|
600
|
+
return new Paragraph(
|
|
601
|
+
new ParagraphProperties(
|
|
602
|
+
new Indentation { FirstLine = "720" }, // 0.5in indent
|
|
603
|
+
new SpacingBetweenLines
|
|
604
|
+
{
|
|
605
|
+
Line = "480",
|
|
606
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
607
|
+
After = "0"
|
|
608
|
+
}
|
|
609
|
+
),
|
|
610
|
+
// Heading run (bold / bold italic)
|
|
611
|
+
new Run(
|
|
612
|
+
headingRunProps,
|
|
613
|
+
new Text(headingText) { Space = SpaceProcessingModeValues.Preserve }
|
|
614
|
+
),
|
|
615
|
+
// Body text run (regular)
|
|
616
|
+
new Run(
|
|
617
|
+
new RunProperties(
|
|
618
|
+
new RunFonts
|
|
619
|
+
{
|
|
620
|
+
Ascii = "Times New Roman",
|
|
621
|
+
HighAnsi = "Times New Roman",
|
|
622
|
+
ComplexScript = "Times New Roman"
|
|
623
|
+
},
|
|
624
|
+
new FontSize { Val = "24" },
|
|
625
|
+
new FontSizeComplexScript { Val = "24" }
|
|
626
|
+
),
|
|
627
|
+
new Text(bodyText) { Space = SpaceProcessingModeValues.Preserve }
|
|
628
|
+
)
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
// ════════════════════════════════════════════════════════════════════════
|
|
634
|
+
// RECIPE 9: MLA 9TH EDITION
|
|
635
|
+
// ════════════════════════════════════════════════════════════════════════
|
|
636
|
+
|
|
637
|
+
/// <summary>
|
|
638
|
+
/// Recipe: MLA 9th Edition
|
|
639
|
+
/// Source: MLA Handbook, 9th edition (2021), Part 1 (Principles of Scholarship)
|
|
640
|
+
/// and Part 2 (Details of MLA Style).
|
|
641
|
+
///
|
|
642
|
+
/// Key MLA 9 specifications:
|
|
643
|
+
/// - Font: 12pt Times New Roman (or other readable font; Times New Roman is standard).
|
|
644
|
+
/// - Margins: 1 inch on all sides.
|
|
645
|
+
/// - Line spacing: Double-spaced throughout, including block quotes and Works Cited.
|
|
646
|
+
/// - Paragraph indent: 0.5 inch first-line indent for body paragraphs.
|
|
647
|
+
/// - Title: Centered, same size as body text (12pt), NOT bold, italic, or underlined.
|
|
648
|
+
/// MLA eschews visual hierarchy — the title is distinguished only by centering.
|
|
649
|
+
/// - No mandatory heading system. If headings are used, they should be simple and
|
|
650
|
+
/// consistent. MLA does not prescribe heading levels like APA does.
|
|
651
|
+
/// - Running header: Author's last name and page number, flush right, 0.5 inch from top.
|
|
652
|
+
/// - First-page header block: Student's name, instructor's name, course title, and
|
|
653
|
+
/// date — upper left, double-spaced, NO extra spacing.
|
|
654
|
+
/// - Works Cited: title "Works Cited" centered (not bold), entries have hanging indent
|
|
655
|
+
/// of 0.5 inch (first line flush left, subsequent lines indented).
|
|
656
|
+
/// - No title page required (unless specifically requested by instructor).
|
|
657
|
+
///
|
|
658
|
+
/// Design rationale:
|
|
659
|
+
/// - MLA's aesthetic is deliberately plain — the writing is the content.
|
|
660
|
+
/// - No bold headings, no size variation, no decorative elements.
|
|
661
|
+
/// - The only structural markers are centering (title, Works Cited label)
|
|
662
|
+
/// and indentation (paragraphs, hanging indent for citations).
|
|
663
|
+
/// - This uniformity reflects MLA's roots in literary studies, where the
|
|
664
|
+
/// text itself is paramount and formatting should be invisible.
|
|
665
|
+
/// </summary>
|
|
666
|
+
public static void CreateMLA9Document(string outputPath)
|
|
667
|
+
{
|
|
668
|
+
using var doc = WordprocessingDocument.Create(outputPath, WordprocessingDocumentType.Document);
|
|
669
|
+
|
|
670
|
+
var mainPart = doc.AddMainDocumentPart();
|
|
671
|
+
mainPart.Document = new Document(new Body());
|
|
672
|
+
var body = mainPart.Document.Body!;
|
|
673
|
+
|
|
674
|
+
// ── Styles ──
|
|
675
|
+
var stylesPart = mainPart.AddNewPart<StyleDefinitionsPart>();
|
|
676
|
+
stylesPart.Styles = new Styles();
|
|
677
|
+
var styles = stylesPart.Styles;
|
|
678
|
+
|
|
679
|
+
// DocDefaults: 12pt Times New Roman, double spacing, 0.5in first-line indent
|
|
680
|
+
styles.Append(new DocDefaults(
|
|
681
|
+
new RunPropertiesDefault(
|
|
682
|
+
new RunPropertiesBaseStyle(
|
|
683
|
+
new RunFonts
|
|
684
|
+
{
|
|
685
|
+
Ascii = "Times New Roman",
|
|
686
|
+
HighAnsi = "Times New Roman",
|
|
687
|
+
EastAsia = "SimSun",
|
|
688
|
+
ComplexScript = "Times New Roman"
|
|
689
|
+
},
|
|
690
|
+
new FontSize { Val = "24" }, // 12pt
|
|
691
|
+
new FontSizeComplexScript { Val = "24" },
|
|
692
|
+
new Color { Val = "000000" },
|
|
693
|
+
new Languages { Val = "en-US", EastAsia = "zh-CN" }
|
|
694
|
+
)
|
|
695
|
+
),
|
|
696
|
+
new ParagraphPropertiesDefault(
|
|
697
|
+
new ParagraphPropertiesBaseStyle(
|
|
698
|
+
new SpacingBetweenLines
|
|
699
|
+
{
|
|
700
|
+
Line = "480", // Double spacing throughout
|
|
701
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
702
|
+
After = "0"
|
|
703
|
+
},
|
|
704
|
+
new Indentation { FirstLine = "720" } // 0.5in first-line indent
|
|
705
|
+
)
|
|
706
|
+
)
|
|
707
|
+
));
|
|
708
|
+
|
|
709
|
+
// ── Normal style ──
|
|
710
|
+
styles.Append(CreateParagraphStyle(
|
|
711
|
+
styleId: "Normal",
|
|
712
|
+
styleName: "Normal",
|
|
713
|
+
isDefault: true,
|
|
714
|
+
uiPriority: 0
|
|
715
|
+
));
|
|
716
|
+
|
|
717
|
+
// ── MLA Title style: centered, NOT bold/italic/underlined ──
|
|
718
|
+
// MLA is distinctive: the title has NO special formatting beyond centering.
|
|
719
|
+
styles.Append(CreateMLA9TitleStyle());
|
|
720
|
+
|
|
721
|
+
// ── MLA Header Block style: flush left, no indent ──
|
|
722
|
+
styles.Append(CreateMLA9HeaderBlockStyle());
|
|
723
|
+
|
|
724
|
+
// ── MLA Works Cited label style: centered, not bold ──
|
|
725
|
+
styles.Append(CreateMLA9WorksCitedLabelStyle());
|
|
726
|
+
|
|
727
|
+
// ── MLA Works Cited entry style: hanging indent 0.5in ──
|
|
728
|
+
styles.Append(CreateMLA9WorksCitedEntryStyle());
|
|
729
|
+
|
|
730
|
+
// ── Page setup: US Letter, 1in all sides ──
|
|
731
|
+
var sectPr = new SectionProperties(
|
|
732
|
+
new WpPageSize { Width = 12240U, Height = 15840U },
|
|
733
|
+
new PageMargin
|
|
734
|
+
{
|
|
735
|
+
Top = 1440, Bottom = 1440,
|
|
736
|
+
Left = 1440U, Right = 1440U,
|
|
737
|
+
Header = 720U, Footer = 720U, Gutter = 0U
|
|
738
|
+
}
|
|
739
|
+
);
|
|
740
|
+
|
|
741
|
+
// ── Running header: "LastName PageNumber" flush right ──
|
|
742
|
+
AddMLA9Header(mainPart, sectPr, "Mitchell");
|
|
743
|
+
|
|
744
|
+
// ══════════════════════════════════════════════════════════════════
|
|
745
|
+
// SAMPLE CONTENT: MLA header block, title, body, Works Cited
|
|
746
|
+
// ══════════════════════════════════════════════════════════════════
|
|
747
|
+
|
|
748
|
+
// ── First-page header block (upper left, double-spaced) ──
|
|
749
|
+
AddSampleParagraph(body, "Sarah Mitchell", "MLAHeaderBlock");
|
|
750
|
+
AddSampleParagraph(body, "Professor Johnson", "MLAHeaderBlock");
|
|
751
|
+
AddSampleParagraph(body, "English 201: American Literature", "MLAHeaderBlock");
|
|
752
|
+
AddSampleParagraph(body, "15 October 2024", "MLAHeaderBlock");
|
|
753
|
+
|
|
754
|
+
// ── Title: centered, 12pt, plain (not bold) ──
|
|
755
|
+
AddSampleParagraph(body, "The Function of the Unreliable Narrator in Nabokov's Lolita", "MLATitle");
|
|
756
|
+
|
|
757
|
+
// ── Body paragraphs ──
|
|
758
|
+
AddSampleParagraph(body,
|
|
759
|
+
"Vladimir Nabokov's Lolita (1955) remains one of the most studied examples of "
|
|
760
|
+
+ "unreliable narration in twentieth-century fiction. Humbert Humbert's elaborate, "
|
|
761
|
+
+ "self-justifying prose has been analyzed through numerous critical lenses, yet the "
|
|
762
|
+
+ "question of how the novel's narrative structure shapes reader complicity continues "
|
|
763
|
+
+ "to generate scholarly debate.",
|
|
764
|
+
"Normal");
|
|
765
|
+
|
|
766
|
+
AddSampleParagraph(body,
|
|
767
|
+
"The concept of the unreliable narrator, first articulated by Wayne C. Booth in "
|
|
768
|
+
+ "The Rhetoric of Fiction (1961), provides a foundational framework for understanding "
|
|
769
|
+
+ "Humbert's discourse. Booth argues that unreliable narrators are those whose values "
|
|
770
|
+
+ "diverge from those of the implied author (158-59). In Lolita, this divergence is "
|
|
771
|
+
+ "particularly complex because Nabokov layers multiple forms of unreliability: "
|
|
772
|
+
+ "factual, evaluative, and interpretive.",
|
|
773
|
+
"Normal");
|
|
774
|
+
|
|
775
|
+
AddSampleParagraph(body,
|
|
776
|
+
"Michael Wood has observed that \"Nabokov's genius lies in making us forget, "
|
|
777
|
+
+ "momentarily, that Humbert is a monster\" (127). This temporary forgetting is not "
|
|
778
|
+
+ "a failure of reading but a designed effect of the narrative voice. The luxurious "
|
|
779
|
+
+ "prose, the literary allusions, the self-deprecating wit \u2014 all serve to create what "
|
|
780
|
+
+ "Nomi Tamir-Ghez calls \"rhetorical seduction\" (42), in which readers find "
|
|
781
|
+
+ "themselves sympathizing with a narrator whose actions they would condemn.",
|
|
782
|
+
"Normal");
|
|
783
|
+
|
|
784
|
+
AddSampleParagraph(body,
|
|
785
|
+
"The structural implications of Humbert's unreliability extend beyond mere "
|
|
786
|
+
+ "factual distortion. As Eric Naiman demonstrates, the novel's famous opening "
|
|
787
|
+
+ "paragraph \u2014 with its incantatory repetition of \"Lolita\" \u2014 establishes a "
|
|
788
|
+
+ "pattern of linguistic possession that mirrors Humbert's physical possession of "
|
|
789
|
+
+ "Dolores Haze (85). The language itself becomes an instrument of control, one "
|
|
790
|
+
+ "that operates on the reader as well as on the characters within the narrative.",
|
|
791
|
+
"Normal");
|
|
792
|
+
|
|
793
|
+
// ── Works Cited ──
|
|
794
|
+
// Page break before Works Cited
|
|
795
|
+
body.Append(new Paragraph(
|
|
796
|
+
new ParagraphProperties(
|
|
797
|
+
new ParagraphStyleId { Val = "MLAHeaderBlock" }
|
|
798
|
+
),
|
|
799
|
+
new Run(new Break { Type = BreakValues.Page })
|
|
800
|
+
));
|
|
801
|
+
|
|
802
|
+
AddSampleParagraph(body, "Works Cited", "MLAWorksCitedLabel");
|
|
803
|
+
|
|
804
|
+
// Works Cited entries with hanging indent
|
|
805
|
+
AddSampleParagraph(body,
|
|
806
|
+
"Booth, Wayne C. The Rhetoric of Fiction. 2nd ed., U of Chicago P, 1983.",
|
|
807
|
+
"MLAWorksCitedEntry");
|
|
808
|
+
|
|
809
|
+
AddSampleParagraph(body,
|
|
810
|
+
"Nabokov, Vladimir. Lolita. 1955. Vintage International, 1989.",
|
|
811
|
+
"MLAWorksCitedEntry");
|
|
812
|
+
|
|
813
|
+
AddSampleParagraph(body,
|
|
814
|
+
"Naiman, Eric. Nabokov, Perversely. Cornell UP, 2010.",
|
|
815
|
+
"MLAWorksCitedEntry");
|
|
816
|
+
|
|
817
|
+
AddSampleParagraph(body,
|
|
818
|
+
"Tamir-Ghez, Nomi. \"The Art of Persuasion in Nabokov's Lolita.\" Poetics Today, "
|
|
819
|
+
+ "vol. 1, no. 1-2, 1979, pp. 65-83.",
|
|
820
|
+
"MLAWorksCitedEntry");
|
|
821
|
+
|
|
822
|
+
AddSampleParagraph(body,
|
|
823
|
+
"Wood, Michael. The Magician's Doubts: Nabokov and the Risks of Fiction. "
|
|
824
|
+
+ "Princeton UP, 1995.",
|
|
825
|
+
"MLAWorksCitedEntry");
|
|
826
|
+
|
|
827
|
+
// Section properties must be last child of body
|
|
828
|
+
body.Append(sectPr);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/// <summary>
|
|
832
|
+
/// MLA title style: centered, 12pt, NO bold/italic/underline.
|
|
833
|
+
/// MLA's radical plainness — the title is distinguished only by position.
|
|
834
|
+
/// </summary>
|
|
835
|
+
private static Style CreateMLA9TitleStyle()
|
|
836
|
+
{
|
|
837
|
+
return new Style(
|
|
838
|
+
new StyleName { Val = "MLA Title" },
|
|
839
|
+
new BasedOn { Val = "Normal" },
|
|
840
|
+
new UIPriority { Val = 1 },
|
|
841
|
+
new StyleParagraphProperties(
|
|
842
|
+
new Justification { Val = JustificationValues.Center },
|
|
843
|
+
new Indentation { FirstLine = "0" },
|
|
844
|
+
new SpacingBetweenLines
|
|
845
|
+
{
|
|
846
|
+
Line = "480",
|
|
847
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
848
|
+
After = "0"
|
|
849
|
+
}
|
|
850
|
+
)
|
|
851
|
+
)
|
|
852
|
+
{
|
|
853
|
+
Type = StyleValues.Paragraph,
|
|
854
|
+
StyleId = "MLATitle",
|
|
855
|
+
Default = false
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/// <summary>
|
|
860
|
+
/// MLA first-page header block style: flush left, no first-line indent, double-spaced.
|
|
861
|
+
/// Used for the student name, instructor, course, and date lines.
|
|
862
|
+
/// </summary>
|
|
863
|
+
private static Style CreateMLA9HeaderBlockStyle()
|
|
864
|
+
{
|
|
865
|
+
return new Style(
|
|
866
|
+
new StyleName { Val = "MLA Header Block" },
|
|
867
|
+
new BasedOn { Val = "Normal" },
|
|
868
|
+
new UIPriority { Val = 1 },
|
|
869
|
+
new StyleParagraphProperties(
|
|
870
|
+
new Justification { Val = JustificationValues.Left },
|
|
871
|
+
new Indentation { FirstLine = "0" },
|
|
872
|
+
new SpacingBetweenLines
|
|
873
|
+
{
|
|
874
|
+
Line = "480",
|
|
875
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
876
|
+
After = "0"
|
|
877
|
+
}
|
|
878
|
+
)
|
|
879
|
+
)
|
|
880
|
+
{
|
|
881
|
+
Type = StyleValues.Paragraph,
|
|
882
|
+
StyleId = "MLAHeaderBlock",
|
|
883
|
+
Default = false
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
/// <summary>
|
|
888
|
+
/// MLA Works Cited label style: centered, 12pt, NOT bold.
|
|
889
|
+
/// Like the title, the label is plain — only centering distinguishes it.
|
|
890
|
+
/// </summary>
|
|
891
|
+
private static Style CreateMLA9WorksCitedLabelStyle()
|
|
892
|
+
{
|
|
893
|
+
return new Style(
|
|
894
|
+
new StyleName { Val = "MLA Works Cited Label" },
|
|
895
|
+
new BasedOn { Val = "Normal" },
|
|
896
|
+
new UIPriority { Val = 1 },
|
|
897
|
+
new StyleParagraphProperties(
|
|
898
|
+
new Justification { Val = JustificationValues.Center },
|
|
899
|
+
new Indentation { FirstLine = "0" },
|
|
900
|
+
new SpacingBetweenLines
|
|
901
|
+
{
|
|
902
|
+
Line = "480",
|
|
903
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
904
|
+
After = "0"
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
)
|
|
908
|
+
{
|
|
909
|
+
Type = StyleValues.Paragraph,
|
|
910
|
+
StyleId = "MLAWorksCitedLabel",
|
|
911
|
+
Default = false
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/// <summary>
|
|
916
|
+
/// MLA Works Cited entry style: hanging indent of 0.5 inch (720 DXA).
|
|
917
|
+
/// First line is flush left; subsequent lines indent 0.5 inch.
|
|
918
|
+
/// This is the standard format for bibliography entries in MLA style.
|
|
919
|
+
/// </summary>
|
|
920
|
+
private static Style CreateMLA9WorksCitedEntryStyle()
|
|
921
|
+
{
|
|
922
|
+
return new Style(
|
|
923
|
+
new StyleName { Val = "MLA Works Cited Entry" },
|
|
924
|
+
new BasedOn { Val = "Normal" },
|
|
925
|
+
new UIPriority { Val = 1 },
|
|
926
|
+
new StyleParagraphProperties(
|
|
927
|
+
new Justification { Val = JustificationValues.Left },
|
|
928
|
+
// Hanging indent: Left = 720, FirstLine is negative (Hanging = 720)
|
|
929
|
+
new Indentation { Left = "720", Hanging = "720" },
|
|
930
|
+
new SpacingBetweenLines
|
|
931
|
+
{
|
|
932
|
+
Line = "480",
|
|
933
|
+
LineRule = LineSpacingRuleValues.Auto,
|
|
934
|
+
After = "0"
|
|
935
|
+
}
|
|
936
|
+
)
|
|
937
|
+
)
|
|
938
|
+
{
|
|
939
|
+
Type = StyleValues.Paragraph,
|
|
940
|
+
StyleId = "MLAWorksCitedEntry",
|
|
941
|
+
Default = false
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/// <summary>
|
|
946
|
+
/// Adds the MLA 9 running header: author last name and page number, flush right,
|
|
947
|
+
/// 0.5 inch from top of page. Per MLA convention, this appears on every page.
|
|
948
|
+
/// </summary>
|
|
949
|
+
private static void AddMLA9Header(MainDocumentPart mainPart, SectionProperties sectPr, string authorLastName)
|
|
950
|
+
{
|
|
951
|
+
var headerParagraph = new Paragraph(
|
|
952
|
+
new ParagraphProperties(
|
|
953
|
+
new Justification { Val = JustificationValues.Right },
|
|
954
|
+
new Indentation { FirstLine = "0" },
|
|
955
|
+
new SpacingBetweenLines { Line = "240", LineRule = LineSpacingRuleValues.Auto, After = "0" }
|
|
956
|
+
),
|
|
957
|
+
// Author last name
|
|
958
|
+
new Run(
|
|
959
|
+
new RunProperties(
|
|
960
|
+
new RunFonts
|
|
961
|
+
{
|
|
962
|
+
Ascii = "Times New Roman",
|
|
963
|
+
HighAnsi = "Times New Roman"
|
|
964
|
+
},
|
|
965
|
+
new FontSize { Val = "24" },
|
|
966
|
+
new FontSizeComplexScript { Val = "24" }
|
|
967
|
+
),
|
|
968
|
+
new Text(authorLastName + " ") { Space = SpaceProcessingModeValues.Preserve }
|
|
969
|
+
),
|
|
970
|
+
// Page number
|
|
971
|
+
new SimpleField(
|
|
972
|
+
new Run(
|
|
973
|
+
new RunProperties(
|
|
974
|
+
new RunFonts
|
|
975
|
+
{
|
|
976
|
+
Ascii = "Times New Roman",
|
|
977
|
+
HighAnsi = "Times New Roman"
|
|
978
|
+
},
|
|
979
|
+
new FontSize { Val = "24" },
|
|
980
|
+
new FontSizeComplexScript { Val = "24" }
|
|
981
|
+
),
|
|
982
|
+
new Text("1")
|
|
983
|
+
)
|
|
984
|
+
)
|
|
985
|
+
{ Instruction = " PAGE " }
|
|
986
|
+
);
|
|
987
|
+
|
|
988
|
+
var headerPart = mainPart.AddNewPart<HeaderPart>();
|
|
989
|
+
headerPart.Header = new Header(headerParagraph);
|
|
990
|
+
headerPart.Header.Save();
|
|
991
|
+
|
|
992
|
+
string headerPartId = mainPart.GetIdOfPart(headerPart);
|
|
993
|
+
sectPr.Append(new HeaderReference
|
|
994
|
+
{
|
|
995
|
+
Type = HeaderFooterValues.Default,
|
|
996
|
+
Id = headerPartId
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
}
|