Skip to content

DocumentCreator

reference
1 min readUpdated

Kind: Class

Source: Frontend/src/app/components/dashboard/_principalReport/docx-generator.ts (line 22)

Part of: Frontend

DocumentCreator builds a docx Document for the principal report view. Its create() method assembles report sections from paragraph-producing helpers, including contact information, headings, institution details, skills, achievements, and interests.

Methods

MethodSignatureReturns
createcreate([experiences, educations, skills, achivements, chart]: undefined)Document
createContactInfocreateContactInfo(phoneNumber: string, profileUrl: string, email: string)Paragraph
createHeadingcreateHeading(text: string)Paragraph
createSubHeadingcreateSubHeading(text: string)Paragraph
createInstitutionHeadercreateInstitutionHeader(institutionName: string, dateText: string)Paragraph
createRoleTextcreateRoleText(roleText: string)Paragraph
createBulletcreateBullet(text: string)Paragraph
createSkillListcreateSkillList(skills: any[])Paragraph
createAchivementsListcreateAchivementsList(achivements: any[])Paragraph[]
createInterestscreateInterests(interests: string)Paragraph
svgToBase64svgToBase64(svg: string)string
splitParagraphIntoBulletssplitParagraphIntoBullets(text: string)string[]
createPositionDateTextcreatePositionDateText(startDate: any, endDate: any, isCurrent: boolean)string
getMonthFromIntgetMonthFromInt(value: number)string

Diagram

mermaid
graph LR
  A[DocumentCreator] --> B[create(): Document]
  B --> C[createContactInfo]
  B --> D[createHeading]
  B --> E[createSubHeading]
  B --> F[createInstitutionHeader]
  B --> G[createRoleText]
  B --> H[createBullet]
  B --> I[createSkillList]
  B --> J[createAchivementsList]
  B --> K[createInterests]

  C --> L[Paragraph]
  D --> L
  E --> L
  F --> L
  G --> L
  H --> L
  I --> L
  J --> M[Paragraph[]]
  K --> L
  L --> N[docx Document]
  M --> N

Usage

ts
import { Packer } from "docx";
import { DocumentCreator } from "./docx-generator";

const reportData = {
  // Supply the report data expected by DocumentCreator.
};

const creator = new DocumentCreator(reportData);
const document = creator.create();

const fileBlob = await Packer.toBlob(document);

const url = URL.createObjectURL(fileBlob);
window.open(url, "_blank");

AI Coding Instructions

  • Keep document assembly inside create() and use the helper methods to produce Paragraph instances for each report section.
  • Preserve the createAchivementsList() method name when calling or modifying it, even though its spelling differs from “achievements.”
  • Return Paragraph[] from createAchivementsList() so multiple achievement entries can be added to the generated document.
  • Use docx primitives such as Document and Paragraph; do not return HTML or React elements from this generator.
  • Update the report-data mapping passed to DocumentCreator when dashboard report fields change.

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • OverallAnalysisYearMapFrontend/src/app/components/dashboard/_principalReport/principal-report.component.ts:1

Was this page helpful?

Download as PDF