table-xlsx icon indicating copy to clipboard operation
table-xlsx copied to clipboard

表格的宽度能不能支持根据内容自动计算?

Open muyudou opened this issue 2 years ago • 3 comments

muyudou avatar Aug 29 '23 06:08 muyudou

你是想根据列表最长的内容然后不换行去设置列宽吗?然后内容很长的话,列宽就会很长这样吗

PengChen96 avatar Aug 29 '23 06:08 PengChen96

你是想根据列表最长的内容然后不换行去设置列宽吗?然后内容很长的话,列宽就会很长这样吗

是的,或者可以加个最大宽度,超过这个换行,目前还想限制死的宽度

muyudou avatar Sep 27 '23 02:09 muyudou

嗯,你可以试下通过columns上的width设置宽度,然后设置rowHpx和alignmentWrapText来换行

exportFile({
  columns: columns,
  dataSource: dataSource,
  rowHpx: null,
  bodyCellStyle: {
    alignmentWrapText: true,
  },
});
image

PengChen96 avatar Sep 27 '23 03:09 PengChen96