텍스트 컴포넌트를 textarea로 변경

This commit is contained in:
dohyeons
2025-12-17 17:10:26 +09:00
parent b7b881ee86
commit fb4b5b7e26
4 changed files with 49 additions and 23 deletions

View File

@@ -623,18 +623,29 @@ export class ReportController {
? AlignmentTypeRef.RIGHT
: AlignmentTypeRef.LEFT;
// 줄바꿈 처리: \n으로 split하여 각 줄을 TextRun으로 생성
const lines = displayValue.split("\n");
const textChildren: TextRun[] = [];
lines.forEach((line: string, index: number) => {
if (index > 0) {
// 줄바꿈 추가 (break: 1은 줄바꿈 1개)
textChildren.push(new TextRunRef({ break: 1 }));
}
textChildren.push(
new TextRunRef({
text: line,
size: fontSizeHalfPt,
color: (component.fontColor || "#000000").replace("#", ""),
bold: component.fontWeight === "bold" || component.fontWeight === "600",
font: "맑은 고딕",
})
);
});
result.push(
new ParagraphRef({
alignment,
children: [
new TextRunRef({
text: displayValue,
size: fontSizeHalfPt,
color: (component.fontColor || "#000000").replace("#", ""),
bold: component.fontWeight === "bold" || component.fontWeight === "600",
font: "맑은 고딕",
}),
],
children: textChildren,
})
);
}
@@ -908,20 +919,30 @@ export class ReportController {
? AlignmentType.RIGHT
: AlignmentType.LEFT;
// 줄바꿈 처리: \n으로 split하여 각 줄을 TextRun으로 생성
const lines = displayValue.split("\n");
const textChildren: TextRun[] = [];
lines.forEach((line: string, index: number) => {
if (index > 0) {
textChildren.push(new TextRun({ break: 1 }));
}
textChildren.push(
new TextRun({
text: line,
size: fontSizeHalfPt,
color: (component.fontColor || "#000000").replace("#", ""),
bold: component.fontWeight === "bold" || component.fontWeight === "600",
font: "맑은 고딕",
})
);
});
// 테이블 셀로 감싸서 width 제한 → 자동 줄바꿈
const textCell = new TableCell({
children: [
new Paragraph({
alignment,
children: [
new TextRun({
text: displayValue,
size: fontSizeHalfPt,
color: (component.fontColor || "#000000").replace("#", ""),
bold: component.fontWeight === "bold" || component.fontWeight === "600",
font: "맑은 고딕",
}),
],
children: textChildren,
}),
],
width: { size: pxToTwip(component.width), type: WidthType.DXA },