<img src="https://solution-community.wps.cn/uploads/post/4TLiqF8kDgw.png" alt="CleanShot 2023-07-06 at 18.10.42@2x.png"/>
<img src="https://solution-community.wps.cn/uploads/post/4TLiqF8kDgw.png" alt="CleanShot 2023-07-06 at 18.10.42@2x.png"/>
你好, 请参考以下代码
// 拿到当前sheet
const activeSheet = await app.ActiveWorkbook.ActiveSheet
// 获取所有列
const columns = activeSheet.Columns
// 获取第一列
const col1 = await columns.Item(1)
// 获取宽度
const width = await col1.ColumnWidth
// 通过 await columns.Count 取出列数,for循环遍历,获取每一列ColumnWidth
// 设置列宽: col1.ColumnWidth = 20
详细API请参考:ColumnWidth