행과 열

Facade API

Facade API 참고에는 완전한 유형 정의가 포함되어 있습니다.

행

지정한 위치 뒤에 행 삽입

insertRowAfter(afterPosition): 주어진 위치에 줄 후에 새로운 줄을 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts a row after the first row positionsheet.insertRowAfter(0)

지정한 위치 앞에 행 삽입

insertRowBefore(beforePosition): 주어진 위치에 줄의 앞에 새로운 줄을 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts a row before the first row positionsheet.insertRowBefore(0)

지정한 위치에 여러 행 삽입

insertRows(rowIndex, numRows): 주어진 위치에 시작된 1개 이상 연속 공백 줄을 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Shifts all rows down by threesheet.insertRows(0, 3)

지정한 위치 뒤에 여러 행 삽입

insertRowsAfter(afterPosition, howMany): 주어진 위치에 줄 후에 줄의 주어진 수를 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts five rows after the first rowsheet.insertRowsAfter(0, 5)

지정한 위치 앞에 여러 행 삽입

insertRowsBefore(beforePosition, howMany): 주어진 위치에 줄의 앞에 줄의 주어진 수를 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts five rows before the first rowsheet.insertRowsBefore(0, 5)

지정한 위치의 행 삭제

deleteRow(rowPosition): 주어진 위치에 줄을 삭제합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Rows start at "0" - this deletes the first rowsheet.deleteRow(0)

지정한 위치부터 여러 행 삭제

deleteRows(rowPosition, howMany): 주어진 위치에 시작된 줄의 주어진 수를 삭제합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Rows start at "0" - this deletes the first two rowssheet.deleteRows(0, 2)

지정한 여러 위치의 행 삭제

deleteRowsByPoints(rowPoints): 단일 작업에서 여러 행을 삭제하고 행 포지션의 배열을 부여합니다. 행은 연속할 필요가 없습니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Rows start at "0" - this deletes the 3rd row and rows 5 to 7fWorksheet.deleteRowsByPoints([2, [4, 6]])

행을 새 위치로 이동

moveRows(rowSpec, destinationIndex): rowSpec에서 destinationIndex로 선택된 행을 이동하십시오. 범위는 단 하나 줄 또는 줄의 그룹과 맞출 필요가 없습니다: 각 행은 선정됩니다.

TypeScript
// The code below moves rows 1-2 to destination index 5// This results in those rows becoming rows 3-4const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Selects row 1 and row 2 to be movedconst rowSpec = sheet.getRange('1:2')sheet.moveRows(rowSpec, 5)

지정한 범위의 행 숨기기

hideRow(row): 주어진 범위에 있는 줄을 숨깁니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This hides the first rowconst range = sheet.getRange('1:1')sheet.hideRow(range)

연속된 여러 행 숨기기

hideRows(rowIndex, numRows): 주어진 색인에서 시작된 1개 이상 연속적인 줄을 숨깁니다. 방법은 0 근거한 색인을 이용합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Hides the first three rowssheet.hideRows(0, 3)

지정한 범위의 행 숨기기 해제

unhideRow(row): 주어진 범위에 있는 줄을 삭제하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This unhides the first row if it was previously hiddenconst range = sheet.getRange('1:1')sheet.unhideRow(range)

연속된 여러 행 숨기기 해제

showRows(rowIndex, numRows): 주어진 색인에서 시작된 1개 이상 연속적인 줄을 삭제하십시오. 방법은 0 근거한 색인을 이용합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Unhides the first three rowssheet.showRows(0, 3)

행 높이 설정

setRowHeight(rowPosition, height): 픽셀의 주어진 행의 높이를 설정합니다. 기본적으로, 행은 세포 내용에 맞게 성장합니다. 특정 높이를 강제하려면 setRowHeightsForced(startRow, numRows, height)를 사용하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Sets the first row to a height of 200 pixelssheet.setRowHeight(0, 200)

여러 행의 높이 설정

setRowHeights(startRow, numRows, height): 픽셀의 주어진 행의 높이를 설정합니다. 기본적으로 행은 셀 내용에 맞게 성장합니다. 특정 높이를 강제하려면 setRowHeightsForced(startRow, numRows, height)를 사용하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Sets the first three rows to a height of 200 pixelssheet.setRowHeights(0, 3, 200)

여러 행의 높이 강제 설정

setRowHeightsForced(startRow, numRows, height): 픽셀의 주어진 행의 높이를 설정합니다. 기본적으로, 행은 셀 내용에 맞게 성장합니다. setRowHeightsForced를 사용하면 각 행은 키가 높을 때 할당된 높이를 유지합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Sets the first three rows to a height of 5 pixelssheet.setRowHeightsForced(0, 3, 5)

행 크기 자동 조정

autoResizeRows(startRow, numRows): 주어진 행의 높이를 설정하여 텍스트 콘텐츠를 맞게 설정합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Set the first 3 rows to a height that fits their text.sheet.autoResizeRows(0, 3)

행 사용자 지정 속성 설정

setRowCustom(custom): 주어진 줄에 사용자 정의 속성을 설정합니다. 각 행은 추가 정보를 저장하기위한 JSON 데이터를 보유 할 수있는 custom 개체를받습니다. 이전에 저장 된 custom 데이터를 덮어 쓰기 custom를 작성합니다. 기존 custom 데이터 유지하려면 먼저 custom 객체를 읽고 새로운 데이터로 병합 한 다음 작성하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Set custom properties for the first and third rowssheet.setRowCustom({  0: { color: 'red' },  2: { size: 16 },})

열

지정한 위치 뒤에 열 삽입

insertColumnAfter(afterPosition): 주어진 위치에 열 후에 새로운 란을 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts a column after the first column positionsheet.insertColumnAfter(0)

지정한 위치 앞에 열 삽입

insertColumnBefore(beforePosition): 주어진 위치에 열의 앞에 새로운 란을 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts a column in the first column positionsheet.insertColumnBefore(0)

지정한 위치에 여러 열 삽입

insertColumns(columnIndex, numColumns): 주어진 위치에 시작된 1개 이상 연속적인 공백 란을 삽입합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Shifts all columns by threesheet.insertColumns(0, 3)

지정한 위치 뒤에 여러 열 삽입

insertColumnsAfter(afterPosition, howMany): 주어진 위치에 열 후에 주어진 란의 주어진 수를 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Inserts two columns after the first columnsheet.insertColumnsAfter(0, 2)

지정한 위치 앞에 여러 열 삽입

insertColumnsBefore(beforePosition, howMany): 주어진 위치에 열의 앞에 주어진 수를 삽입하십시오.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This inserts five columns before the first columnsheet.insertColumnsBefore(0, 5)

지정한 위치의 열 삭제

deleteColumn(columnPosition): 주어진 위치에 열을 삭제합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Columns start at "0" - this deletes the first columnsheet.deleteColumn(0)

지정한 위치부터 여러 열 삭제

deleteColumns(columnPosition, howMany): 주어진 위치에 시작된 열의 주어진 수를 삭제합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Columns start at "0" - this deletes the first two columnssheet.deleteColumns(0, 2)

지정한 여러 위치의 열 삭제

deleteColumnsByPoints(columnPoints): 단일 작업에서 여러 열을 삭제하고 열 위치의 배열을 부여합니다. 열은 연속 할 필요가 없습니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Columns start at "0" - this deletes the Column C and Columns E-GfWorksheet.deleteColumnsByPoints([2, [4, 6]])

열을 새 위치로 이동

moveColumns(columnSpec, destinationIndex): columnSpec에서 destinationIndex로 선택된 열을 이동하십시오. 범위는 단 하나 란 또는 란의 그룹과 맞출 필요가 없습니다: 각 란은 선택됩니다.

TypeScript
// The code below moves rows A-B to destination index 5.// This results in those columns becoming columns C-D.const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Selects column A and column B to be moved.const columnSpec = sheet.getRange('A:B')sheet.moveColumns(columnSpec, 5)

지정한 범위의 열 숨기기

hideColumn(column): 지정한 범위의 열을 숨깁니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This hides the first columnconst range = sheet.getRange('A:A')sheet.hideColumn(range)

연속된 여러 열 숨기기

hideColumns(columnIndex, numColumns): 주어진 색인에서 시작하는 1개 이상 연속적인 란을 숨깁니다. 방법은 0 근거한 색인을 이용합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Hides the first three columnssheet.hideColumns(0, 3)

지정한 범위의 열 숨기기 해제

unhideColumn(column): 지정한 범위의 열 숨기기를 해제합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// This unhides the first column if it was previously hiddenconst range = sheet.getRange('A:A')sheet.unhideColumn(range)

연속된 여러 열 숨기기 해제

showColumns(columnIndex, numColumns): 주어진 색인에서 시작된 1개 이상 연속적인 란을 삭제하십시오. 방법은 0 근거한 색인을 이용합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Unhides the first three columnssheet.showColumns(0, 3)

열 너비 설정

setColumnWidth(columnPosition, width): 지정한 열의 너비를 픽셀 단위로 설정합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Sets the first column to a width of 200 pixelssheet.setColumnWidth(0, 200)

여러 열의 너비 설정

setColumnWidths(startColumn, numColumns, width): 지정한 열들의 너비를 픽셀 단위로 설정합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Sets the first three columns to a width of 200 pixelssheet.setColumnWidths(0, 3, 200)

열 크기 자동 조정

autoResizeColumns(startColumn, numColumns): 주어진 란의 폭을 텍스트 콘텐츠를 맞게 설정합니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Set the A:C columns to a width that fits their text.sheet.autoResizeColumns(0, 3)

열 사용자 지정 속성 설정

setColumnCustom(custom): 주어진 란에 관례 재산을 놓습니다. 각 란은 추가 정보를 저장하기를 위한 어떤 JSON 자료를 붙들 수 있는 custom 목표를 받아들입니다. custom를 쓰기는 이전에 저장한 custom 자료. 기존 custom 자료를 지키기 위하여는, custom 목표가 첫째로 읽고, 새로운 자료로 합병하고, 그 후에 그것을 씁니다.

TypeScript
const sheet = univerAPI.getActiveWorkbook().getActiveSheet()// Set custom properties for the first and third columnssheet.setColumnCustom({  0: { color: 'red' },  2: { size: 16 },})

크기 검증과 크기가 0인 행·열

줄 높이와 열 폭은 무한해야합니다, 비 부정 번호. 차원 명령은 숫자 문자열, 부정적인 값, NaN 및 Infinity를 거부합니다. Zero는 개별 행 또는 열을 허용하지만 defaultRowHeight와 defaultColumnWidth는 엄격하게 긍정적이어야합니다. 시트가 생성되면 Univer가 스냅 샷의 잘못된 크기를 정상화합니다.

크기가 0이 가시적 플래그를 통해 숨겨지은 한 개에서 행 또는 열이 다릅니다. 눈에 띄는 0 크기의 행 또는 열은 시트의 기본 크기로 복원하고, undo/redo는 변경을 포함합니다. 편집기로 전달하기 전에 공공 검증자와 외부 차원을 검증합니다.

TypeScript
import { isValidColumnDimensions, isValidRowDimensions, isValidSheetDimension } from '@univerjs/core'isValidSheetDimension(24) // trueisValidSheetDimension(0, false) // false: default dimensions must be positiveisValidRowDimensions({ h: 24, ah: 32 }) // trueisValidColumnDimensions({ w: -1 }) // false

이 가이드는 어떠셨나요?

© 2026 DreamNum Co., Ltd.