2
 workSheet.getCell(`B7`).alignment = {
    vertical: 'middle', horizontal: 'left',
    wrapText: true // autoHeight
  };

its only work on 1 cell B7

if i tried to merge cell on B7 and F7 the text doesnt wrap.

i have tried logic with get height after wrapText then merge cell then set height but in first condition i never set height so the value would undefined where the documentation tell the height default is 15 and always undefined if we didnt set/init on first.

  const rowHeight = workSheet.getRow(7).height;
  console.log(`height before merge ${rowHeight}`); // i know this undefined 
  workSheet.mergeCells(`B7`, `D7`);
  const rowAfterMerge = workSheet.getRow(7).height;
  console.log(`height after merge ${rowAfterMerge}`);

i tried to initialize before execute code on above with workSheet.getRow(7).height = 15;

but the value always 15 on get height after on wrapText.

anyone have solution for wrapText on cell where the cell is merge cell ( B7 - F7 ). always got ellipsize blank text.

Yogi Arif Widodo
  • 563
  • 6
  • 22

0 Answers0